aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/tranche_basket.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/tranche_basket.py')
-rw-r--r--python/analytics/tranche_basket.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index ff46c74e..f09cfedb 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -27,15 +27,14 @@ class DualCorrTranche():
value_date: pd.Timestamp=pd.Timestamp.today().normalize()):
self._index = BasketIndex(index_type, series, [tenor], value_date=value_date)
- # def get_quotes(self, spread):
- # index = self.
-
- # maturity = self._index.maturities[0]
- # return {maturity:
- # self._snacpv(spread * 1e-4, self.coupon(maturity), self.recovery,
- # maturity)}
- # # monkey patch _get_quotes (don't try it at home)
- # BasketIndex._get_quotes = get_quotes
+ def get_quotes(self, spread):
+ maturity = self.maturities[0]
+ return {maturity:
+ self._snacpv(spread * 1e-4, self.coupon(maturity), self.recovery,
+ maturity)}
+ # monkey patch _get_quotes (don't try it at home)
+ # but it works...: replaces _get_quotes with this simpler one
+ BasketIndex._get_quotes = get_quotes
self.maturity = self._index.maturities[0]
self.index_type = index_type
self.series = series
@@ -195,7 +194,7 @@ class DualCorrTranche():
return "\n".join(s)
def shock(self, params=['pnl'], *, spread_shock, corr_shock, **kwargs):
- orig_spread, orig_rho = self._index.spread()[0], self.rho
+ orig_rho = self.rho
r = []
actual_params = [p for p in params if hasattr(self, p)]
for ss in spread_shock:
@@ -213,6 +212,11 @@ class DualCorrTranche():
index=pd.MultiIndex.from_product([spread_shock, corr_shock],
names=['spread_shock', 'corr_shock']))
+ def mark(self, **args):
+ #mark BasketIndex
+ #mark correlation
+ pass
+
class TrancheBasket(BasketIndex):
def __init__(self, index_type: str, series: int, tenor: str, *,