If I execute a limit order, that only gets partially filled, along with a stop_market order and Take_profit_market order, will the remaining unfilled limit order be cancelled if the closePosition parameter is set to True, or will that just close the partially filled limit order that is open?
For example, if my orders looked like this:
request_client.post_order(symbol=market,
ordertype=“LIMIT”,
price=entryPrice,
timeInForce=“GTC”,
side=position_side,
positionSide=“BOTH”,
quantity = qty)
request_client.post_order(symbol=market,
ordertype=“TAKE_PROFIT_MARKET”,
stopPrice= takeProfit,
side=stop_side,
callbackRate=_callbackRate,
quantity = qty,
closePosition=‘true’,
workingType=“CONTRACT_PRICE”)
request_client.post_order(symbol=market,
ordertype=“STOP_MARKET”,
stopPrice= stopLoss,
side=stop_side,
callbackRate=_callbackRate,
quantity = qty,
closePosition=‘true’,
workingType=“MARK_PRICE”)
Lets suppose that the first order, the limit order, only gets filled 20%. If the price then hits the Take Profit market order, will only that 20% position be closed, or is there some way to cancel the remaining limit order that has not been filled if the Take Profit is hit.
I’m aware that this probably won’t cancel any open orders, merely close any open positions. If there’s a better way to achieve this, please lmk. Otherwise, I’ll just have to get my bot to keep checking if the TP has been hit via a websocket etc and then cancel the remaining order.
Thanks