diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/analytics/tranche_basket.py | 8 | ||||
| -rw-r--r-- | python/notebooks/Tranche calculator.ipynb | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py index 9ec1a2b5..6ee49580 100644 --- a/python/analytics/tranche_basket.py +++ b/python/analytics/tranche_basket.py @@ -1288,6 +1288,14 @@ class TrancheBasket(BasketIndex): self.rho = rho_saved return corr01 + def implied_ss(self): + return ( + self.index_pv(clean=True).bond_price + - np.diff(self.K)[0] * self.tranche_pvs().bond_price[0] + - np.diff(self.K)[1] * self.tranche_pvs().bond_price[1] + - np.diff(self.K)[2] * self.tranche_pvs().bond_price[2] + ) / np.diff(self.K)[3] + def build_skew(self, skew_type="bottomup"): assert skew_type == "bottomup" or skew_type == "topdown" dK = np.diff(self.K) diff --git a/python/notebooks/Tranche calculator.ipynb b/python/notebooks/Tranche calculator.ipynb index 6039ef1e..fb30d134 100644 --- a/python/notebooks/Tranche calculator.ipynb +++ b/python/notebooks/Tranche calculator.ipynb @@ -34,12 +34,7 @@ "metadata": {}, "outputs": [], "source": [ - "#Implied SS\n", - "implied_ss = ((new_index.index_pv().bond_price - new_index.accrued()) -\n", - " ((new_index.K[1]-new_index.K[0]) * result.price[0] +\n", - " (new_index.K[2]-new_index.K[1]) * result.price[1] +\n", - " (new_index.K[3]-new_index.K[2]) * result.price[2]))/(new_index.K[4] - new_index.K[3])\n", - "implied_ss" + "new_index.implied_ss()" ] }, { @@ -49,7 +44,7 @@ "outputs": [], "source": [ "#Build previous series skew to price this new series\n", - "base_index = TrancheBasket(index_type, series-2, \"5yr\")\n", + "base_index = TrancheBasket(index_type, series-4, \"5yr\")\n", "base_index.tweak()\n", "base_index.build_skew()\n", "\n", |
