diff options
Diffstat (limited to 'python/analytics/tranche_basket.py')
| -rw-r--r-- | python/analytics/tranche_basket.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py index 0bf661e7..3bc5b104 100644 --- a/python/analytics/tranche_basket.py +++ b/python/analytics/tranche_basket.py @@ -253,7 +253,7 @@ class TrancheBasket(BasketIndex): def aux2(x, index1, index2, K2): newrho = expit(index1._skew(logit(x))) return np.log(self.probability_trunc(x, newrho)) - \ - np.log(index2.probability_trunc(x, newrho)) + np.log(index2.probability_trunc(K2, newrho)) if method not in ["ATM", "TLP", "PM"]: raise ValueError("method needs to be one of 'ATM', 'TLP' or 'PM'") @@ -269,14 +269,14 @@ class TrancheBasket(BasketIndex): K1eq = [] m = np.nanmax(index2.K) for K2 in index2.K[1:-1]: - K1eq.append(brentq(aux, 0., m, (self, el1, index2, K2))) + K1eq.append(brentq(aux, 0., m, (self, el1, index2, el2, K2))) K1eq = np.array(K1eq) elif method == "PM": K1eq = [] - m = np.nanmax(K2) + 0.25 + m = np.nanmax(index2.K) + 0.25 for K2 in index2.K[1:-1]: - K1eq.append(brentq(aux, K2 * 0.1, K2*1.8, + K1eq.append(brentq(aux2, K2 * 0.1, K2 * 1.8, (self, index2, K2))) - return np.hstack([np.nan, K1eq, np.nan]) + return np.hstack([np.nan, expit(self._skew(logit(K1eq))), np.nan]) |
