diff --git a/zipline/finance/risk.py b/zipline/finance/risk.py index 06a683b4..413383b0 100644 --- a/zipline/finance/risk.py +++ b/zipline/finance/risk.py @@ -123,6 +123,7 @@ class RiskMetrics(): Creates a dictionary representing the state of the risk report. Returns a dict object of the form: """ + period_label = self.end_date.strftime("%Y-%m") return { 'trading_days' : self.trading_days, 'benchmark_volatility' : self.benchmark_volatility, @@ -134,7 +135,8 @@ class RiskMetrics(): 'beta' : self.beta, 'alpha' : self.alpha, 'excess_return' : self.excess_return, - 'max_drawdown' : self.max_drawdown + 'max_drawdown' : self.max_drawdown, + 'period_label' : period_label } def __repr__(self): @@ -345,7 +347,7 @@ class RiskReport(): '1_month' : [x.to_dict() for x in self.month_periods], '3_month' : [x.to_dict() for x in self.three_month_periods], '6_month' : [x.to_dict() for x in self.six_month_periods], - '12_month' : [x.to_dict() for x in self.month_periods] + '12_month' : [x.to_dict() for x in self.year_periods] } def periodsInRange(self, months_per, start, end):