Need help! Which way do you cancel orders?

I’m pulling my hair out over a simple thing like canceling orders.
Could someone please explain to me what’s the best way to cancel an order?

I have read the documentation, but it doesn’t help me to answer these questions.

How to detect if the opposing order has been filled? (cancel stop order if take profit filled, or vice versa)
Should I detect via websocket or REST?
A small code example would be awesome

Thank you!

When creating the stop and take profit orders, you can save both originated order ids and then listen to the websocket ( for ORDER_TRADE_UPDATE to know when one of the order ids got filled, after filling, you can use ( to cancel another saved order id.

Thank you. I’ll try it

How can you do it exactly? Because I’m trying adding the symbol and the orderId to the params of cancel_order and nothing happened

Hi @yumewebs, we don’t have official sdk for futures, so I can’t help with only cancel_order.
Try to discover the request you’re sending in query-string to make sure it’s correct.
You can also use for a simplified way of using REST api.