diff options
Diffstat (limited to 'python/notebooks/tranche and swaption portfolio strategy.ipynb')
| -rw-r--r-- | python/notebooks/tranche and swaption portfolio strategy.ipynb | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/python/notebooks/tranche and swaption portfolio strategy.ipynb b/python/notebooks/tranche and swaption portfolio strategy.ipynb index c0355fb0..e3f5ea1f 100644 --- a/python/notebooks/tranche and swaption portfolio strategy.ipynb +++ b/python/notebooks/tranche and swaption portfolio strategy.ipynb @@ -14,7 +14,7 @@ "from analytics.scenarios import run_tranche_scenarios, run_portfolio_scenarios, run_tranche_scenarios_rolldown\n", "from analytics import Swaption, BlackSwaption, CreditIndex, BlackSwaptionVolSurface, Portfolio, ProbSurface\n", "from analytics import DualCorrTranche\n", - "from db import dbconn\n", + "from utils.db import dbconn\n", "from datetime import date\n", "from graphics import plot_color_map\n", "\n", @@ -475,7 +475,33 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "#Selwood strategy - March 2019, long 20bn tranches, short 12 bn options\n", + "index = 'EU'\n", + "series = 30\n", + "ss = DualCorrTranche(index, series, '5yr', attach=12, detach=100, corr_attach=.53, \n", + " corr_detach=.99, tranche_running=100, notional=-20000000000)\n", + "index_1 = 'IG'\n", + "series_1 = 32\n", + "option_delta = CreditIndex(index_1, series_1, '5yr') \n", + "option_delta.spread = 66\n", + "option1 = BlackSwaption(option_delta, datetime.date(2019, 6, 19), 120, option_type=\"payer\") \n", + "option1.sigma = .7\n", + "option1.notional = 12_000_000_000 \n", + "option1.direction = 'Long' \n", + "portf = Portfolio([ss, option1], trade_ids=['ss', 'opt1'])\n", + "portf.reset_pv()\n", + "spread_shock = np.round(np.arange(-.2, 1, .025), 3)\n", + "scens = run_portfolio_scenarios(portf, date_range, params=['pnl', 'delta'],\n", + " spread_shock=spread_shock,\n", + " vol_shock=vol_shock,\n", + " corr_shock=[0],\n", + " vol_surface=vol_surface)\n", + "\n", + "scens = scens.xs((0,0), level=['vol_shock', 'corr_shock'])\n", + "pnl = scens.xs('pnl', axis=1, level=1)\n", + "delta = scens.xs('delta', axis=1, level=1)\n" + ] } ], "metadata": { @@ -494,9 +520,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.1" + "version": "3.8.0" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } |
