mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-04 19:25:35 +08:00
Don't let record_variables be used after initialize.
This commit is contained in:
@@ -37,4 +37,10 @@ Please use PerShare or PerTrade.
|
||||
You attempted to override commission after the simulation has \
|
||||
started. You may only call override_commission in your initialize \
|
||||
method.
|
||||
""".strip()
|
||||
|
||||
CALL_RECORD_VARIABLES_POST_INIT = """
|
||||
You attempted to register recorded variables after the simulation has \
|
||||
started. You may only call record_variables in your initialize \
|
||||
method.
|
||||
""".strip()
|
||||
|
||||
@@ -286,6 +286,9 @@ class TradingAlgorithm(object):
|
||||
if isinstance(names, basestring):
|
||||
names = [names]
|
||||
|
||||
if self.initialized:
|
||||
raise Exception(MESSAGES.ERRORS.CALL_RECORD_VARIABLES_POST_INIT)
|
||||
|
||||
self._registered_vars.update(set(names))
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user