mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-29 13:00:42 +08:00
BUG: Stops the TradingEnvironment from being created at import time when
zipline.utils.events is imported. Changes the class level attribute `env` on EventRule to a property so that the environment is only looked up at when needed.
This commit is contained in:
1 parent
3c37704a5b
commit
d6e997e96c
1 file changed
+3
-1
@@ -175,7 +175,9 @@ class EventRule(six.with_metaclass(ABCMeta)):
|
||||
"""
|
||||
An event rule checks a datetime and sees if it should trigger.
|
||||
"""
|
||||
env = TradingEnvironment.instance()
|
||||
@property
|
||||
def env(self):
|
||||
return TradingEnvironment.instance()
|
||||
|
||||
@abstractmethod
|
||||
def should_trigger(self, dt):
|
||||
|
||||
Reference in new issue
Block a user