Close futures orders : Order would immediately trigger.

Hello,

I open an order with futures_create_order like that : client.futures_create_order(symbol='BNBUSDT', type='MARKET', side='BUY', quantity=0.03, recudeOnly=False or True)

In a moment I want to close this order, but I dont have the information of quantity BUY so I tested that :
client.futures_create_order(symbol='BNBUSDT', type='STOP_MARKET', side='BUY', stopPrice=price_close, closePosition='true')

ticker_close = client.get_ticker(symbol='BNBUSDT') price_close = ticker_close['bidPrice']

Didn’t work ! I have this error : Order would immediately trigger.

  • I think this post will help you understand the logic to close positions: How to close an open position in futures? (you close with an opposite order)

  • Take note that the exchange’s prices moves quickly, so it’s possible that when you got bidPrice and placed new order with stopPrice=bidPrice, the latest orderbook’s bidPrice is already lower, so you will be buying at higher price than the askPrice, which leads to your “Order would immediately trigger.”.

You can use websocket for faster ticker updates (https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams).

1 Like

Thank for your anwser it’s possible to see all open order in futures ?
I test client.futures_account_trades(symbol=‘BNBUSDT’, limit=1) but I dont have an anwser to see if it’s a close order or an open order.

We don’t have officially supported sdks, but the endpoint would be:

https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data