diff --git a/vnpy/trader/app/ctaStrategy/ctaTemplate.py b/vnpy/trader/app/ctaStrategy/ctaTemplate.py index 640833c1..5cf9b0ff 100644 --- a/vnpy/trader/app/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/app/ctaStrategy/ctaTemplate.py @@ -246,7 +246,8 @@ class TargetPosTemplate(CtaTemplate): def onOrder(self, order): """收到委托推送""" if order.status == STATUS_ALLTRADED or order.status == STATUS_CANCELLED: - self.orderList.remove(order.vtOrderID) + if order.vtOrderID in self.orderList: + self.orderList.remove(order.vtOrderID) #---------------------------------------------------------------------- def setTargetPos(self, targetPos):