From 19bf554ecb41327f5f2973b84f921c48e85fa446 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 16 Oct 2017 14:47:10 +0800 Subject: [PATCH] [Fix] close #545 --- vnpy/trader/app/ctaStrategy/ctaEngine.py | 5 +++-- vnpy/trader/vtEngine.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vnpy/trader/app/ctaStrategy/ctaEngine.py b/vnpy/trader/app/ctaStrategy/ctaEngine.py index dff400de..a13177c3 100644 --- a/vnpy/trader/app/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/app/ctaStrategy/ctaEngine.py @@ -621,8 +621,9 @@ class CtaEngine(object): """全部撤单""" s = self.strategyOrderDict[name] - # 遍历集合,全部撤单 - for orderID in s: + # 遍历列表,全部撤单 + # 这里不能直接遍历集合s,因为撤单时会修改s中的内容,导致出错 + for orderID in list(s): if STOPORDERPREFIX in orderID: self.cancelStopOrder(orderID) else: diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py index d343ae35..37920001 100644 --- a/vnpy/trader/vtEngine.py +++ b/vnpy/trader/vtEngine.py @@ -794,7 +794,7 @@ class PositionDetail(object): self.longPosFrozen = self.longYdFrozen + self.longTdFrozen self.shortPosFrozen = self.shortYdFrozen + self.shortTdFrozen - self.output() + #self.output() #---------------------------------------------------------------------- def output(self):