mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 23:41:27 +00:00
Added fixes to economy report (#3305)
* Added fixes to economy report * Delete economy_report.html Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
112
openbb_terminal/reports/templates/economy.ipynb
vendored
112
openbb_terminal/reports/templates/economy.ipynb
vendored
@@ -203,17 +203,16 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig, (ax1, ax2) = plt.subplots(\n",
|
||||
" nrows=2,\n",
|
||||
"fig, (ax1) = plt.subplots(\n",
|
||||
" nrows=1,\n",
|
||||
" ncols=1,\n",
|
||||
" figsize=(16 / 9 * 5, 5),\n",
|
||||
" gridspec_kw={\"height_ratios\": [2, 1]},\n",
|
||||
" dpi=150,\n",
|
||||
")\n",
|
||||
"ycrv_country_1 = \"United states\"\n",
|
||||
"ycrv_data_1 = openbb.economy.ycrv(country=ycrv_country_1)\n",
|
||||
"ycrv_data_1, _ = openbb.economy.ycrv()\n",
|
||||
"\n",
|
||||
"openbb.economy.ycrv(country=ycrv_country_1, external_axes=[ax1, ax2], chart=True)\n",
|
||||
"openbb.economy.ycrv(external_axes=[ax1], chart=True)\n",
|
||||
"\n",
|
||||
"fig.tight_layout()\n",
|
||||
"f = io.BytesIO()\n",
|
||||
@@ -221,7 +220,7 @@
|
||||
"ycrv_chart_1 = f.getvalue().decode(\"utf-8\")\n",
|
||||
"\n",
|
||||
"if not ycrv_data_1.empty:\n",
|
||||
" ycrv_data_1.set_index(\"Tenor\", inplace=True)\n",
|
||||
" ycrv_data_1.drop([\"Maturity\"], axis=1, inplace=True)\n",
|
||||
" ycrv_data_1.index = [\n",
|
||||
" \"1M\",\n",
|
||||
" \"3M\",\n",
|
||||
@@ -237,52 +236,6 @@
|
||||
" ]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f18aa0ad",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fig, (ax1, ax2) = plt.subplots(\n",
|
||||
" nrows=2,\n",
|
||||
" ncols=1,\n",
|
||||
" figsize=(16 / 9 * 5, 5),\n",
|
||||
" gridspec_kw={\"height_ratios\": [2, 1]},\n",
|
||||
" dpi=150,\n",
|
||||
")\n",
|
||||
"ycrv_country_2 = \"Germany\"\n",
|
||||
"ycrv_data_2 = openbb.economy.ycrv(country=ycrv_country_2)\n",
|
||||
"\n",
|
||||
"openbb.economy.ycrv(country=ycrv_country_2, external_axes=[ax1, ax2], chart=True)\n",
|
||||
"\n",
|
||||
"fig.tight_layout()\n",
|
||||
"f = io.BytesIO()\n",
|
||||
"fig.savefig(f, format=\"svg\")\n",
|
||||
"ycrv_chart_2 = f.getvalue().decode(\"utf-8\")\n",
|
||||
"if not ycrv_data_1.empty:\n",
|
||||
" ycrv_data_2.set_index(\"Tenor\", inplace=True)\n",
|
||||
" ycrv_data_2.index = [\n",
|
||||
" \"3M\",\n",
|
||||
" \"6M\",\n",
|
||||
" \"9M\",\n",
|
||||
" \"1Y\",\n",
|
||||
" \"2Y\",\n",
|
||||
" \"3Y\",\n",
|
||||
" \"4Y\",\n",
|
||||
" \"5Y\",\n",
|
||||
" \"6Y\",\n",
|
||||
" \"7Y\",\n",
|
||||
" \"8Y\",\n",
|
||||
" \"9Y\",\n",
|
||||
" \"10Y\",\n",
|
||||
" \"15Y\",\n",
|
||||
" \"20Y\",\n",
|
||||
" \"25Y\",\n",
|
||||
" \"30Y\",\n",
|
||||
" ]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -362,16 +315,6 @@
|
||||
"performance = openbb.economy.performance()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "34e3ecbc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# openbb.economy.available_indices()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -500,24 +443,6 @@
|
||||
"eqty_4 = f.getvalue().decode(\"utf-8\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5f83994d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Macro"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "bbec7daf",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# openbb.economy.country_codes()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -593,16 +518,6 @@
|
||||
"macro_0 = f.getvalue().decode(\"utf-8\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "88dc0d87",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# openbb.economy.fred_ids(\"gross domestic product growth\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -720,18 +635,11 @@
|
||||
"# Yields\n",
|
||||
"htmlcode = widgets.row(\n",
|
||||
" [\n",
|
||||
" widgets.h(3, f\"{ycrv_country_1} yield curve (source: investing.com)\")\n",
|
||||
" widgets.h(3, f\"{ycrv_country_1} yield curve (source: FRED)\")\n",
|
||||
" + ycrv_chart_1\n",
|
||||
" ]\n",
|
||||
")\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"\") + ycrv_data_1.to_html()])\n",
|
||||
"htmlcode += widgets.row(\n",
|
||||
" [\n",
|
||||
" widgets.h(3, f\"{ycrv_country_2} yield curve (source: investing.com)\")\n",
|
||||
" + ycrv_chart_2\n",
|
||||
" ]\n",
|
||||
")\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"\") + ycrv_data_2.to_html()])\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"US treasuries (source: EconDB)\") + ust])\n",
|
||||
"body += widgets.add_tab(\"Yields\", htmlcode)\n",
|
||||
"\n",
|
||||
@@ -766,6 +674,14 @@
|
||||
"with open(report_name + \".html\", \"w\", encoding=\"utf-8\") as fh:\n",
|
||||
" fh.write(report)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "74fd9f68-7af7-4cdf-bc23-dacc6003fab6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -1007,8 +1007,8 @@ functions = {
|
||||
"model": "openbb_terminal.economy.investingcom_model.get_ycrv_countries"
|
||||
},
|
||||
"economy.ycrv": {
|
||||
"model": "openbb_terminal.economy.investingcom_model.get_yieldcurve",
|
||||
"view": "openbb_terminal.economy.investingcom_view.display_yieldcurve",
|
||||
"model": "openbb_terminal.economy.fred_model.get_yield_curve",
|
||||
"view": "openbb_terminal.economy.fred_view.display_yield_curve",
|
||||
},
|
||||
"economy.country_codes": {
|
||||
"model": "openbb_terminal.economy.nasdaq_model.get_country_codes"
|
||||
|
||||
Reference in New Issue
Block a user