BUG: Fix next trading calculation.

If we are in a day beyond the historical data use the last close,
instead. Relevant for trading current data.
This commit is contained in:
fawce
2013-05-07 18:44:44 -04:00
committed by Eddie Hebert
parent 3d8674ffb6
commit ede8471663
+5 -2
View File
@@ -362,8 +362,11 @@ class PerformanceTracker(object):
# increment the day counter before we move markers forward.
self.day_count += 1.0
# move the market day markers forward
self.market_open, self.market_close = \
trading.environment.next_open_and_close(self.market_open)
if self.market_close < trading.environment.last_trading_day:
_, self.market_close = \
trading.environment.next_open_and_close(self.market_open)
else:
self.market_close = self.sim_params.last_close
def handle_market_close(self):
# add the return results from today to the list of DailyReturn objects.