解决类变量重复赋值的Bug

This commit is contained in:
Jokers 2019-07-02 10:15:43 +08:00
parent feef63adfa
commit 2363583fc3

View File

@ -32,8 +32,11 @@ class CtaTemplate(ABC):
self.trading = False self.trading = False
self.pos = 0 self.pos = 0
if "inited" not in self.variables:
self.variables.insert(0, "inited") self.variables.insert(0, "inited")
if "trading" not in self.variables:
self.variables.insert(1, "trading") self.variables.insert(1, "trading")
if "pos" not in self.variables:
self.variables.insert(2, "pos") self.variables.insert(2, "pos")
self.update_setting(setting) self.update_setting(setting)