The stop order is not closed when the position is closed

Hi guys! I use an unofficial python library for the binance api and work with futures. I have the following problem - I create a STOP_MARKET order with the closePosition=True parameter, but it does not close automatically when a position is closed by Take Profit and remains active even when a position is closed. Although if you create the same order in the web interface, it will close automatically when the position is closed. Is there a solution for this?

session.futures_create_order(
symbol=pair,
side=‘BUY’,
type=‘STOP_MARKET’,
stopPrice=order_sl_price,
closePosition=‘true’)

Hi, I think you might be confused with the usage of closePosition parameter.

A STOP_MARKET with closePosition=True, means that if this STOP_MARKET order is triggered, it’ll close all current long position ( if SELL ) or current short position( if BUY). It’s not a position being closed that’ll affect and make this STOP_MARKET order to close, which is what I understood from your post description.

What you’re seeing the web interface might be the TP/SL option, which is a different feature.