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.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 29074988..dab528c6 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -406,7 +406,7 @@ class TrancheBasket(BasketIndex):
return {self.maturity:
self._snacpv(refspread * 1e-4, self.coupon(self.maturity),
self.recovery, self.maturity)}
- raise ValueError("ref is missing")
+ raise ValueError("ref is missing")
@property
def default_prob(self):
@@ -647,22 +647,22 @@ class TrancheBasket(BasketIndex):
newrho = x
else:
newrho = expit(index1._skew(logit(x)))
- assert newrho >= 0. and newrho <= 1., "Something went wrong"
+ assert newrho >= 0. and newrho <= 1., f"Something went wrong x: {x}, rho: {newrho}"
return self.expected_loss_trunc(x, rho=newrho) / el1 - \
index2.expected_loss_trunc(K2, newrho, shortened) / el2
def aux2(x, index1, index2, K2, shortened):
newrho = expit(index1._skew(logit(x)))
- assert newrho >= 0 and newrho <= 1, "Something went wrong"
+ assert newrho >= 0 and newrho <= 1, f"Something went wrong x: {x}, rho: {newrho}"
return np.log(self.probability_trunc(x, newrho)) - \
np.log(index2.probability_trunc(K2, newrho, shortened))
def find_upper_bound(*args):
K2 = args[4]
while aux(K2, *args) < 0:
+ K2 *= 1.1
if K2 > 1.:
raise ValueError("Can't find reasonnable bracketing interval")
- K2 *= 1.1
return K2
if method not in ["ATM", "TLP", "PM"]: