I want to close a position, but when I use this code to close the position, it makes a new order, I don't want that.
shortQty = float(positions[position]['origQty'])
client.futures_create_order(symbol=str(tkr), side="SELL", type="MARKET", quantity=shortQty)
For example: if I have a long positon when I use this code it closes a long and opens a short. I want to close the position without opening a new order.
Binance does not have a dedicated endpoint for closing a position, but you can make use of the the
closePosition
attribute - see this SO Q&A "Closing Open positions on Binance".(Note that the closing operation is the same as placing a new order and so the commission fee is required)