mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-17 11:25:55 +08:00
MAINT: Set initial values so to_dict can be called immediately
Previously, it would raise an exception.
This commit is contained in:
@@ -204,6 +204,9 @@ class RiskMetricsCumulative(object):
|
||||
self.max_drawdown = 0
|
||||
self.current_max = -np.inf
|
||||
self.daily_treasury = pd.Series(index=self.trading_days)
|
||||
self.treasury_period_return = np.nan
|
||||
|
||||
self.num_trading_days = 0
|
||||
|
||||
def get_minute_index(self, sim_params):
|
||||
"""
|
||||
@@ -338,7 +341,7 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}"
|
||||
dt = self.latest_dt
|
||||
period_label = dt.strftime("%Y-%m")
|
||||
rval = {
|
||||
'trading_days': len(self.algorithm_returns),
|
||||
'trading_days': self.num_trading_days,
|
||||
'benchmark_volatility': self.metrics.benchmark_volatility[dt],
|
||||
'algo_volatility': self.metrics.algorithm_volatility[dt],
|
||||
'treasury_period_return': self.treasury_period_return,
|
||||
|
||||
Reference in New Issue
Block a user