I am puzzled by positions being autoclosed on Testnet futures at 00:00 UTC. I am not certain it happens every day, but it happens with sufficient regularity that it is now becoming irritating.
For example, today I had a small (.4 BTC), profitable (~100 USDT) position opened and managed through the API by my trading engine. There was realized profit (compared with the initial 10K seed) of 3K in the account (a total of 13K+). So (acknowledging that funds are imaginary) there was little maintenance margin required, and more than sufficient funds to meet the margin requirements and pay any funding fee at 00:00 - so no apparent reason to close the position. However, the position was liquated (and profit realized) but that is not what I wanted. I am exercising the trading engine and I want to monitor the decisions it makes.
The Client OrderId as it appeared in the USER_DATA_UPDATE stream was settlement_autoclose_xxx (a type that is not documented anywhere that I could find; autoclose is mentioned in the FUTURES API but not settlement_autoclose; and autoclose is supposed to be the start of a liquidation order, with no further discussion of what causes liquidation orders at Binance API Documentation).
So the question is, what is causing this behavior/where is it documented?? The behavior significantly reduces the utility of Testnet to test automation through the API for extended (longer than one day) periods.
Thanks.
Jack
Testnet will do a clean up everyday at UTC 0 and the event that will be sent is settlement_autoclose. If you are looking to backtest your strategy, you can consider using historical production data here (Binance Data Collection)
Thanks. Dare I suggest it would be helpful to document that along with the brief references to Testnet in the API docs (acknowledging I may have missed it is there a Change Log site for Testnet FUTURES equivalent to https://testnet.binance.vision/ for SPOT??).
Regarding using historical production data - the issue is that for obvious reasons I am not eager to build something to reproduce the dynamic behavior of the exchange, including communication latencies. Historical data is of course necessary for modeling, but by itself doesn’t capture systemic effects. That’s why I have been using Testnet - I stream market data from the real exchange, coupled with account data from a Testnet account. I realize there are data discrepancies, which means model decisions are NOT completely accurately reflected (order decisions based on real data are sent to Testnet for execution, where the prices are not the same), but monitoring the dynamics has been very useful.
On that point, it looks like around 02:42 UTC today (Dec 9) the real market data streams were interrupted, while Testnet account data stayed alive. Was there an outage on the real exchange at around 02:42?
Thanks,
Jack