mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Merge pull request #4327 from OpenBB-finance/feature/fix-4223
Patch Equity Report
This commit is contained in:
31
openbb_terminal/reports/templates/equity.ipynb
vendored
31
openbb_terminal/reports/templates/equity.ipynb
vendored
@@ -134,10 +134,15 @@
|
||||
"source": [
|
||||
"info = openbb.stocks.fa.info(symbol=symbol).transpose()\n",
|
||||
"\n",
|
||||
"if info[\"Long business summary\"][0] != \"NA\":\n",
|
||||
" overview = info[\"Long business summary\"][0]\n",
|
||||
"long_summary = \"Long business summary\"\n",
|
||||
"long_name = \"Long name\"\n",
|
||||
"\n",
|
||||
"if long_summary in info and info[long_summary][0] != \"NA\":\n",
|
||||
" overview = info[long_summary][0]\n",
|
||||
"elif long_name in info:\n",
|
||||
" overview = info[long_name][0]\n",
|
||||
"else:\n",
|
||||
" overview = info[\"Long name\"][0]"
|
||||
" overview = \"\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -181,7 +186,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"tables = openbb.etf.news(info[\"Short name\"][0], 5)\n",
|
||||
"tables = openbb.etf.news(info[\"Short name\"][0], 5) if \"Short name\" in info else []\n",
|
||||
"for table in tables:\n",
|
||||
" table[0].loc[\"link\"] = (\n",
|
||||
" table[0].loc[\"link\"].apply(lambda x: f'<a href=\"{x}\">{x}</a>')\n",
|
||||
@@ -195,7 +200,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"quote_data = openbb.stocks.quote_fmp(symbol)\n",
|
||||
"quote_data = openbb.stocks.quote(symbol)\n",
|
||||
"quote_data"
|
||||
]
|
||||
},
|
||||
@@ -240,9 +245,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df_sec_filings = openbb.stocks.fa.sec(symbol=symbol)[[\"Type\", \"Category\", \"Link\"]].head(\n",
|
||||
" 5\n",
|
||||
")\n",
|
||||
"df_sec_filings = openbb.stocks.fa.sec(symbol)[[\"Type\", \"Category\", \"Link\"]].head(5)\n",
|
||||
"df_sec_filings[\"Link\"] = df_sec_filings[\"Link\"].apply(\n",
|
||||
" lambda x: f'<a href=\"{x}\">{x}</a>'\n",
|
||||
")\n",
|
||||
@@ -1195,7 +1198,7 @@
|
||||
" \"Buffet Score is neutral\",\n",
|
||||
" \"Buffet Score is favourable\",\n",
|
||||
" ],\n",
|
||||
" float(score[\"Total Score\"], 2),\n",
|
||||
" float(round(score[\"Total Score\"], 2)),\n",
|
||||
" )\n",
|
||||
"if predictions:\n",
|
||||
" htmlcode += widgets.kpi(\n",
|
||||
@@ -1208,7 +1211,9 @@
|
||||
" )\n",
|
||||
"body += widgets.add_tab(\"SUMMARY\", htmlcode)\n",
|
||||
"\n",
|
||||
"htmlcode = widgets.row([widgets.h(3, \"Description\") + widgets.p(overview)])\n",
|
||||
"htmlcode=\"\"\n",
|
||||
"if overview:\n",
|
||||
" htmlcode += widgets.row([widgets.h(3, \"Description\") + widgets.p(overview)])\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"Price Chart\") + price_chart])\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"Quote\") + quote_data.to_html()])\n",
|
||||
"htmlcode += widgets.row([widgets.h(3, \"Latest News for \" + symbol)])\n",
|
||||
@@ -1466,7 +1471,7 @@
|
||||
"metadata": {
|
||||
"celltoolbar": "Tags",
|
||||
"kernelspec": {
|
||||
"display_name": "obb",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -1480,11 +1485,11 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.6"
|
||||
"version": "3.9.13"
|
||||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "100174a9203096c0c10fb537684ff280825ee9e252451beb8786068677204f06"
|
||||
"hash": "af870c0f9615f5bb08692efcc9bf540319fe60e6793056508a4dab09c9fa8dda"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -176,12 +176,12 @@ def option_expirations(symbol: str) -> List[str]:
|
||||
List of expiration dates
|
||||
"""
|
||||
df = get_full_option_chain(symbol)
|
||||
|
||||
if df.empty:
|
||||
return []
|
||||
|
||||
# get everything that is not an empty string
|
||||
exps = [exp for exp in list(df.expirygroup.unique()) if exp]
|
||||
# Convert 'January 11, 1993' into '1993-01-11'
|
||||
return [datetime.strptime(exp, "%B %d, %Y").strftime("%Y-%m-%d") for exp in exps]
|
||||
return [exp for exp in list(df.expiration.unique()) if exp]
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
|
||||
Reference in New Issue
Block a user