¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

>>errorCode= 161 errorString= Cancel attempted when order is not in a cancellable state


 

Hi,

Pyton, API:
Got this unwated message:
>>errorCode=? 161? errorString= Cancel attempted when order is not in a cancellable state.
?
?
Flow:
Bracket with 3 legs,?
self.takeProfit.orderType = 'LMT'
self.stopLoss.orderType = "TRAIL"
self.GAT.orderType = 'MKT'
?
I later submit a price apdate (once only), after reciving Exec datails
(re send? LMT and TRAIL legs with updated amounts)
(this works fine)
?
Added code to close potion (given a certain situation:)
? ? ? self.reqGlobalCancel()? ? ? ? ? ? ?# first cancel all prevoius orders
? ? ? self.placeOrder(self.nextOrderId, self.contract, order)? # submit new order
?
thats when I got this starange message:
>>errorCode=? 161? errorString= Cancel attempted when order is not in a cancellable state.
this error refers by number to the parentID
?
Perhaps the price update prevents cancelation?
Could I close the postion differantly?
?
Thanks
?
Harrris
?
?
?
?