mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-11 19:48:30 +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:
@@ -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