aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/analytics/tranche_basket.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index ee7f25ca..f6b87dd1 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -308,7 +308,10 @@ class TrancheBasket(BasketIndex):
self.tenor = tenor
index_desc = self.index_desc.reset_index('maturity').set_index('tenor')
self.maturity = index_desc.loc[tenor].maturity.date()
- self._get_tranche_quotes(value_date)
+ try:
+ self._get_tranche_quotes(value_date)
+ except ValueError as e:
+ raise ValueError(f"no tranche quotes available for date {value_date}") from e
self.K_orig = np.hstack((0., self.tranche_quotes.detach)) / 100
self.K = adjust_attachments(self.K_orig, self.cumloss, self.factor)
self._Ngh = 250
@@ -369,9 +372,9 @@ class TrancheBasket(BasketIndex):
1, self.yc, self.maturity)
try:
self._get_tranche_quotes(d)
- except ValueError as e:
self._accrued = np.array([cds_accrued(self.value_date, r)
for r in self.tranche_quotes.running])
+ except ValueError as e:
raise ValueError(f"no tranche quotes available for date {d}") from e
@@ -593,7 +596,6 @@ class TrancheBasket(BasketIndex):
def aux(rho, obj, K, quote, spread, complement):
cl, pl = obj.tranche_legs(K, rho, complement)
return pl + cl * spread + quote
-
if skew_type == "bottomup":
for j in range(len(dK) - 1):
cl, pl = self.tranche_legs(self.K[j], self.rho[j])