MAINT: Use dt in risk update method instead of last return index.

The current dt is already in scope in the update method, so use
that instead of also reading it from the algorithm_returns index.
This commit is contained in:
Eddie Hebert
2013-09-25 13:53:30 -04:00
parent fcd62d538b
commit d7e670521d
+3 -3
View File
@@ -159,13 +159,13 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}"
# caching the treasury rates for the minutely case is a
# big speedup, because it avoids searching the treasury
# curves on every minute.
treasury_end = self.algorithm_returns.index[-1].replace(
hour=0, minute=0)
# In both minutely and daily, the daily curve is always used.
treasury_end = dt.replace(hour=0, minute=0)
if np.isnan(self.daily_treasury[treasury_end]):
treasury_period_return = choose_treasury(
self.treasury_curves,
self.start_date,
self.algorithm_returns.index[-1]
treasury_end
)
self.daily_treasury[treasury_end] =\
treasury_period_return