From 768e572433fea6c9c1112d6716aa3cfda3558a82 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 1 Dec 2017 22:35:17 +0800 Subject: [PATCH] [Fix]Close #589 --- vnpy/trader/app/ctaStrategy/ctaTemplate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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):