sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.96k stars 2.19k forks source link

Unable to place futures order #1220

Open vectar31 opened 2 years ago

vectar31 commented 2 years ago

I am trying to place a futures order, adausdt perpetual future to be precise. I take the following action : client.futures_create_order(symbol='ADAUSDT',side=SIDE_BUY,type=ORDER_TYPE_MARKET,quantity=15)

I get the following error : binance.exceptions.BinanceAPIException: APIError(code=-2019): Margin is insufficient.

This is weird because i have sufficient usdt balance in my usdm futures wallet. I can confirm this by the action : info = client.futures_account() Which gives me the following response :

{'feeTier': 0, 'canTrade': True, 'canDeposit': True, 'canWithdraw': True, 'updateTime': 0, 'totalInitialMargin': '46667.97138034', 'totalMaintMargin': '239.57451852', 'totalWalletBalance': '50008.92846761', 'totalUnrealizedProfit': '-3821.96364448', 'totalMarginBalance': '46186.96482313', 'totalPositionInitialMargin': '46667.97138034', 'totalOpenOrderInitialMargin': '0.00000000', 'totalCrossWalletBalance': '50008.92846761', 'totalCrossUnPnl': '-3821.96364448', 'availableBalance': '0.00000000', 'maxWithdrawAmount': '0.00000000', 'assets':.....

So i don't know why i get the 'Margin is insufficient' error. What might be the problem here?