diff --git a/openbb_terminal/economy/finviz_model.py b/openbb_terminal/economy/finviz_model.py index 8dd45c47ff33..8281a7bfc284 100644 --- a/openbb_terminal/economy/finviz_model.py +++ b/openbb_terminal/economy/finviz_model.py @@ -92,7 +92,7 @@ def get_valuation_data( try: group = GROUPS[group] df_group = valuation.Valuation().screener_view(group=group) - df_group.columns = [col.replace(" ", "") for col in df_group.columns] + df_group.columns = [col.replace(" ", "").strip() for col in df_group.columns] df_group = df_group.sort_values(by=sortby, ascending=ascend) df_group.fillna("", inplace=True) @@ -156,6 +156,7 @@ def get_performance_data( "Rel Volume": "RelVolume", } ) + df_group.columns = [col.strip() for col in df_group.columns] df_group["Week"] = df_group["Week"].apply(lambda x: float(x.strip("%")) / 100) df_group = df_group.sort_values(by=sortby, ascending=ascend) df_group.fillna("", inplace=True) diff --git a/openbb_terminal/reports/templates/equity.ipynb b/openbb_terminal/reports/templates/equity.ipynb index b2992ffe43fa..c7891f3b2965 100644 --- a/openbb_terminal/reports/templates/equity.ipynb +++ b/openbb_terminal/reports/templates/equity.ipynb @@ -58,11 +58,13 @@ "\n", "user = get_current_user()\n", "\n", - "cfg.theme = TerminalStyle(\n", - " user.preferences.MPL_STYLE,\n", - " user.preferences.PMF_STYLE,\n", - " user.preferences.RICH_STYLE,\n", - ")" + "from openbb_terminal import theme\n", + "\n", + "#cfg.theme = TerminalStyle(\n", + "# user.preferences.MPL_STYLE,\n", + "# user.preferences.PMF_STYLE,\n", + "# user.preferences.RICH_STYLE,\n", + "#)" ] }, { @@ -97,7 +99,7 @@ "source": [ "# Parameters that will be replaced when calling this notebook\n", "# Do not leave parameters blank as notebook will not run otherwise\n", - "symbol = \"IONQ\"\n", + "symbol = \"FRC\"\n", "report_name = f\"Equity report for {symbol}\"" ] }, @@ -142,7 +144,7 @@ "metadata": {}, "outputs": [], "source": [ - "info = openbb.stocks.fa.data(symbol=symbol).transpose()\n", + "info = openbb.stocks.fa.overview(symbol=symbol, source=\"Finviz\").transpose()\n", "\n", "info\n", "try:\n", @@ -183,7 +185,7 @@ " df_quarter_earnings,\n", " df_quarter_revenues,\n", ") = openbb.stocks.fa.est(symbol=symbol)\n", - "df_quarter_revenues" + "df_quarter_revenues.transpose()" ] }, { @@ -204,14 +206,14 @@ "metadata": {}, "outputs": [], "source": [ - "tables = openbb.etf.news(info[\"Short name\"][0], 5) if \"Short name\" in info else symbol\n", + "tables = openbb.stocks.news(symbol)\n", "\n", "for table in tables:\n", " if not isinstance(table, pd.DataFrame):\n", " continue\n", "\n", - " table[0].loc[\"link\"] = (\n", - " table[0].loc[\"link\"].apply(lambda x: f'{x}')\n", + " table[0].loc[\"URL\"] = (\n", + " table[0].loc[\"URL\"].apply(lambda x: f'{x}')\n", " )" ] }, @@ -222,7 +224,7 @@ "metadata": {}, "outputs": [], "source": [ - "quote_data = openbb.stocks.quote([symbol])\n", + "quote_data = info[[\"Price\", \"Prev Close\", \"Change\", \"Volume\", \"52W Range\", \"Perf YTD\"]]\n", "quote_data" ] }, @@ -238,28 +240,6 @@ "df_institutional_shareholders" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "e101e24e", - "metadata": {}, - "outputs": [], - "source": [ - "openbb.stocks.fa.shrs(symbol)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "51dfd9d2", - "metadata": {}, - "outputs": [], - "source": [ - "df_institutional_shareholders = openbb.stocks.fa.shrs(symbol)\n", - "df_institutional_shareholders.index += 1\n", - "df_institutional_shareholders" - ] - }, { "cell_type": "code", "execution_count": null, @@ -267,10 +247,14 @@ "metadata": {}, "outputs": [], "source": [ - "df_sec_filings = openbb.stocks.fa.sec(symbol)[\n", - " [\"Company Name\", \"Reporting Owner\", \"Form Type\", \"Period\"]\n", - "].head(5)\n", - "df_sec_filings" + "#this command works 1/2 the time - really need to fix this - but this will catch the errors and stop it from breaking the report\n", + "try:\n", + " df_sec_filings = openbb.stocks.fa.sec(symbol)[\n", + " [\"Company Name\", \"Reporting Owner\", \"Form Type\", \"Period\", \"View\"]\n", + " ].head(5)\n", + " df_sec_filings\n", + "except:\n", + " df_sec_filings = \"Error with Nasdaq API\"" ] }, { @@ -280,25 +264,25 @@ "metadata": {}, "outputs": [], "source": [ - "df_analyst = openbb.stocks.fa.analyst(symbol=symbol)\n", - "print(df_analyst)\n", - "if not df_analyst.empty:\n", - " if \"target\" in df_analyst.columns:\n", - " if \"target_to\" in df_analyst.columns:\n", - " df_analyst[\"target\"] = df_analyst[\"target_to\"].combine_first(\n", - " df_analyst[\"target\"]\n", - " )\n", - " else:\n", - " df_analyst[\"target\"] = df_analyst[\"target\"]\n", - " df_analyst = df_analyst[[\"category\", \"analyst\", \"rating\", \"target\"]].rename(\n", - " columns={\n", - " \"category\": \"Category\",\n", - " \"analyst\": \"Analyst\",\n", - " \"rating\": \"Rating\",\n", - " \"target\": \"Price Target\",\n", - " }\n", - " )\n", - "df_analyst" + "df_analyst = openbb.stocks.fa.pt(symbol=symbol).sort_index(ascending = False)\n", + "#print(df_analyst)\n", + "#if not df_analyst.empty:\n", + "# if \"target\" in df_analyst.columns:\n", + "# if \"target_to\" in df_analyst.columns:\n", + "# df_analyst[\"target\"] = df_analyst[\"target_to\"].combine_first(\n", + "# df_analyst[\"target\"]\n", + "# )\n", + "# else:\n", + "# df_analyst[\"target\"] = df_analyst[\"target\"]\n", + "# df_analyst = df_analyst[[\"category\", \"analyst\", \"rating\", \"target\"]].rename(\n", + "# columns={\n", + "# \"category\": \"Category\",\n", + "# \"analyst\": \"Analyst\",\n", + "# \"rating\": \"Rating\",\n", + "# \"target\": \"Price Target\",\n", + "# }\n", + "# )\n", + "df_analyst.head(10)" ] }, { @@ -469,7 +453,7 @@ "metadata": {}, "outputs": [], "source": [ - "similar_companies = openbb.stocks.ca.similar(symbol, source=\"Polygon\")\n", + "similar_companies = openbb.stocks.ca.similar(symbol, source=\"Finviz\")[0:5]\n", "if similar_companies:\n", " similar_companies.append(symbol)" ] @@ -666,7 +650,7 @@ "metadata": {}, "outputs": [], "source": [ - "df = openbb.stocks.fa.pt(symbol=symbol)\n", + "df = df_analyst.copy()\n", "avg_ratings_last_30_days = 0\n", "days = 0\n", "if not df.empty:\n", @@ -840,6 +824,7 @@ "ticker_data_all = openbb.stocks.load(\n", " symbol=symbol,\n", " start_date=datetime.datetime.now() - datetime.timedelta(days=5 * 12 * 21),\n", + " verbose = False\n", ")\n", "ticker_data_all[\"Returns\"] = ticker_data_all[\"Adj Close\"].pct_change()" ] @@ -889,8 +874,8 @@ "metadata": {}, "outputs": [], "source": [ - "income_df = openbb.stocks.fa.income(symbol, source=\"FinancialModelingPrep\")\n", - "data_df = openbb.stocks.fa.data(symbol)\n", + "income_df = openbb.stocks.fa.income(symbol, source = 'FinancialModelingPrep')\n", + "data_df = openbb.stocks.fa.overview(symbol, source = 'FinancialModelingPrep')\n", "mgmt_df = openbb.stocks.fa.mgmt(symbol)\n", "try:\n", " if not mgmt_df.empty:\n", @@ -1029,7 +1014,7 @@ "