revert DD report with pickle dataframe being stored (#1120)

This commit is contained in:
Didier Rodrigues Lopes
2022-01-01 17:24:32 +00:00
committed by GitHub
parent 18180c2126
commit c0b83a2e39
2 changed files with 42 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ def draw_graph(
(datetime.now() - timedelta(days=time_delta)).strftime("%Y-%m-%d"),
)
df_stock = stocks_helper.find_trendline(df_stock, "OC_High", "high")
df_stock = stocks_helper.find_trendline(df_stock, "OC_Low", "how")
df_stock = stocks_helper.find_trendline(df_stock, "OC_Low", "low")
df_stock.to_pickle(df_stock_cache)
else:
@@ -61,7 +61,7 @@ def draw_graph(
ticker, (datetime.now() - timedelta(days=time_delta)).strftime("%Y-%m-%d")
)
df_stock = stocks_helper.find_trendline(df_stock, "OC_High", "high")
df_stock = stocks_helper.find_trendline(df_stock, "OC_Low", "how")
df_stock = stocks_helper.find_trendline(df_stock, "OC_Low", "low")
mc = mpf.make_marketcolors(
up="green", down="red", edge="black", wick="black", volume="in", ohlc="i"

View File

@@ -50,6 +50,24 @@
"display(Markdown(f\"# {ticker.upper()} - Due Diligence - {datetime.now().strftime('%Y/%m/%d %H:%M:%S')}\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3a473d25",
"metadata": {},
"outputs": [],
"source": [
"base_path=os.path.abspath(os.path.join('.'))\n",
"report_cache_dir = pathlib.Path(base_path, \"gamestonk_terminal\", \"reports\", \"stored\")\n",
" \n",
"if not os.path.isdir(report_cache_dir):\n",
" print(\"Reports data directory not found.\")\n",
" print(f\"Creating {report_cache_dir}\")\n",
" os.mkdir(report_cache_dir);\n",
"else:\n",
" print(f\"Found reports directory {report_cache_dir}\")"
]
},
{
"cell_type": "markdown",
"id": "temporal-clerk",
@@ -58,6 +76,28 @@
"## Candle View"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d783ed59-1fb2-44f2-b4b0-bfdfee9afcb6",
"metadata": {},
"outputs": [],
"source": [
"from gamestonk_terminal.stocks import stocks_helper\n",
"\n",
"df_stock_cache = pathlib.Path(report_cache_dir, f\"{ticker}_stock_data.pkl\")\n",
"if os.path.isfile(df_stock_cache):\n",
" print(f\"Found a cache file. Loading {df_stock_cache}\")\n",
" df_stock = pd.read_pickle(df_stock_cache)\n",
"else:\n",
" print(\"Cache file not found. Getting data.\")\n",
" df_stock = stocks_helper.load_ticker(ticker, (datetime.now() - timedelta(days=180)).strftime(\"%Y-%m-%d\"))\n",
" df_stock = stocks_helper.find_trendline(df_stock, \"OC_High\", \"high\")\n",
" df_stock = stocks_helper.find_trendline(df_stock, \"OC_Low\", \"low\")\n",
" print(f\"Saving cache file {ticker}_stock_data.pkl\")\n",
" df_stock.to_pickle(df_stock_cache)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -66,11 +106,7 @@
"outputs": [],
"source": [
"import mplfinance as mpf\n",
"from gamestonk_terminal.stocks import stocks_helper\n",
"\n",
"df_stock = stocks_helper.load_ticker(ticker, (datetime.now() - timedelta(days=180)).strftime(\"%Y-%m-%d\"))\n",
"df_stock = stocks_helper.find_trendline(df_stock, \"OC_High\", \"high\")\n",
"df_stock = stocks_helper.find_trendline(df_stock, \"OC_Low\", \"how\")\n",
"mc = mpf.make_marketcolors(up='green',down='red',\n",
" edge='black',\n",
" wick='black',\n",