mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 05:21:48 +00:00
464 lines
11 KiB
Plaintext
Executable File
464 lines
11 KiB
Plaintext
Executable File
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "blank-couple",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import importlib\n",
|
|
"import pathlib\n",
|
|
"import os\n",
|
|
"import sys\n",
|
|
"from datetime import datetime\n",
|
|
"module_path = os.path.abspath(os.path.join('../..'))\n",
|
|
"if module_path not in sys.path:\n",
|
|
" sys.path.append(module_path)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "exact-price",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"datetime.now()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "naked-shower",
|
|
"metadata": {
|
|
"tags": [
|
|
"parameters"
|
|
]
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"report_name=f\"econ_{datetime.now().strftime('%Y%m%d_%H%M%S')}\"\n",
|
|
"base_path=os.path.abspath(os.path.join('../..'))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "moderate-cheat",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"cache_dir = pathlib.Path(base_path, \"notebooks\", \"reports\", report_name)\n",
|
|
"if not os.path.isdir(cache_dir):\n",
|
|
" print(f\"Reports data directory not found. Creating {cache_dir}\")\n",
|
|
" os.mkdir(cache_dir)\n",
|
|
"else:\n",
|
|
" print(f\"Found reports directory {cache_dir}\")\n",
|
|
" print(os.listdir(cache_dir))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "southern-gnome",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from gamestonk_terminal.papermill import econ_data_helper as edh"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "initial-palace",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Dow Jones - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "invalid-interstate",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^DJI\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "responsible-poker",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Dow Jones - 1 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "departmental-sender",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^DJI\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "passing-printing",
|
|
"metadata": {},
|
|
"source": [
|
|
"## S&P 500 - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "related-quality",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^GSPC\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "verified-simulation",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Market Volatility (VIX) - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "crude-africa",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^VIX\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, high_trend=False, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "naval-builder",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Market Volatility (VIX) - 1 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "fossil-genealogy",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^VIX\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=360, high_trend=False, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "annoying-drain",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Yield on 5-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "cathedral-divide",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^FVX\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "selective-macintosh",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Yield on 10-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "induced-vancouver",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^TNX\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "imported-message",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Yield on 30-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "alleged-citizenship",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"^TYX\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "complimentary-stomach",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Gold - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "varying-pasta",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"GLD\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "perfect-illness",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Silver - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "confirmed-event",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"SLV\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "illusory-reflection",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Euro vs US Dollar - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "astonishing-star",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"FXE\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "reflective-panda",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Yen vs US Dollar - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "starry-night",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"FXY\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "faced-canon",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Energy - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "extended-earthquake",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLE\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "statewide-explanation",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Crude Oil - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "classical-coast",
|
|
"metadata": {
|
|
"scrolled": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"CL=F\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "spoken-delta",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Real Estate - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "changing-eight",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLRE\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "mathematical-support",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Real Estate - 1 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "exact-jacksonville",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"VNQ\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "worse-horror",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Financials - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "controlled-portuguese",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLF\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "typical-sandwich",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Financials - 1 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "headed-bundle",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLF\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "blistering-barnacles",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Materials - 2 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "italian-portent",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLB\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "material-science",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Materials - 1 year trend with 20, 50 and 200 day SMA"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "bundle-enabler",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"edh.draw_graph(\"XLB\", cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "german-ecology",
|
|
"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.8.8"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|