Binance Futures Hedge Mode close one specific position

Hi,

Im in HEDGE mode and I have more than >1 opened positions at the same time. They could have the same positionSide (2 longs or 2 shorts) and also could be different (1long 1short). We could have much more positions running.

How could I close a specific position of them? I mean, I tried the next and didnt work for me:

order = createOrder(MARKET, ...)
sleep(5)
cancelOrder(order.orderId, ...)

Is anyway to close partially or fully a specific function in the Binance Futures API? I know that exists a way on the web and mobile devices apps, but for the API?
Thanks,


From the endpoint above, there is a parameter named positionSide. This is used to specify LONG or SHORT in hedge mode. To close a position, you have to create an order in the opposite direction of your current position. For instance, I have an open position of 0.01 BTCUSDT Long. If i want to close it,
i have to place an order of SIDE: SELL, positionSide: Long with quantity: 0.01 to close this position.

P.S: orders and positions are different in futures