MAINT: Mask treasury_curves used by risk metrics to period range.

So that calculations that leverage the range of the treasury_curves,
like `pd.Series.searchsorted` will not overshoot the 'end' of the
range we are calculating risk metrics.
This commit is contained in:
Eddie Hebert
2013-04-03 15:47:14 -04:00
parent cf60eeb46b
commit bb3e9727dc
+5 -1
View File
@@ -282,7 +282,11 @@ that date doesn't exceed treasury history range."
class RiskMetricsBase(object):
def __init__(self, start_date, end_date, returns):
self.treasury_curves = trading.environment.treasury_curves
treasury_curves = trading.environment.treasury_curves
mask = ((treasury_curves.index >= start_date) &
(treasury_curves.index <= end_date))
self.treasury_curves = treasury_curves[mask]
self.start_date = start_date
self.end_date = end_date