diff options
author | James Maslek <jmaslek11@gmail.com> | 2023-05-04 14:25:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 14:25:33 -0400 |
commit | 406c6d60ac8e108230470c59fc8edab39cb7d6b2 (patch) | |
tree | 8318791a57ab609517534d855c83f06f8eb92add | |
parent | 2b7793857b66e1f34ba346c1b3c423686f1980f8 (diff) | |
parent | 0bcf3629a8f873e43145ae5e4f6c45064a6fc898 (diff) |
Merge branch 'develop' into feature/plotly-react
70 files changed, 591 insertions, 786 deletions
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 26e24de25af..3fe240543b1 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -104,9 +104,6 @@ jobs: source $VENV pytest tests/ --optimization --cov --cov-fail-under=50 --autodoc -n auto --durations=10 --timeout=30 --cov-report=xml - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v3 - - name: Start Terminal and exit run: | source $VENV diff --git a/openbb_terminal/economy/finviz_model.py b/openbb_terminal/economy/finviz_model.py index 8dd45c47ff3..8281a7bfc28 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 b2992ffe43f..c7891f3b296 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'<a href=\"{x}\">{x}</a>')\n", + " table[0].loc[\"URL\"] = (\n", + " table[0].loc[\"URL\"].apply(lambda x: f'<a href=\"{x}\">{x}</a>')\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" ] }, @@ -241,36 +243,18 @@ { "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, "id": "3022130e", "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 @@ "<style>\n", "@font-face {{\n", " font-family: \"Fira Code\";\n", - " src: url(\"{(OpenBBFigure.plotlyjs_path.parent.parent / \"web\"/\"css\").as_uri()}/fonts/FiraCode-Regular.ttf\") format(\"truetype\");\n", + " src: url(\"{(OpenBBFigure.plotlyjs_path.parent.parent / \"web\"/\"css\").as_uri()}/fonts/Consolas-Regular.ttf\") format(\"truetype\");\n", " font-weight: 400 700;\n", " font-stretch: 50%;\n", "}}\n", @@ -1162,12 +1147,12 @@ " htmlcode += widgets.row([widgets.h(3, \"Analyst Ratings\") + df_analyst.to_html()])\n", "except:\n", " pass\n", - "try:\n", - " htmlcode += widgets.row(\n", - " [widgets.h(3, \"Analyst Recommendations\") + df_rating.to_html()]\n", - " )\n", - "except:\n", - " pass\n", + "#try:\n", + "# htmlcode += widgets.row(\n", + "# [widgets.h(3, \"Analyst Recommendations\") + df_rating.to_html()]\n", + "# )\n", + "#except:\n", + "# pass\n", "\n", "body += widgets.add_tab(\"Analyst Opinions\", htmlcode)\n", "\n", @@ -1405,7 +1390,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.5" + "version": "3.10.8" }, "vscode": { "interpreter": { diff --git a/website/content/sdk/usage/intros/stocks/fundamental-analysis.md b/website/content/sdk/usage/intros/stocks/fundamental-analysis.md index 957dbbacdc2..185b544ab8a 100644 --- a/website/content/sdk/usage/intros/stocks/fundamental-analysis.md +++ b/website/content/sdk/usage/intros/stocks/fundamental-analysis.md @@ -3,10 +3,9 @@ title: Fundamental Analysis keywords: [fundamentals, fundamental, fa, ratios, earnings, balance, income, cash, statement, statements, sec, multiples, price, ebitda, ebitdam, revenue, quarter, annual, change, company, performance, filing, filings, 10K, 8K, audit, audited, due diligence, research, company, ticker, analyst, rating, rot, pt, est, sec, supplier, customer, arktrades, ratings, analysts, filings, form, forms, customers, suppliers, alphavantage, EODHD, financial modeling prep, polygon, how to, usage, examples, sdk] description: This guide introduces the Fundamental Analysis menu within the Stocks menu, briefly explains the features, and provides examples in context. --- - import HeadTitle from '@site/src/components/General/HeadTitle.tsx'; -<HeadTitle title="Fundamental Analysis - SDK | OpenBB Docs" /> +`<HeadTitle title="Fundamental Analysis - SDK | OpenBB Docs" />` The FA module provides programmatic access to the commands from within the OpenBB Terminal. To get the most out of these functions, we recommend obtaining API keys from: @@ -15,62 +14,109 @@ The FA module provides programmatic access to the commands from within the OpenB - Financial Modeling Prep - Polygon -View [this page](https://docs.openbb.co/terminal/usage/guides/api-keys) for a list of all API sources used across the platform. - -## How to Use - -The contextual help will be activated upon entering ., after, openbb.stocks.fa. A brief description below highlights the functions within the `fa` module. - -| Path | Description | -| :---------------------------------|----------------------------------------------: | -| openbb.stocks.fa.analysis | Analysis SEC Fillings with Machine Learning | -| openbb.stocks.fa.balance | Company Balance Sheet | -| openbb.stocks.fa.cal | Calendar Earnings and Estimates | -| openbb.stocks.fa.cash | Company Cash Flows | -| openbb.stocks.fa.data | Fundamental and Technical Data | -| openbb.stocks.fa.dcfc | Shows DCF Values for a Ticker | -| openbb.stocks.fa.divs | Historical Dividends for a Company | -| openbb.stocks.fa.dupont | Detailed ROE Breakdown | -| openbb.stocks.fa.earnings | Earnings Data and EPS | -| openbb.stocks.fa.enterprise | Company Enterprise Value | -| openbb.stocks.fa.fama_coe | Fama/French value for Cost of Equity | -| openbb.stocks.fa.fraud | Key Fraud Ratios | -| openbb.stocks.fa.growth | Growth of Financial Statement Items | -| openbb.stocks.fa.hq | HQ Location for Company | -| openbb.stocks.fa.income | Company Income Statement | -| openbb.stocks.fa.info | Information About a Company | -| openbb.stocks.fa.key | Company Key Metrics | -| openbb.stocks.fa.metrics | Key Metrics Over Time | -| openbb.stocks.fa.mgmt | Company Management Team | -| openbb.stocks.fa.mktcap | Estimated Market Cap | -| openbb.stocks.fa.overview | Overview of the Company | -| openbb.stocks.fa.profile | Company Profile | -| openbb.stocks.fa.ratios | In-Depth Ratios over Time | -| openbb.stocks.fa.score | Investing Score from Warren Buffet | -| openbb.stocks.fa.shrs | Shareholders (Insiders, Institutions, Funds) | -| openbb.stocks.fa.splits | Stock Splits and Reverse Splits Since IPO | -| openbb.stocks.fa.sust | Sustainability Values | -|openbb.stocks.fa.analyst |Analyst Prices and Ratings | -|openbb.stocks.fa.arktrades |Ark Trades for the Ticker | -|openbb.stocks.fa.customer |List of Customers | -|openbb.stocks.fa.est |Earnings Estimates | -|openbb.stocks.fa.pt |Historical Price Targets | -|openbb.stocks.fa.rating |Daily Ratings | -|openbb.stocks.fa.rot |Historical Number of Analysts and Ratings | -|openbb.stocks.fa.sec |List of SEC Filings | -|openbb.stocks.fa.supplier |List of Suppliers | - -Alternatively the contents of the module can be printed with: +View [this page](https://docs.openbb.co/sdk/usage/guides/api-keys) for a list of all API sources used across the platform. + +## The FA Module + +A brief description below highlights the properties of the `fa` module. + +| Path | Description | +| :---------------------------- | -----------------------------------------------: | +| openbb.stocks.fa.analysis | Analysis of SEC disclosure statements | +| openbb.stocks.fa.balance | Company balan |