def checkCanceled(self, broker, bars): # This check is only for accepted orders that are not GTC. if self.getGoodTillCanceled() or not self.isAccepted(): return # If its the last bar of the session and the order was not filled then cancel it. bar_ = bars.getBar(self.getInstrument()) if bar_ != None and bar_.getSessionClose(): broker.cancelOrder(self)
def checkCanceled(self, broker, bars): # This check is only for accepted orders that are not GTC. if self.getGoodTillCanceled() or not self.isAccepted(): return # If its the last bar of the session and the order was not filled then cancel it. bar = bars.getBar(self.getInstrument()) if bar is not None and bar.getSessionClose(): broker.cancelOrder(self)
def checkCanceled(self, broker, bars): # If its the last bar of the session and the order is not GTC, then cancel it. bar_ = bars.getBar(self.getInstrument()) if bar_ != None and self.isAccepted() and self.getGoodTillCanceled() == False and bar_.getSessionClose(): broker.cancelOrder(self)