From a9986d3b901905f534238eaf4d4629653df47a5e Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Wed, 28 Jul 2021 21:47:49 +0100 Subject: [PATCH] Small improvement to papermill notebooks (#574) * dont have notebook collapsed cells * improve report generation to html --- notebooks/templates/dark_pool.ipynb | 50 ++++++------------- notebooks/templates/due_diligence.ipynb | 64 +++++++------------------ notebooks/templates/econ_data.ipynb | 4 +- 3 files changed, 32 insertions(+), 86 deletions(-) diff --git a/notebooks/templates/dark_pool.ipynb b/notebooks/templates/dark_pool.ipynb index e05523104aa..95d8f5a2831 100644 --- a/notebooks/templates/dark_pool.ipynb +++ b/notebooks/templates/dark_pool.ipynb @@ -4,9 +4,7 @@ "cell_type": "code", "execution_count": null, "id": "atomic-accessory", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import importlib\n", @@ -29,7 +27,6 @@ "execution_count": null, "id": "early-oxford", "metadata": { - "collapsed": true, "tags": [ "parameters" ] @@ -45,9 +42,7 @@ "cell_type": "code", "execution_count": null, "id": "extra-tennessee", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "display(Markdown(f\"# {datetime.now().strftime('%Y/%m/%d %H:%M:%S')} - {ticker.upper()} - Dark Pool\"))" @@ -57,9 +52,7 @@ "cell_type": "code", "execution_count": null, "id": "lovely-communications", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.technical_analysis import trendline_api as trend\n", @@ -78,9 +71,7 @@ "cell_type": "code", "execution_count": null, "id": "indonesian-stuff", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.discovery import stockgrid_view\n", @@ -99,9 +90,7 @@ "cell_type": "code", "execution_count": null, "id": "consolidated-childhood", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.due_diligence import stockgrid_dd_view\n", @@ -112,9 +101,7 @@ "cell_type": "code", "execution_count": null, "id": "minus-cross", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "stockgrid_dd_view.shortview(ticker.upper(), [\"-n\", \"10\", \"-r\"])" @@ -132,9 +119,7 @@ "cell_type": "code", "execution_count": null, "id": "special-certification", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.options import barchart_view\n", @@ -153,12 +138,10 @@ "cell_type": "code", "execution_count": null, "id": "compressed-there", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ - "from gamestonk_terminal.options import yfinance_model, yfinance_view, yfinance_model\n", + "from gamestonk_terminal.options import yfinance_model, yfinance_view\n", "selected_date = yfinance_model.option_expirations(ticker)[0]\n", "\n", "from gamestonk_terminal.options import op_helpers\n", @@ -181,9 +164,7 @@ "cell_type": "code", "execution_count": null, "id": "exciting-harvard", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal import main_helper\n", @@ -197,18 +178,15 @@ "cell_type": "code", "execution_count": null, "id": "central-jacob", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ - "folder = \"notebooks/reports/\"\n", - "extension = \".ipynb\"\n", - "!jupyter nbconvert {folder + report_name + extension} --to html --no-input" + "!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input" ] } ], "metadata": { + "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", @@ -224,7 +202,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/templates/due_diligence.ipynb b/notebooks/templates/due_diligence.ipynb index 58a979360ed..ccd925007df 100644 --- a/notebooks/templates/due_diligence.ipynb +++ b/notebooks/templates/due_diligence.ipynb @@ -4,9 +4,7 @@ "cell_type": "code", "execution_count": null, "id": "second-school", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import importlib\n", @@ -29,7 +27,6 @@ "execution_count": null, "id": "amazing-wrapping", "metadata": { - "collapsed": true, "tags": [ "parameters" ] @@ -45,9 +42,7 @@ "cell_type": "code", "execution_count": null, "id": "prescription-minister", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "display(Markdown(f\"# {datetime.now().strftime('%Y/%m/%d %H:%M:%S')} - {ticker.upper()} - Due Diligence\"))" @@ -57,9 +52,7 @@ "cell_type": "code", "execution_count": null, "id": "conventional-smile", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "report_cache_dir = pathlib.Path(base_path, \"notebooks\", \"reports\", report_name)\n", @@ -76,9 +69,7 @@ "cell_type": "code", "execution_count": null, "id": "comfortable-twelve", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.technical_analysis import trendline_api as trend\n", @@ -89,9 +80,7 @@ "cell_type": "code", "execution_count": null, "id": "african-citation", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "df_stock_cache = pathlib.Path(report_cache_dir, f\"{ticker}_stock_data.pkl\")\n", @@ -119,9 +108,7 @@ "cell_type": "code", "execution_count": null, "id": "instructional-saturday", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "import mplfinance as mpf\n", @@ -149,9 +136,7 @@ "cell_type": "code", "execution_count": null, "id": "continuing-defensive", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "mpf.plot(df_stock,type='candle',mav=(20,50,200),volume=True, addplot=ap0,\n", @@ -171,9 +156,7 @@ "cell_type": "code", "execution_count": null, "id": "stretch-offer", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "df_fa = finviz.analyst_df(ticker)\n", @@ -184,9 +167,7 @@ "cell_type": "code", "execution_count": null, "id": "cross-filename", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "from gamestonk_terminal.fundamental_analysis import av_view as av" @@ -204,9 +185,7 @@ "cell_type": "code", "execution_count": null, "id": "completed-likelihood", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Annual Income Statement\n", @@ -225,9 +204,7 @@ "cell_type": "code", "execution_count": null, "id": "handy-warning", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Quarterly Income Statement\n", @@ -246,9 +223,7 @@ "cell_type": "code", "execution_count": null, "id": "optimum-sandwich", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Annual Balance Sheet\n", @@ -267,9 +242,7 @@ "cell_type": "code", "execution_count": null, "id": "plastic-color", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "# Annual cash flow\n", @@ -280,18 +253,15 @@ "cell_type": "code", "execution_count": null, "id": "overall-material", - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ - "folder = \"notebooks/reports/\"\n", - "extension = \".ipynb\"\n", - "!jupyter nbconvert {folder + report_name + extension} --to html --no-input" + "!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input" ] } ], "metadata": { + "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", @@ -307,7 +277,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/notebooks/templates/econ_data.ipynb b/notebooks/templates/econ_data.ipynb index ababdc4b651..70375a3bd1c 100644 --- a/notebooks/templates/econ_data.ipynb +++ b/notebooks/templates/econ_data.ipynb @@ -442,9 +442,7 @@ "metadata": {}, "outputs": [], "source": [ - "folder = \"notebooks/reports/\"\n", - "extension = \".ipynb\"\n", - "!jupyter nbconvert {folder + report_name + extension} --to html --no-input" + "!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input" ] } ],