mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-28 12:51:29 +08:00
MAINT: Use pandas for daily treasury values in risk.
This commit is contained in:
1 parent
f9e2dd76b4
commit
a60d5c99a9
1 file changed
+2
-2
@@ -107,7 +107,7 @@ class RiskMetricsCumulative(object):
|
||||
|
||||
self.max_drawdown = 0
|
||||
self.current_max = -np.inf
|
||||
self.daily_treasury = {}
|
||||
self.daily_treasury = pd.Series(index=self.trading_days)
|
||||
|
||||
def get_minute_index(self, sim_params):
|
||||
return pd.date_range(sim_params.first_open, sim_params.last_close,
|
||||
@@ -165,7 +165,7 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}"
|
||||
# curves on every minute.
|
||||
treasury_end = self.algorithm_returns.index[-1].replace(
|
||||
hour=0, minute=0)
|
||||
if treasury_end not in self.daily_treasury:
|
||||
if np.isnan(self.daily_treasury[treasury_end]):
|
||||
treasury_period_return = choose_treasury(
|
||||
self.treasury_curves,
|
||||
self.start_date,
|
||||
|
||||
Reference in new issue
Block a user