mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 09:02:58 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user