From f0e02170834d43692320fde45bf83fcf0b4892fe Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 2 Jun 2023 06:06:28 -0700 Subject: hotfix/fix-balance-headers: Fixes #5094 (#5099) * fixes bad headers for ca/financial statements * remove unnecessary lines --- .../comparison_analysis/marketwatch_model.py | 12 ++- .../test_get_financial_comparisons[2020-False].csv | 36 +++---- ...get_financial_comparisons[31-Dec-2021-True].csv | 50 +++++---- .../test_display_balance_comparison.txt | 77 +++++++------ .../test_display_cashflow_comparison.txt | 40 +++---- .../test_display_income_comparison.txt | 119 ++++++++++----------- 6 files changed, 166 insertions(+), 168 deletions(-) diff --git a/openbb_terminal/stocks/comparison_analysis/marketwatch_model.py b/openbb_terminal/stocks/comparison_analysis/marketwatch_model.py index d6093ea172d..66afb06bac9 100644 --- a/openbb_terminal/stocks/comparison_analysis/marketwatch_model.py +++ b/openbb_terminal/stocks/comparison_analysis/marketwatch_model.py @@ -376,13 +376,15 @@ def combine_similar_financials( datasets[similar[0]].columns ).index(timeframe) - for symbol in similar[1:]: + for symbol in similar: report_quarter_date = list(datasets[symbol].columns)[-idx] earnings_dates.append(report_quarter_date) - compare_financials[symbol] = datasets[symbol][report_quarter_date] + compare_financials[symbol + " (" + report_quarter_date + ")"] = datasets[ + symbol + ][report_quarter_date] - compare_financials.columns = pd.MultiIndex.from_tuples( - zip(earnings_dates, compare_financials.columns), + compare_financials.drop( + columns=compare_financials.columns[0], axis=1, inplace=True ) else: @@ -392,4 +394,4 @@ def combine_similar_financials( for symbol in similar[1:]: compare_financials[symbol] = datasets[symbol][timeframe] - return compare_financials + return compare_financials.fillna("-").replace("-", "") diff --git a/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[2020-False].csv b/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[2020-False].csv index 3d0a0bd2298..8b50a50089d 100644 --- a/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[2020-False].csv +++ b/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[2020-False].csv @@ -5,47 +5,47 @@ Cost of Goods Sold (COGS) incl. D&A,24.91B,101.91B COGS Growth,21.44%,-12.16% COGS excluding D&A,22.58B,89.24B Depreciation & Amortization Expense,2.32B,12.68B -Depreciation,-,12.53B -Amortization of Intangibles,-,144M +Depreciation,,12.53B +Amortization of Intangibles,,144M Gross Income,6.63B,20.57B Gross Income Growth,62.94%,-3.02% -Gross Profit Margin,-,- +Gross Profit Margin,, SG&A Expense,4.64B,13.24B SGA Growth,16.22%,-13.43% Research & Development,1.49B,6.2B Other SG&A,3.15B,7.04B -Other Operating Expense,-,- +Other Operating Expense,, Unusual Expense,36M,296M EBIT after Unusual Expense,1.96B,7.04B Non Operating Income/Expense,(86M),1.24B Non-Operating Interest Income,30M,241M -Equity in Affiliates (Pretax),-,674M +Equity in Affiliates (Pretax),,674M Interest Expense,748M,1.1B Interest Expense Growth,9.20%,40.41% Gross Interest Expense,796M,1.1B -Interest Capitalized,48M,- +Interest Capitalized,48M, Pretax Income,1.15B,8.1B Pretax Income Growth,273.53%,8.86% -Pretax Margin,-,- +Pretax Margin,, Income Tax,292M,1.77B Income Tax - Current Domestic,4M,356M Income Tax - Current Foreign,248M,493M -Income Tax - Deferred Domestic,-,617M +Income Tax - Deferred Domestic,,617M Income Tax - Deferred Foreign,40M,308M -Income Tax Credits,-,- -Equity in Affiliates,-,- -Other After Tax Income (Expense),(31M),- +Income Tax Credits,, +Equity in Affiliates,, +Other After Tax Income (Expense),(31M), Consolidated Net Income,831M,6.32B Minority Interest Expense,141M,(106M) Net Income,690M,6.43B Net Income Growth,179.31%,-4.53% -Net Margin Growth,-,- -Extraordinaries & Discontinued Operations,-,- -Extra Items & Gain/Loss Sale Of Assets,-,- -Cumulative Effect - Accounting Chg,-,- -Discontinued Operations,-,- +Net Margin Growth,, +Extraordinaries & Discontinued Operations,, +Extra Items & Gain/Loss Sale Of Assets,, +Cumulative Effect - Accounting Chg,, +Discontinued Operations,, Net Income After Extraordinaries,690M,6.43B -Preferred Dividends,-,180M +Preferred Dividends,,180M Net Income Available to Common,690M,6.25B EPS (Basic),0.25,4.36 EPS (Basic) Growth,175.41%,-5.67% @@ -55,4 +55,4 @@ EPS (Diluted) Growth,164.97%,-5.27% Diluted Shares Outstanding,3.25B,1.44B EBITDA,4.32B,20.01B EBITDA Growth,93.20%,0.15% -EBITDA Margin,-,- +EBITDA Margin,, diff --git a/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[31-Dec-2021-True].csv b/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[31-Dec-2021-True].csv index fa0121ef177..df4fca82b1d 100644 --- a/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[31-Dec-2021-True].csv +++ b/tests/openbb_terminal/stocks/comparison_analysis/csv/test_marketwatch_model/test_get_financial_comparisons[31-Dec-2021-True].csv @@ -1,53 +1,51 @@ -,31-Dec-2021,31-Dec-2021 -,TSLA,GM -Item,, +Item,TSLA (31-Dec-2021),GM (31-Dec-2021) Sales/Revenue,17.72B,33.58B Sales Growth,28.80%,25.41% Cost of Goods Sold (COGS) incl. D&A,12.87B,29.59B COGS Growth,27.48%,28.71% COGS excluding D&A,12.02B,26.65B Depreciation & Amortization Expense,848M,2.94B -Depreciation,530M,- -Amortization of Intangibles,318M,- +Depreciation,530M, +Amortization of Intangibles,318M, Gross Income,4.85B,4B Gross Income Growth,32.43%,5.40% -Gross Profit Margin,-,- +Gross Profit Margin,, SG&A Expense,2.23B,2.48B SGA Growth,39.19%,15.36% -Research & Development,740M,- -Other SG&A,-,- -Other Operating Expense,-,- +Research & Development,740M, +Other SG&A,, +Other Operating Expense,, Unusual Expense,(1M),17M EBIT after Unusual Expense,1M,(17M) Non Operating Income/Expense,67M,631M Non-Operating Interest Income,25M,44M -Equity in Affiliates (Pretax),-,286M +Equity in Affiliates (Pretax),,286M Interest Expense,71M,227M Interest Expense Growth,-43.65%,-1.30% Gross Interest Expense,72M,227M -Interest Capitalized,1M,- +Interest Capitalized,1M, Pretax Income,2.64B,2.24B Pretax Income Growth,40.01%,-11.86% -Pretax Margin,-,- +Pretax Margin,, Income Tax,292M,471M -Income Tax - Current Domestic,-,- -Income Tax - Current Foreign,-,- -Income Tax - Deferred Domestic,-,- -Income Tax - Deferred Foreign,-,- -Income Tax Credits,-,- -Equity in Affiliates,-,- -Other After Tax Income (Expense),-,- +Income Tax - Current Domestic,, +Income Tax - Current Foreign,, +Income Tax - Deferred Domestic,, +Income Tax - Deferred Foreign,, +Income Tax Credits,, +Equity in Affiliates,, +Other After Tax Income (Expense),, Consolidated Net Income,2.34B,1.77B Minority Interest Expense,22M,25M Net Income,2.32B,1.74B Net Income Growth,43.45%,-28.06% -Net Margin Growth,-,- -Extraordinaries & Discontinued Operations,-,- -Extra Items & Gain/Loss Sale Of Assets,-,- -Cumulative Effect - Accounting Chg,-,- -Discontinued Operations,-,- +Net Margin Growth,, +Extraordinaries & Discontinued Operations,, +Extra Items & Gain/Loss Sale Of Assets,, +Cumulative Effect - Accounting Chg,, +Discontinued Operations,, Net Income After Extraordinaries,2.32B,1.74B -Preferred Dividends,-,45M +Preferred Dividends,,45M Net Income Available to Common,2.32B,1.7B EPS (Basic),0.76,1.17 EPS (Basic) Growth,41.04%,-28.64% @@ -57,4 +55,4 @@ EPS (Diluted) Growth,41.91%,-28.83% Diluted Shares Outstanding,3.4B,1.47B EBITDA,3.46B,4.46B EBITDA Growth,22.90%,-5.69% -EBITDA Margin,-,- +EBITDA Margin,, diff --git a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_balance_comparison.txt b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_balance_comparison.txt index b4374271c0e..418c346bb09 100644 --- a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_balance_comparison.txt +++ b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_balance_comparison.txt @@ -1,41 +1,40 @@ Other available quarterly timeframes are: 30-Sep-2021, 31-Dec-2021, 31-Mar-2022, 30-Jun-2022, 30-Sep-2022 - 31-Dec-2021 - TSLA GM -Item -Cash & Short Term Investments 18.05B 31.61B -Cash & Short Term Investments Growth 9.93% 18.03% -Cash Only 17.92B 23B -Short-Term Investments - - -Cash & ST Investments / Total Assets 29.05% 12.92% -Total Accounts Receivable 1.91B 34.04B -Total Accounts Receivable Growth -2.50% 2.59% -Accounts Receivables, Net 1.91B 34.04B -Accounts Receivables, Gross 1.91B 34.94B -Bad Debt/Doubtful Accounts - (895M) -Other Receivable - - -Accounts Receivable Turnover 9.26 0.99 -Inventories 5.76B 12.99B -Finished Goods 1.28B 4.75B -Work in Progress 1.09B - -Raw Materials 3.39B 8.24B -Progress Payments & Other - - -Other Current Assets 1.38B 3.46B -Miscellaneous Current Assets 1.38B 3.46B -Total Current Assets 27.1B 82.1B -Net Property, Plant & Equipment 31.18B 80.14B -Property, Plant & Equipment - Gross 39.87B 111.43B -Buildings - - -Land & Improvements - - -Computer Software and Equipment 1.41B - -Other Property, Plant & Equipment - - -Accumulated Depreciation 8.69B 31.29B -Total Investments and Advances 223M 10.22B -Other Long-Term Investments 223M 540M -Long-Term Note Receivables 299M 36.17B -Intangible Assets 1.72B 5.09B -Net Goodwill 200M 1.91B -Net Other Intangibles - - -Other Assets 1.62B 9.85B -Total Assets 62.13B 244.72B -Total Assets Growth 7.43% 2.58% + TSLA (31-Dec-2021) GM (31-Dec-2021) +Item +Cash & Short Term Investments 18.05B 31.61B +Cash & Short Term Investments Growth 9.93% 18.03% +Cash Only 17.92B 23B +Short-Term Investments +Cash & ST Investments / Total Assets 29.05% 12.92% +Total Accounts Receivable 1.91B 34.04B +Total Accounts Receivable Growth -2.50% 2.59% +Accounts Receivables, Net 1.91B 34.04B +Accounts Receivables, Gross 1.91B 34.94B +Bad Debt/Doubtful Accounts (895M) +Other Receivable +Accounts Receivable Turnover 9.26 0.99 +Inventories 5.76B 12.99B +Finished Goods 1.28B 4.75B +Work in Progress 1.09B +Raw Materials 3.39B 8.24B +Progress Payments & Other +Other Current Assets 1.38B 3.46B +Miscellaneous Current Assets 1.38B 3.46B +Total Current Assets 27.1B 82.1B +Net Property, Plant & Equipment 31.18B 80.14B +Property, Plant & Equipment - Gross 39.87B 111.43B +Buildings +Land & Improvements +Computer Software and Equipment 1.41B +Other Property, Plant & Equipment +Accumulated Depreciation 8.69B 31.29B +Total Investments and Advances 223M 10.22B +Other Long-Term Investments 223M 540M +Long-Term Note Receivables 299M 36.17B +Intangible Assets 1.72B 5.09B +Net Goodwill 200M 1.91B +Net Other Intangibles +Other Assets 1.62B 9.85B +Total Assets 62.13B 244.72B +Total Assets Growth 7.43% 2.58% diff --git a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_cashflow_comparison.txt b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_cashflow_comparison.txt index a4c139b0596..eef9546fe85 100644 --- a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_cashflow_comparison.txt +++ b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_cashflow_comparison.txt @@ -1,22 +1,22 @@ Other available quarterly timeframes are: 30-Sep-2021, 31-Dec-2021, 31-Mar-2022, 30-Jun-2022, 30-Sep-2022 - 31-Dec-2021 TSLA 31-Dec-2021 GM -Item -Net Income before Extraordinaries 2.34B 1.77B -Net Income Growth 41.23% -25.98% -Depreciation, Depletion & Amortization 848M 2.94B -Depreciation and Depletion 530M - -Amortization of Intangible Assets 318M - -Deferred Taxes & Investment Tax Credit - 251M -Deferred Taxes - 251M -Investment Tax Credit - - -Other Funds 539M (783M) -Funds from Operations 3.73B 4.17B -Extraordinaries - - -Changes in Working Capital 855M 2.64B -Receivables 18M - -Accounts Payable 1.81B - -Other Assets/Liabilities (443M) 4.59B -Net Operating Cash Flow 4.59B 6.81B -Net Operating Cash Flow Growth 45.69% 13,995.92% -Net Operating Cash Flow / Sales 25.88% 20.27% + TSLA (31-Dec-2021) GM (31-Dec-2021) +Item +Net Income before Extraordinaries 2.34B 1.77B +Net Income Growth 41.23% -25.98% +Depreciation, Depletion & Amortization 848M 2.94B +Depreciation and Depletion 530M +Amortization of Intangible Assets 318M +Deferred Taxes & Investment Tax Credit 251M +Deferred Taxes 251M +Investment Tax Credit +Other Funds 539M (783M) +Funds from Operations 3.73B 4.17B +Extraordinaries +Changes in Working Capital 855M 2.64B +Receivables 18M +Accounts Payable 1.81B +Other Assets/Liabilities (443M) 4.59B +Net Operating Cash Flow 4.59B 6.81B +Net Operating Cash Flow Growth 45.69% 13,995.92% +Net Operating Cash Flow / Sales 25.88% 20.27% diff --git a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_income_comparison.txt b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_income_comparison.txt index 9fbfe1a1c5a..a8386049c6a 100644 --- a/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_income_comparison.txt +++ b/tests/openbb_terminal/stocks/comparison_analysis/txt/test_marketwatch_view/test_display_income_comparison.txt @@ -1,62 +1,61 @@ Other available quarterly timeframes are: 30-Sep-2021, 31-Dec-2021, 31-Mar-2022, 30-Jun-2022, 30-Sep-2022 - 31-Dec-2021 - TSLA GM -Item -Sales/Revenue 17.72B 33.58B -Sales Growth 28.80% 25.41% -Cost of Goods Sold (COGS) incl. D&A 12.87B 29.59B -COGS Growth 27.48% 28.71% -COGS excluding D&A 12.02B 26.65B -Depreciation & Amortization Expense 848M 2.94B -Depreciation 530M - -Amortization of Intangibles 318M - -Gross Income 4.85B 4B -Gross Income Growth 32.43% 5.40% -Gross Profit Margin - - -SG&A Expense 2.23B 2.48B -SGA Growth 39.19% 15.36% -Research & Development 740M - -Other SG&A - - -Other Operating Expense - - -Unusual Expense (1M) 17M -EBIT after Unusual Expense 1M (17M) -Non Operating Income/Expense 67M 631M -Non-Operating Interest Income 25M 44M -Equity in Affiliates (Pretax) - 286M -Interest Expense 71M 227M -Interest Expense Growth -43.65% -1.30% -Gross Interest Expense 72M 227M -Interest Capitalized 1M - -Pretax Income 2.64B 2.24B -Pretax Income Growth 40.01% -11.86% -Pretax Margin - - -Income Tax 292M 471M -Income Tax - Current Domestic - - -Income Tax - Current Foreign - - -Income Tax - Deferred Domestic - - -Income Tax - Deferred Foreign - - -Income Tax Credits - - -Equity in Affiliates - - -Other After Tax Income (Expense) - - -Consolidated Net Income 2.34B 1.77B -Minority Interest Expense 22M 25M -Net Income 2.32B 1.74B -Net Income Growth 43.45% -28.06% -Net Margin Growth - - -Extraordinaries & Discontinued Operations - - -Extra Items & Gain/Loss Sale Of Assets - - -Cumulative Effect - Accounting Chg - - -Discontinued Operations - - -Net Income After Extraordinaries 2.32B 1.74B -Preferred Dividends - 45M -Net Income Available to Common 2.32B 1.7B -EPS (Basic) 0.76 1.17 -EPS (Basic) Growth 41.04% -28.64% -Basic Shares Outstanding 3.04B 1.45B -EPS (Diluted) 0.68 1.15 -EPS (Diluted) Growth 41.91% -28.83% -Diluted Shares Outstanding 3.4B 1.47B -EBITDA 3.46B 4.46B -EBITDA Growth 22.90% -5.69% -EBITDA Margin - - + TSLA (31-Dec-2021) GM (31-Dec-2021) +Item +Sales/Revenue 17.72B 33.58B +Sales Growth 28.80% 25.41% +Cost of Goods Sold (COGS) incl. D&A 12.87B 29.59B +COGS Growth 27.48% 28.71% +COGS excluding D&A 12.02B 26.65B +Depreciation & Amortization Expense 848M 2.94B +Depreciation 530M +Amortization of Intangibles 318M +Gross Income 4.85B 4B +Gross Income Growth 32.43% 5.40% +Gross Profit Margin +SG&A Expense 2.23B 2.48B +SGA Growth 39.19% 15.36% +Research & Development 740M +Other SG&A +Other Operating Expense +Unusual Expense (1M) 17M +EBIT after Unusual Expense 1M (17M) +Non Operating Income/Expense 67M 631M +Non-Operating Interest Income 25M 44M +Equity in Affiliates (Pretax) 286M +Interest Expense 71M 227M +Interest Expense Growth -43.65% -1.30% +Gross Interest Expense 72M 227M +Interest Capitalized 1M +Pretax Income 2.64B 2.24B +Pretax Income Growth 40.01% -11.86% +Pretax Margin +Income Tax 292M 471M +Income Tax - Current Domestic +Income Tax - Current Foreign +Income Tax - Deferred Domestic +Income Tax - Deferred Foreign +Income Tax Credits +Equity in Affiliates +Other After Tax Income (Expense) +Consolidated Net Income 2.34B 1.77B +Minority Interest Expense 22M 25M +Net Income 2.32B 1.74B +Net Income Growth 43.45% -28.06% +Net Margin Growth +Extraordinaries & Discontinued Operations +Extra Items & Gain/Loss Sale Of Assets +Cumulative Effect - Accounting Chg +Discontinued Operations +Net Income After Extraordinaries 2.32B 1.74B +Preferred Dividends 45M +Net Income Available to Common 2.32B 1.7B +EPS (Basic) 0.76 1.17 +EPS (Basic) Growth 41.04% -28.64% +Basic Shares Outstanding 3.04B 1.45B +EPS (Diluted) 0.68 1.15 +EPS (Diluted) Growth 41.91% -28.83% +Diluted Shares Outstanding 3.4B 1.47B +EBITDA 3.46B 4.46B +EBITDA Growth 22.90% -5.69% +EBITDA Margin -- cgit v1.2.3