BUG: Use normed last_close instead of period_end.

`period_end` can be outside the range of data for which we have dates.
`last_close` properly gets pulled back to the last date for which we
actually have data.

We should consider whether or not we need to be storing period_end at
all.
This commit is contained in:
Scott Sanderson
2015-08-03 12:09:26 -04:00
parent 69d5aed7f6
commit 0cc84e7a15
+1 -1
View File
@@ -1281,7 +1281,7 @@ class TradingAlgorithm(object):
"""
days = self.trading_environment.trading_days
start_date_loc = days.get_loc(start_date)
sim_end = self.sim_params.period_end
sim_end = self.sim_params.last_close.normalize()
end_loc = min(start_date_loc + 252, days.get_loc(sim_end))
end_date = days[end_loc]
return self.engine.factor_matrix(