mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 15:09:59 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user