Skip to content

Commit da29453

Browse files
committed
feat: add a get method for rolling cov estimator
1 parent 220ba02 commit da29453

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/fpm_risk_model/cov_estimator.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Optional
22

33
from numpy import diag_indices_from, trace
4-
from pandas import DataFrame, Series
4+
from pandas import DataFrame, Series, Timestamp
55

66
from .risk_model import RiskModel
77
from .rolling_factor_risk_model import RollingFactorRiskModel
@@ -143,3 +143,18 @@ def cov(self, volatility: Optional[DataFrame] = None):
143143
)
144144
for date, risk_model in self._rolling_risk_model.items()
145145
}
146+
147+
def get(self, date: Timestamp) -> CovarianceEstimator:
148+
"""
149+
Get the covariance estimator for a given date.
150+
151+
Parameters
152+
----------
153+
date : pd.Timestamp
154+
Date.
155+
"""
156+
return CovarianceEstimator(
157+
self._rolling_risk_model.get(date),
158+
shrinkage_method=self.shrinkage_method,
159+
delta=self.delta,
160+
)

0 commit comments

Comments
 (0)