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)