aboutsummaryrefslogtreecommitdiffstats
path: root/python/notebooks/bespokes/Bespoke-MS.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'python/notebooks/bespokes/Bespoke-MS.ipynb')
-rw-r--r--python/notebooks/bespokes/Bespoke-MS.ipynb149
1 files changed, 149 insertions, 0 deletions
diff --git a/python/notebooks/bespokes/Bespoke-MS.ipynb b/python/notebooks/bespokes/Bespoke-MS.ipynb
new file mode 100644
index 00000000..04cade25
--- /dev/null
+++ b/python/notebooks/bespokes/Bespoke-MS.ipynb
@@ -0,0 +1,149 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from analytics.tranche_basket import DualCorrTranche, TrancheBasket\n",
+ "import datetime"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "ig29 = TrancheBasket(\"IG\", 29, \"5yr\", value_date=datetime.date(2019, 2, 6))\n",
+ "ig29.tweak()\n",
+ "ig29.build_skew()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2 = DualCorrTranche(\"BS\", 2, \"2yr\", attach=7, detach=10, corr_attach=0.4, corr_detach=0.42, tranche_running=500,\n",
+ " value_date=datetime.date(2019, 2, 6))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2.singlename_spreads()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2._index.spread()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2.mark(skew=ig29.skew)\n",
+ "bs2.rho"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2.spread"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#delta adjustement\n",
+ "bs2.upfront + bs2.delta * (157 - bs2._index.spread())*1e-4* bs2._index.duration()*100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "jtd = bs2.jump_to_default(ig29.skew)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "jtd.sort_values()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from pyisda.curve import Senior, Subordinated, MM14\n",
+ "bs2._index[('BACR', Senior, MM14)].inspect()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bs2._index[('BACR', Subordinated, MM14)].inspect()"
+ ]
+ }
+ ],
+ "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.7.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}