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:
Jamie Kirkpatrick
2014-01-30 16:04:29 -05:00
committed by twiecki
parent 45844bac31
commit 147242339d
4 changed files with 36 additions and 2 deletions
+4 -1
View File
@@ -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