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.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 3167841d..728662e9 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -24,12 +24,23 @@ class DualCorrTranche():
_cache = LRU(64)
_Legs = namedtuple('Legs', 'coupon_leg, protection_leg, bond_price')
- def __init__(self, index_type: str, series: int, tenor: str, *,
+ def __init__(self, index_type: str=None, series: int=None,
+ tenor: str=None, *,
attach: float, detach: float, corr_attach: float,
corr_detach: float, tranche_running: float,
notional: float=10_000_000,
+ redcode: str=None,
+ maturity: datetime.date=None,
value_date: pd.Timestamp=pd.Timestamp.today().normalize(),
use_trunc=False):
+
+ if all((redcode, maturity)):
+ r = (serenitas_engine.
+ execute("SELECT index, series, tenor FROM index_desc "
+ "WHERE redindexcode=%s AND maturity = %s",
+ (redcode, maturity)))
+ index_type, series, tenor = next(r)
+
self._index = BasketIndex(index_type, series, [tenor],
value_date=value_date)