From 2363583fc346c662306156b51153916c40272f67 Mon Sep 17 00:00:00 2001 From: Jokers Date: Tue, 2 Jul 2019 10:15:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=B1=BB=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=B5=8B=E5=80=BC=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/app/cta_strategy/template.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vnpy/app/cta_strategy/template.py b/vnpy/app/cta_strategy/template.py index a95a9185..7a97bdbd 100644 --- a/vnpy/app/cta_strategy/template.py +++ b/vnpy/app/cta_strategy/template.py @@ -32,9 +32,12 @@ class CtaTemplate(ABC): self.trading = False self.pos = 0 - self.variables.insert(0, "inited") - self.variables.insert(1, "trading") - self.variables.insert(2, "pos") + if "inited" not in self.variables: + self.variables.insert(0, "inited") + if "trading" not in self.variables: + self.variables.insert(1, "trading") + if "pos" not in self.variables: + self.variables.insert(2, "pos") self.update_setting(setting)