{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import portfolio_var as port\n", "from analytics import Swaption, BlackSwaption, Index, VolatilitySurface, Portfolio\n", "from analytics.scenarios import run_swaption_scenarios, run_index_scenarios, run_portfolio_scenarios\n", "import datetime\n", "import pandas as pd\n", "from pandas.tseries.offsets import BDay, BMonthEnd\n", "\n", "#import exploration.swaption_calendar_spread as spread\n", "import exploration.swaption_calendar_spread as spread" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Oct ME Bond HY Equiv\n", "report_date = (datetime.date.today() + BMonthEnd(-1)).date()\n", "bond_HY_equiv = -.12088\n", "percentile = .95" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#The 95%tile \n", "df, spread, dur = port.rel_spread_diff(report_date)\n", "stress = pd.DataFrame()\n", "stress.at[('2SD_widen', 'spread')] = df.quantile(.975) \n", "stress.at[('2SD_tighten', 'spread')] = df.quantile(.025) \n", "stress.at[('worst_widen', 'spread')] = df.max()\n", "stress['pts'] = -stress * spread * dur/100\n", "stress['nav_impact'] = bond_HY_equiv * stress['pts']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "stress" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "port.cleared_cds_margins(report_date, percentile)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "port.index_curve_margins(report_date)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }