aboutsummaryrefslogtreecommitdiffstats
path: root/python/notebooks/Curve Trades.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'python/notebooks/Curve Trades.ipynb')
-rw-r--r--python/notebooks/Curve Trades.ipynb53
1 files changed, 36 insertions, 17 deletions
diff --git a/python/notebooks/Curve Trades.ipynb b/python/notebooks/Curve Trades.ipynb
index 7f120638..501c9876 100644
--- a/python/notebooks/Curve Trades.ipynb
+++ b/python/notebooks/Curve Trades.ipynb
@@ -6,15 +6,10 @@
"metadata": {},
"outputs": [],
"source": [
- "#%matplotlib nbagg\n",
- "\n",
- "import os\n",
- "import sys\n",
- "sys.path.append(os.path.join(os.environ['CODE_DIR'], 'python', 'exploration'))\n",
- "sys.path.append(os.path.join(os.environ['CODE_DIR'], 'python'))\n",
"import curve_trades as ct\n",
"import matplotlib.pyplot as plt\n",
- "import pandas as pd"
+ "import pandas as pd\n",
+ "from ipywidgets import widgets"
]
},
{
@@ -23,8 +18,22 @@
"metadata": {},
"outputs": [],
"source": [
- "index = 'IG'\n",
- "on_the_run = 28"
+ "w = widgets.Dropdown(\n",
+ " options=['IG', 'EU'],\n",
+ " value='IG',\n",
+ " description='Index:',\n",
+ " disabled=False,\n",
+ ")\n",
+ "w"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "index = w.value"
]
},
{
@@ -34,7 +43,7 @@
"outputs": [],
"source": [
"#On the run spread differences\n",
- "spreads_diff = ct.curve_spread_diff(index, on_the_run)\n",
+ "spreads_diff = ct.curve_spread_diff(index, 6)\n",
"spreads_diff.plot()"
]
},
@@ -55,7 +64,7 @@
"outputs": [],
"source": [
"#Theta per unit duration\n",
- "ct.theta_matrix_by_series(index, on_the_run)"
+ "ct.theta_matrix_by_series(index)"
]
},
{
@@ -65,7 +74,7 @@
"outputs": [],
"source": [
"#on the run theta\n",
- "ct.on_the_run_theta(index, on_the_run)"
+ "ct.on_the_run_theta(index)"
]
},
{
@@ -84,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
- "ct.cross_series_curve()"
+ "ct.cross_series_curve(index)"
]
},
{
@@ -94,8 +103,17 @@
"outputs": [],
"source": [
"#Theta with 3-5-10 Strategy\n",
- "theta_ratio_within_series = ct.ratio_within_series(param = 'duration')\n",
- "ct.curve_3_5_10(theta_ratio_within_series)"
+ "df = ct.ratio_within_series(param='duration')\n",
+ "ct.curve_3_5_10(df)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%debug"
]
},
{
@@ -105,7 +123,8 @@
"outputs": [],
"source": [
"#Theta with 5-10 Strategy\n",
- "ct.curve_5_10(theta_ratio_within_series)"
+ "df = ct.ratio_within_series(param='duration')\n",
+ "ct.curve_5_10(df)"
]
},
{
@@ -205,7 +224,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.1"
+ "version": "3.6.2"
}
},
"nbformat": 4,