So let me expain, I spent a few days coding my fairly complexe trading algo in python, and in the algo I made sure to record all my positions in a text file, and after 5 days of smooth trading something NOT normal happened :
Day 1) in my logs I was supposed to lose 25$ but the binance-futures-connector package for some reason opened 4 times more the size I am supposed to open which resulted in a big loss in my account. I did every thing I can to find the bug but still I dont understand why the bot opened 4 times my positions size.
Day 2) the same happened and I lost another 100$ instead of 25$
I paid more than 40$ in trading fees in less than 7 days trading … and as a costumer I just need some logical explanation about why this happened. I am sure there is nothing wrong on my end it’s the package who have some sort of bug or something,
We are sorry to hear that. However there is limitation to understand how it happening, especially when the trading algo is complicated.
Here is some suggestions that may be helpful to debug:
Please check how many orders are placed at the time? one order or 4 orders?
Is the order qty same as your expected?
It always recommended to test the library in futures testnet (26699.7 | BTCUSDT USDⓈ-Margined Perpetual Chart | Binance Futures) and only go live trading when your application is well tested.
It may also worth to consider to do code refactoring. Start from simpler logic and watch the application if it’s acting as expected.
binance “testnet” is pure waste of time, no liquidity, the price diverge massively from the real net …, you can’t even close all positions or restart you account with 0 position all test are flowed because of unclosed positions(that I can’t close anyway) .
apparently the reason of the bug above, is because instead of opening BUY order the API opened an SELL one which resulted in the positions getting bigger and bigger.
to be honest I just wish that it’s my code who have some bug in it
Testnet is not a good place to test a strategy. It’s a sandbox environment where you can test api calls and experiment with the interface, but since it’s not a real-money market, you can’t trust any performance data from strategies that you try to trade on testnet. For that you should look to make your own paper trading logic to simulate where fills would happen.