From 5cc542c0e3de65cb7610aa128a2044d2bb37a22f Mon Sep 17 00:00:00 2001 From: simongarisch Date: Mon, 19 Oct 2020 13:15:22 +1100 Subject: [PATCH] renaming repo --- README.md | 15 +- notes/Overview.ipynb | 2760 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 2735 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 842b3ca..b25bbed 100644 --- a/README.md +++ b/README.md @@ -89,18 +89,18 @@ portfolio.broker = Broker( All strategy classes must inherit from pxtrade.Strategy and implement a generate_trades method. Note that the trades returned can either be None, a trade instance or list or trades. ```python -import pxtrade as pt +from pxtrade import Strategy, Trade -class ExampleStrategy(pt.Strategy): +class ExampleStrategy(Strategy): def generate_trades(self): trades = list() # get the portfolio trades first if spy.price < 330: - trades.append(pt.Trade(portfolio, spy, +100)) + trades.append(Trade(portfolio, spy, +100)) - trades.append(pt.Trade(benchmark, spy, +1000)) + trades.append(Trade(benchmark, spy, +1000)) return trades ``` @@ -109,9 +109,12 @@ class ExampleStrategy(pt.Strategy): A backtest takes a strategy instance as its argument. Any instances of History then record state through time as events are processed. ```python -backtest = pt.Backtest(ExampleStrategy()) +from pxtrade import Backtest, History -history = pt.History( + +backtest = Backtest(ExampleStrategy()) + +history = History( portfolios=[portfolio, benchmark], backtest=backtest ) diff --git a/notes/Overview.ipynb b/notes/Overview.ipynb index 91abea4..6aff860 100644 --- a/notes/Overview.ipynb +++ b/notes/Overview.ipynb @@ -175,18 +175,18 @@ "metadata": {}, "outputs": [], "source": [ - "import pxtrade as pt\n", + "from pxtrade import Strategy, Trade \n", "\n", "\n", - "class ExampleStrategy(pt.Strategy):\n", + "class ExampleStrategy(Strategy):\n", " def generate_trades(self):\n", " trades = list()\n", "\n", " # get the portfolio trades first\n", " if spy.price < 330:\n", - " trades.append(pt.Trade(portfolio, spy, +100))\n", + " trades.append(Trade(portfolio, spy, +100))\n", "\n", - " trades.append(pt.Trade(benchmark, spy, +1000))\n", + " trades.append(Trade(benchmark, spy, +1000))\n", "\n", " return trades\n" ] @@ -205,9 +205,12 @@ "metadata": {}, "outputs": [], "source": [ - "backtest = pt.Backtest(ExampleStrategy())\n", + "from pxtrade import Backtest, History\n", "\n", - "history = pt.History(\n", + "\n", + "backtest = Backtest(ExampleStrategy())\n", + "\n", + "history = History(\n", " portfolios=[portfolio, benchmark],\n", " backtest=backtest\n", ")" @@ -310,47 +313,2736 @@ }, "metadata": {}, "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly", + "showLink": true + }, + "data": [ + { + "line": { + "color": "rgba(255, 153, 51, 1.0)", + "dash": "solid", + "shape": "linear", + "width": 1.3 + }, + "mode": "lines", + "name": "Portfolio_SPY", + "text": "", + "type": "scatter", + "x": [ + "2020-06-30", + "2020-07-01", + "2020-07-02", + "2020-07-05", + "2020-07-06", + "2020-07-07", + "2020-07-08", + "2020-07-09", + "2020-07-10", + "2020-07-12", + "2020-07-13", + "2020-07-14", + "2020-07-15", + "2020-07-16", + "2020-07-17", + "2020-07-19", + "2020-07-20", + "2020-07-21", + "2020-07-22", + "2020-07-23", + "2020-07-24", + "2020-07-26", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-30", + "2020-07-31", + "2020-08-02", + "2020-08-03", + "2020-08-04", + "2020-08-05", + "2020-08-06", + "2020-08-07", + "2020-08-09", + "2020-08-10", + "2020-08-11", + "2020-08-12", + "2020-08-13", + "2020-08-14", + "2020-08-16", + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + "2020-08-23", + "2020-08-24", + "2020-08-25", + "2020-08-26", + "2020-08-27", + "2020-08-28", + "2020-08-30", + "2020-08-31", + "2020-09-01", + "2020-09-02", + "2020-09-03", + "2020-09-04", + "2020-09-06", + "2020-09-07", + "2020-09-08", + "2020-09-09", + "2020-09-10", + "2020-09-11", + "2020-09-13", + "2020-09-14", + "2020-09-15", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2020-09-20", + "2020-09-21", + "2020-09-22", + "2020-09-23", + "2020-09-24", + "2020-09-25", + "2020-09-27", + "2020-09-28", + "2020-09-29", + "2020-09-30" + ], + "y": [ + 100, + 200, + 300, + 400, + 500, + 600, + 700, + 800, + 900, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000 + ] + }, + { + "line": { + "color": "rgba(55, 128, 191, 1.0)", + "dash": "solid", + "shape": "linear", + "width": 1.3 + }, + "mode": "lines", + "name": "Benchmark_SPY", + "text": "", + "type": "scatter", + "x": [ + "2020-06-30", + "2020-07-01", + "2020-07-02", + "2020-07-05", + "2020-07-06", + "2020-07-07", + "2020-07-08", + "2020-07-09", + "2020-07-10", + "2020-07-12", + "2020-07-13", + "2020-07-14", + "2020-07-15", + "2020-07-16", + "2020-07-17", + "2020-07-19", + "2020-07-20", + "2020-07-21", + "2020-07-22", + "2020-07-23", + "2020-07-24", + "2020-07-26", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-30", + "2020-07-31", + "2020-08-02", + "2020-08-03", + "2020-08-04", + "2020-08-05", + "2020-08-06", + "2020-08-07", + "2020-08-09", + "2020-08-10", + "2020-08-11", + "2020-08-12", + "2020-08-13", + "2020-08-14", + "2020-08-16", + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + "2020-08-23", + "2020-08-24", + "2020-08-25", + "2020-08-26", + "2020-08-27", + "2020-08-28", + "2020-08-30", + "2020-08-31", + "2020-09-01", + "2020-09-02", + "2020-09-03", + "2020-09-04", + "2020-09-06", + "2020-09-07", + "2020-09-08", + "2020-09-09", + "2020-09-10", + "2020-09-11", + "2020-09-13", + "2020-09-14", + "2020-09-15", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2020-09-20", + "2020-09-21", + "2020-09-22", + "2020-09-23", + "2020-09-24", + "2020-09-25", + "2020-09-27", + "2020-09-28", + "2020-09-29", + "2020-09-30" + ], + "y": [ + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000, + 1000 + ] + }, + { + "line": { + "color": "rgba(50, 171, 96, 1.0)", + "dash": "solid", + "shape": "linear", + "width": 1.3 + }, + "mode": "lines", + "name": "SPY", + "text": "", + "type": "scatter", + "x": [ + "2020-06-30", + "2020-07-01", + "2020-07-02", + "2020-07-05", + "2020-07-06", + "2020-07-07", + "2020-07-08", + "2020-07-09", + "2020-07-10", + "2020-07-12", + "2020-07-13", + "2020-07-14", + "2020-07-15", + "2020-07-16", + "2020-07-17", + "2020-07-19", + "2020-07-20", + "2020-07-21", + "2020-07-22", + "2020-07-23", + "2020-07-24", + "2020-07-26", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-30", + "2020-07-31", + "2020-08-02", + "2020-08-03", + "2020-08-04", + "2020-08-05", + "2020-08-06", + "2020-08-07", + "2020-08-09", + "2020-08-10", + "2020-08-11", + "2020-08-12", + "2020-08-13", + "2020-08-14", + "2020-08-16", + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + "2020-08-23", + "2020-08-24", + "2020-08-25", + "2020-08-26", + "2020-08-27", + "2020-08-28", + "2020-08-30", + "2020-08-31", + "2020-09-01", + "2020-09-02", + "2020-09-03", + "2020-09-04", + "2020-09-06", + "2020-09-07", + "2020-09-08", + "2020-09-09", + "2020-09-10", + "2020-09-11", + "2020-09-13", + "2020-09-14", + "2020-09-15", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2020-09-20", + "2020-09-21", + "2020-09-22", + "2020-09-23", + "2020-09-24", + "2020-09-25", + "2020-09-27", + "2020-09-28", + "2020-09-29", + "2020-09-30" + ], + "xaxis": "x", + "y": [ + 307.13055419921875, + 309.2819519042969, + 310.9851379394531, + 310.9851379394531, + 315.7859191894531, + 312.5289611816406, + 314.91937255859375, + 313.1265563964844, + 316.3237609863281, + 316.3237609863281, + 313.584716796875, + 317.6484680175781, + 320.5667724609375, + 319.5110168457031, + 320.4372863769531, + 320.4372863769531, + 323.0269470214844, + 323.7142028808594, + 325.5567932128906, + 321.6723327636719, + 319.60064697265625, + 319.60064697265625, + 321.9313049316406, + 319.8894958496094, + 323.82373046875, + 322.6683654785156, + 325.2181396484375, + 325.2181396484375, + 327.4791259765625, + 328.7440490722656, + 330.7858581542969, + 332.99700927734375, + 333.236083984375, + 333.236083984375, + 334.2320861816406, + 331.4731140136719, + 336.0946350097656, + 335.4870300292969, + 335.49700927734375, + 335.49700927734375, + 336.562744140625, + 337.28985595703125, + 335.8854675292969, + 336.9312744140625, + 338.1264953613281, + 338.1264953613281, + 341.55279541015625, + 342.74798583984375, + 346.1842346191406, + 346.9411926269531, + 349.1822204589844, + 349.1822204589844, + 347.91729736328125, + 351.1941833496094, + 356.27386474609375, + 344.012939453125, + 341.20416259765625, + 341.20416259765625, + 341.20416259765625, + 331.8814697265625, + 338.4352722167969, + 332.55877685546875, + 332.72808837890625, + 332.72808837890625, + 337.11053466796875, + 338.8137512207031, + 337.4691162109375, + 334.5010070800781, + 330.6499938964844, + 330.6499938964844, + 326.9700012207031, + 330.29998779296875, + 322.6400146484375, + 323.5, + 328.7300109863281, + 328.7300109863281, + 334.19000244140625, + 332.3699951171875, + 334.8900146484375 + ], + "yaxis": "y2" + } + ], + "layout": { + "legend": { + "bgcolor": "#F5F6F9", + "font": { + "color": "#4D5663" + } + }, + "paper_bgcolor": "#F5F6F9", + "plot_bgcolor": "#F5F6F9", + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "Portfolio Holdings of SPY" + }, + "xaxis": { + "gridcolor": "#E1E5ED", + "showgrid": true, + "tickfont": { + "color": "#4D5663" + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "" + }, + "zerolinecolor": "#E1E5ED" + }, + "yaxis": { + "gridcolor": "#E1E5ED", + "showgrid": true, + "tickfont": { + "color": "#4D5663" + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "" + }, + "zerolinecolor": "#E1E5ED" + }, + "yaxis2": { + "anchor": "x", + "gridcolor": "#E1E5ED", + "overlaying": "y", + "showgrid": true, + "side": "right", + "tickfont": { + "color": "#4D5663" + }, + "title": { + "text": "" + }, + "zerolinecolor": "#E1E5ED" + } + } + }, + "text/html": [ + "
\n", + " \n", + " \n", + "
\n", + " \n", + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ "import cufflinks as cf\n", "\n", "\n", - "use_cufflinks = False\n", - "\n", - "if use_cufflinks:\n", - " columns = [\"Portfolio_SPY\", \"Benchmark_SPY\", \"SPY\"]\n", - " df[columns].iplot(\n", - " secondary_y=\"SPY\",\n", - " title=\"Portfolio Holdings of SPY\",\n", - " )\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "![holdings](https://github.com/simongarisch/pxtrade/blob/master/notes/portfolio_holdings_of_spy.png?raw=true)" + "columns = [\"Portfolio_SPY\", \"Benchmark_SPY\", \"SPY\"]\n", + "df[columns].iplot(\n", + " secondary_y=\"SPY\",\n", + " title=\"Portfolio Holdings of SPY\",\n", + ")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, - "outputs": [], - "source": [ - "if use_cufflinks:\n", - " columns = [\"Portfolio\", \"Benchmark\"]\n", - " df[columns].iplot(\n", - " title=\"Portfolio Value\",\n", - " )" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly", + "showLink": true + }, + "data": [ + { + "line": { + "color": "rgba(255, 153, 51, 1.0)", + "dash": "solid", + "shape": "linear", + "width": 1.3 + }, + "mode": "lines", + "name": "Portfolio", + "text": "", + "type": "scatter", + "x": [ + "2020-06-30", + "2020-07-01", + "2020-07-02", + "2020-07-05", + "2020-07-06", + "2020-07-07", + "2020-07-08", + "2020-07-09", + "2020-07-10", + "2020-07-12", + "2020-07-13", + "2020-07-14", + "2020-07-15", + "2020-07-16", + "2020-07-17", + "2020-07-19", + "2020-07-20", + "2020-07-21", + "2020-07-22", + "2020-07-23", + "2020-07-24", + "2020-07-26", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-30", + "2020-07-31", + "2020-08-02", + "2020-08-03", + "2020-08-04", + "2020-08-05", + "2020-08-06", + "2020-08-07", + "2020-08-09", + "2020-08-10", + "2020-08-11", + "2020-08-12", + "2020-08-13", + "2020-08-14", + "2020-08-16", + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + "2020-08-23", + "2020-08-24", + "2020-08-25", + "2020-08-26", + "2020-08-27", + "2020-08-28", + "2020-08-30", + "2020-08-31", + "2020-09-01", + "2020-09-02", + "2020-09-03", + "2020-09-04", + "2020-09-06", + "2020-09-07", + "2020-09-08", + "2020-09-09", + "2020-09-10", + "2020-09-11", + "2020-09-13", + "2020-09-14", + "2020-09-15", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2020-09-20", + "2020-09-21", + "2020-09-22", + "2020-09-23", + "2020-09-24", + "2020-09-25", + "2020-09-27", + "2020-09-28", + "2020-09-29", + "2020-09-30" + ], + "y": [ + 999986.1960446835, + 1000187.4868130684, + 1000514.2616713047, + 1000500.1897668839, + 1002406.3194394112, + 1000764.3025994301, + 1002184.0099418163, + 1000915.5429172516, + 1003459.388705492, + 1003445.6439614296, + 1000706.8033337593, + 1004769.5767045021, + 1007687.4774932861, + 1006632.3449850082, + 1007558.6145162582, + 1007558.0748677254, + 1010147.3171830177, + 1010832.3791623116, + 1012674.8655557632, + 1008791.2193417549, + 1006719.5335507393, + 1006719.571864605, + 1009049.0132808685, + 1007007.1795940399, + 1010941.1851882935, + 1009785.1806163788, + 1012334.9547863007, + 1012336.0905170441, + 1014597.6557612419, + 1015861.3956928253, + 1017902.764570713, + 1020113.2785201073, + 1020352.3532271385, + 1020353.8302540779, + 1021349.8150348663, + 1018591.0985827446, + 1023212.2264146805, + 1022604.9430847168, + 1022614.9223327637, + 1022614.0461683273, + 1023679.2701840401, + 1024405.5856823921, + 1023002.5954127312, + 1024048.0407476425, + 1025243.2616949081, + 1025244.1565394402, + 1028670.3056573868, + 1029864.8880958557, + 1033300.2230525017, + 1034056.6838622093, + 1036297.7116942406, + 1036295.6491231918, + 1035030.5660367012, + 1038307.5021386147, + 1043388.1312251091, + 1031128.7113070488, + 1028319.93445158, + 1028319.4071173668, + 1028319.4315195084, + 1018998.1706023216, + 1025550.6290793419, + 1019674.4053602219, + 1019843.7168836594, + 1019843.3466911316, + 1024225.7038474083, + 1025928.7034988403, + 1024584.0950965881, + 1021615.6338334084, + 1017764.6206498146, + 1017765.0142788887, + 1014086.2662792206, + 1017417.3879623413, + 1009759.5236063004, + 1010619.7454214096, + 1015849.7564077377, + 1015850.0615358353, + 1021308.9867591858, + 1019488.0113363266, + 1022008.0308675766 + ] + }, + { + "line": { + "color": "rgba(55, 128, 191, 1.0)", + "dash": "solid", + "shape": "linear", + "width": 1.3 + }, + "mode": "lines", + "name": "Benchmark", + "text": "", + "type": "scatter", + "x": [ + "2020-06-30", + "2020-07-01", + "2020-07-02", + "2020-07-05", + "2020-07-06", + "2020-07-07", + "2020-07-08", + "2020-07-09", + "2020-07-10", + "2020-07-12", + "2020-07-13", + "2020-07-14", + "2020-07-15", + "2020-07-16", + "2020-07-17", + "2020-07-19", + "2020-07-20", + "2020-07-21", + "2020-07-22", + "2020-07-23", + "2020-07-24", + "2020-07-26", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-30", + "2020-07-31", + "2020-08-02", + "2020-08-03", + "2020-08-04", + "2020-08-05", + "2020-08-06", + "2020-08-07", + "2020-08-09", + "2020-08-10", + "2020-08-11", + "2020-08-12", + "2020-08-13", + "2020-08-14", + "2020-08-16", + "2020-08-17", + "2020-08-18", + "2020-08-19", + "2020-08-20", + "2020-08-21", + "2020-08-23", + "2020-08-24", + "2020-08-25", + "2020-08-26", + "2020-08-27", + "2020-08-28", + "2020-08-30", + "2020-08-31", + "2020-09-01", + "2020-09-02", + "2020-09-03", + "2020-09-04", + "2020-09-06", + "2020-09-07", + "2020-09-08", + "2020-09-09", + "2020-09-10", + "2020-09-11", + "2020-09-13", + "2020-09-14", + "2020-09-15", + "2020-09-16", + "2020-09-17", + "2020-09-18", + "2020-09-20", + "2020-09-21", + "2020-09-22", + "2020-09-23", + "2020-09-24", + "2020-09-25", + "2020-09-27", + "2020-09-28", + "2020-09-29", + "2020-09-30" + ], + "y": [ + 1000000, + 1002151.3977050781, + 1003854.5837402344, + 1003854.5837402344, + 1008655.3649902344, + 1005398.4069824219, + 1007788.818359375, + 1005996.0021972656, + 1009193.2067871094, + 1009193.2067871094, + 1006454.1625976562, + 1010517.9138183594, + 1013436.2182617188, + 1012380.4626464844, + 1013306.7321777344, + 1013306.7321777344, + 1015896.3928222656, + 1016583.6486816406, + 1018426.2390136719, + 1014541.7785644531, + 1012470.0927734375, + 1012470.0927734375, + 1014800.7507324219, + 1012758.9416503906, + 1016693.1762695312, + 1015537.8112792969, + 1018087.5854492188, + 1018087.5854492188, + 1020348.5717773438, + 1021613.4948730469, + 1023655.3039550781, + 1025866.455078125, + 1026105.5297851562, + 1026105.5297851562, + 1027101.5319824219, + 1024342.5598144531, + 1028964.0808105469, + 1028356.4758300781, + 1028366.455078125, + 1028366.455078125, + 1029432.1899414062, + 1030159.3017578125, + 1028754.9133300781, + 1029800.7202148438, + 1030995.9411621094, + 1030995.9411621094, + 1034422.2412109375, + 1035617.431640625, + 1039053.6804199219, + 1039810.6384277344, + 1042051.6662597656, + 1042051.6662597656, + 1040786.7431640625, + 1044063.6291503906, + 1049143.310546875, + 1036882.3852539062, + 1034073.6083984375, + 1034073.6083984375, + 1034073.6083984375, + 1024750.9155273438, + 1031304.7180175781, + 1025428.22265625, + 1025597.5341796875, + 1025597.5341796875, + 1029979.98046875, + 1031683.1970214844, + 1030338.5620117188, + 1027370.4528808594, + 1023519.4396972656, + 1023519.4396972656, + 1019839.4470214844, + 1023169.43359375, + 1015509.4604492188, + 1016369.4458007812, + 1021599.4567871094, + 1021599.4567871094, + 1027059.4482421875, + 1025239.4409179688, + 1027759.4604492188 + ] + } + ], + "layout": { + "legend": { + "bgcolor": "#F5F6F9", + "font": { + "color": "#4D5663" + } + }, + "paper_bgcolor": "#F5F6F9", + "plot_bgcolor": "#F5F6F9", + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "Portfolio Value" + }, + "xaxis": { + "gridcolor": "#E1E5ED", + "showgrid": true, + "tickfont": { + "color": "#4D5663" + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "" + }, + "zerolinecolor": "#E1E5ED" + }, + "yaxis": { + "gridcolor": "#E1E5ED", + "showgrid": true, + "tickfont": { + "color": "#4D5663" + }, + "title": { + "font": { + "color": "#4D5663" + }, + "text": "" + }, + "zerolinecolor": "#E1E5ED" + } + } + }, + "text/html": [ + "
\n", + " \n", + " \n", + "
\n", + " \n", + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "![holdings](https://github.com/simongarisch/pxtrade/blob/master/notes/portfolio_value.png?raw=true)" + "columns = [\"Portfolio\", \"Benchmark\"]\n", + "df[columns].iplot(\n", + " title=\"Portfolio Value\",\n", + ")" ] }, {