From d7e670521daa5ebd2cb09ed5b63a2cafb50ce09d Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Wed, 25 Sep 2013 13:53:30 -0400 Subject: [PATCH] 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. --- zipline/finance/risk/cumulative.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zipline/finance/risk/cumulative.py b/zipline/finance/risk/cumulative.py index 6ae0136d..395ef661 100644 --- a/zipline/finance/risk/cumulative.py +++ b/zipline/finance/risk/cumulative.py @@ -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