mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-02 12:12:36 +08:00
BUG: Ensure that data_frequency set on algo is set on sim_params.
Set the data_frequency member of an algorithm on the sim_params configuration object. Though the extra setting is slightly redundant, it is needed to ensure that the same data_frequency is used throughout. Should fix a bug where an algo that was intended to be run in minute mode was operating as if it were daily in performance. Possible TODO: Remove data_frequency as a param to TradingAlgorithm, in favor of only being a property of sim_params.
This commit is contained in:
@@ -117,6 +117,8 @@ class TradingAlgorithm(object):
|
||||
self.capital_base = kwargs.get('capital_base', DEFAULT_CAPITAL_BASE)
|
||||
|
||||
self.sim_params = kwargs.pop('sim_params', None)
|
||||
if self.sim_params:
|
||||
self.sim_params.data_frequency = self.data_frequency
|
||||
|
||||
self.blotter = kwargs.pop('blotter', Blotter())
|
||||
|
||||
@@ -202,6 +204,8 @@ class TradingAlgorithm(object):
|
||||
processed by the zipline, and False for those that should be
|
||||
skipped.
|
||||
"""
|
||||
sim_params.data_frequency = self.data_frequency
|
||||
|
||||
self.data_gen = self._create_data_generator(source_filter,
|
||||
sim_params)
|
||||
self.perf_tracker = PerformanceTracker(sim_params)
|
||||
|
||||
Reference in New Issue
Block a user