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:
Joe Jevnik
2014-10-07 12:30:28 -04:00
parent 3c37704a5b
commit d6e997e96c
+3 -1
View File
@@ -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):