Don't let record_variables be used after initialize.

This commit is contained in:
Richard Frank
2013-02-11 14:44:46 -05:00
parent 2600bbe1de
commit 59d76ce378
2 changed files with 9 additions and 0 deletions
+6
View File
@@ -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()
+3
View File
@@ -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