aboutsummaryrefslogtreecommitdiffstats
path: root/python/notebooks/Portfolio analysis.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'python/notebooks/Portfolio analysis.ipynb')
-rw-r--r--python/notebooks/Portfolio analysis.ipynb101
1 files changed, 101 insertions, 0 deletions
diff --git a/python/notebooks/Portfolio analysis.ipynb b/python/notebooks/Portfolio analysis.ipynb
new file mode 100644
index 00000000..ce0395b3
--- /dev/null
+++ b/python/notebooks/Portfolio analysis.ipynb
@@ -0,0 +1,101 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cd ~/projects/code/python"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from analytics import Portfolio, BlackSwaption, Index\n",
+ "import datetime\n",
+ "option_delta = Index.from_tradeid(874)\n",
+ "option1 = BlackSwaption.from_tradeid(7, option_delta)\n",
+ "option2 = BlackSwaption.from_tradeid(8, option_delta)\n",
+ "portf = Portfolio([option_delta, option1, option2])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "option1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "option2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "portf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "portf.trade_date = datetime.date.today()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "portf.mark()\n",
+ "portf"
+ ]
+ },
+ {
+ "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
+}