Hello, I wrote a small program which takes care of some of the tasks that I’ve been doing manually. However I keep running into an issue which seems to be a bug, but it can very be caused by the fact that I don’t understand something in the API.
The problem is that I’m trying to place some sell orders on the delivery market. To do this, I’m calculating how many contracts can I short based on the price of the underlying tokens and the contract size. Even though most of the times this works just perfectly, sometimes I get a “Margin is insufficient” (-2019) error.
To check if this is an actual bug in my code, I’ve logged in to the web interface of binance, and tried to make a short from there (the only difference is that here I typed in the exact number of tokens that I had on my futures account, since binance can calculate the number of contracts from this). The strangest thing is that I got the same error, even though I manually typed in the number of tokens, and I’ve double checked if the value was right.
Could someone help me with this issue, please?