From 701687b812be6172699022d0c91217b98a9858ed Mon Sep 17 00:00:00 2001 From: fawce Date: Wed, 4 Apr 2012 11:37:19 -0400 Subject: [PATCH] fixed bug where year report list included months instead. added a period_label to risk metrics corresponding to the end date. e.g. April 2006 --- zipline/finance/risk.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zipline/finance/risk.py b/zipline/finance/risk.py index 06a683b4..ab2d10f3 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("%B %Y") 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):