mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
BUG: ensure perf stats are generated for all days
When running with minutely emissions the simulator would report to the user that it simulated 'n - 1' days (where n is the number of days specified in the simulation params). Now the correct number of trading days are reported as being simulated.
This commit is contained in:
committed by
twiecki
parent
45844bac31
commit
147242339d
@@ -59,6 +59,7 @@ DEFAULT_CAPITAL_BASE = float("1.0e5")
|
||||
|
||||
|
||||
class TradingAlgorithm(object):
|
||||
|
||||
"""
|
||||
Base class for trading algorithms. Inherit and overload
|
||||
initialize() and handle_data(data).
|
||||
@@ -83,6 +84,7 @@ class TradingAlgorithm(object):
|
||||
stats = my_algo.run(data)
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize sids and other state variables.
|
||||
|
||||
@@ -228,7 +230,8 @@ class TradingAlgorithm(object):
|
||||
"""
|
||||
if self.benchmark_return_source is None:
|
||||
env = trading.environment
|
||||
if self.data_frequency == 'minute':
|
||||
if (self.data_frequency == 'minute'
|
||||
or sim_params.emission_rate == 'minute'):
|
||||
update_time = lambda date: env.get_open_and_close(date)[1]
|
||||
else:
|
||||
update_time = lambda date: date
|
||||
|
||||
Reference in New Issue
Block a user