Skip to content

Commit

Permalink
Merge pull request #4327 from OpenBB-finance/feature/fix-4223
Browse files Browse the repository at this point in the history
Patch Equity Report
  • Loading branch information
jmaslek authored Feb 24, 2023
2 parents 915c902 + 416f556 commit 39d7cc6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
31 changes: 18 additions & 13 deletions openbb_terminal/reports/templates/equity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \"\""
]
},
{
Expand Down Expand Up @@ -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",
Expand All @@ -195,7 +200,7 @@
"metadata": {},
"outputs": [],
"source": [
"quote_data = openbb.stocks.quote_fmp(symbol)\n",
"quote_data = openbb.stocks.quote(symbol)\n",
"quote_data"
]
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -1466,7 +1471,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "obb",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -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"
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions openbb_terminal/stocks/options/nasdaq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 39d7cc6

Please sign in to comment.