Hello all, a little help/guidance needed here regarding IBController + TWS
What I have:
IBKR FA Account - one login with multiple accounts under that login.
What I need:
Cancel all pending orders in a specific account, not all.
What I tried:
-
CancelAllPendingOrders() by itself -- cancels all pending orders like it says.
-
CancelAllPendingOrders()
withSetAccount()
which doesn't do what I need because per the instructionsSetAccount()
specifies the account only forPlaceOrders()
andModifyOrders()
-
My next thought was to try and get a csv list of pending orders using
IBC.GetPendingList(0,"Pending")
and then cancel them using a quick loop andCancelOrder()
however theGetPendingList()
still looks over ALL accounts -
I have not found a way to return the account number for a specific pending order... say for example the
IBC.GetPendingList(0,"Pending")
returns order ids 34,45,47,79... then I would loop through that list, check which account 34 is in, if in that account then Cancel...
One idea would be to store all the orders I sent out in a staticvar per account but this opens the risk of the var getting cleared by mistake... so trying to keep as a last resort.
If anyone have any suggestions, pointers, tips I would appreciate it!
A