Sometimes I forget live orders out and when I get filled, usually I dont want the fill any longer. But I also dont want to have to manually do this, this has to be done automatically, for everything except GTC orders
class KillEmAll(EWrapper):
def __init__(self):
self.connection = EClientSocket()
def reqAllOpenOrders(self):
self.connection.reqAllOpenOrders()
def openOrder(self, orderId, contract, order, state):
self.connection.cancelOrder(orderId)
Where on TWS do you insert this code? any way to make GTC orders an exception?Code:class KillEmAll(EWrapper): def __init__(self): self.connection = EClientSocket() def reqAllOpenOrders(self): self.connection.reqAllOpenOrders() def openOrder(self, orderId, contract, order, state): self.connection.cancelOrder(orderId)
untested but call reqAllOpenOrders after 30 minutes and the results comeback in openOrder
That's python code calling the API. If you're not a programmer it won't mean anything to you.Where on TWS do you insert this code? any way to make GTC orders an exception?
I will have to manually do that for every order..like GLDR says, "time in force" in the order ticket...