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.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 58d09365..da1b85d8 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -4,6 +4,7 @@ from .tranche_functions import (
credit_schedule, adjust_attachments, cds_accrued, GHquad, BCloss_recov_dist,
BCloss_recov_trunc, tranche_cl, tranche_pl)
from .index_data import get_singlenames_curves, get_tranche_quotes
+from collections import namedtuple
from copy import deepcopy
from pyisda.cdsone import upfront_charge
from pandas.tseries.offsets import BDay
@@ -105,10 +106,11 @@ class TrancheBasket(BasketIndex):
self.recovery_rates,
rho,
self._Z, self._w, self._Ngrid)
+ Legs = namedtuple('TrancheLegs', 'coupon_leg, protection_leg')
if complement:
- return tranche_cl(L, R, cs, K, 1.), tranche_pl(L, cs, K, 1.)
+ return Legs(tranche_cl(L, R, cs, K, 1.), tranche_pl(L, cs, K, 1.))
else:
- return tranche_cl(L, R, cs, 0., K), tranche_pl(L, cs, 0., K)
+ return Legs(tranche_cl(L, R, cs, 0., K), tranche_pl(L, cs, 0., K))
def tranche_pvs(self, protection=False, complement=False, shortened=0):
cl = np.zeros(self.rho.size)