From 9deb06d7339ddacc232de0f74d5fcfe69c19389b Mon Sep 17 00:00:00 2001 From: James Maslek Date: Sat, 17 Sep 2022 07:57:39 -0400 Subject: [PATCH] Friday night bugs (#2557) * bug 2548 to fix stocks/gov/topbuys * lets not print the df * stocks/gov/lasttrades help #2547 * #2531 earnings issue * Add a check in contracts that the amounts are more than 0 * Fxiix tests * #2516 * #2516 * #2511 * Break up the estimates into 3 different options * #2532 * mypy fix * pylint fix --- .../cryptocurrency/overview/loanscan_view.py | 11 +- .../due_diligence/business_insider_view.py | 82 +++++---- .../stocks/due_diligence/dd_controller.py | 12 +- .../fundamental_analysis/fa_controller.py | 19 ++- .../yahoo_finance_model.py | 16 +- .../yahoo_finance_view.py | 61 +++---- .../stocks/government/gov_controller.py | 2 +- .../stocks/government/quiverquant_model.py | 5 +- .../stocks/government/quiverquant_view.py | 4 +- .../test_display_crypto_rates.txt | 4 +- .../test_business_insider_view.py | 4 +- .../due_diligence/test_dd_controller.py | 1 + .../test_estimates.txt | 14 -- .../test_fa_controller.py | 3 + .../test_yahoo_finance_model.py | 6 +- .../test_call_func[display_shareholders].txt | 17 -- ...[display_government_buys-kwargs_dict1].txt | 14 ++ ...[display_government_buys-kwargs_dict1].txt | 3 + .../content/terminal/stocks/dd/est/_index.md | 161 ++++++++---------- 19 files changed, 214 insertions(+), 225 deletions(-) diff --git a/openbb_terminal/cryptocurrency/overview/loanscan_view.py b/openbb_terminal/cryptocurrency/overview/loanscan_view.py index 85ceb390f1f..76f7ef3e6e5 100644 --- a/openbb_terminal/cryptocurrency/overview/loanscan_view.py +++ b/openbb_terminal/cryptocurrency/overview/loanscan_view.py @@ -49,7 +49,12 @@ def display_crypto_rates( if df.empty: console.print("\nError in loanscan request\n") else: - df = df[symbols.upper().split(",")].loc[platforms.lower().split(",")] + valid_platforms = [ + platform + for platform in platforms.lower().split(",") + if platform in df.index + ] + df = df[symbols.upper().split(",")].loc[valid_platforms] df = df.sort_values(df.columns[0], ascending=False, na_position="last") if not external_axes: @@ -98,8 +103,8 @@ def display_crypto_rates( if not external_axes: cfg.theme.visualize_output() - df = df.fillna("N/A") - df = df.applymap(lambda x: str(round(100 * x, 2)) + "%" if x != "N/A" else x) + df = df.fillna("-") + df = df.applymap(lambda x: str(round(100 * x, 2)) + "%" if x != "-" else x) print_rich_table( df.head(limit), diff --git a/openbb_terminal/stocks/due_diligence/business_insider_view.py b/openbb_terminal/stocks/due_diligence/business_insider_view.py index adfc89a55d3..e3d3d8b815c 100644 --- a/openbb_terminal/stocks/due_diligence/business_insider_view.py +++ b/openbb_terminal/stocks/due_diligence/business_insider_view.py @@ -129,13 +129,15 @@ def price_target_from_analysts( @log_start_end(log=logger) -def estimates(symbol: str, export: str = ""): +def estimates(symbol: str, estimate: str, export: str = ""): """Display analysts' estimates for a given ticker. [Source: Business Insider] Parameters ---------- symbol : str Ticker to get analysts' estimates + estimate: str + Type of estimate to get export : str Export dataframe data to csv,json,xlsx file """ @@ -145,42 +147,48 @@ def estimates(symbol: str, export: str = ""): df_quarter_revenues, ) = business_insider_model.get_estimates(symbol) - print_rich_table( - df_year_estimates, - headers=list(df_year_estimates.columns), - show_index=True, - title="Annual Earnings Estimates", - ) + if estimate == "annualearnings": - print_rich_table( - df_quarter_earnings, - headers=list(df_quarter_earnings.columns), - show_index=True, - title="Quarterly Earnings Estimates", - ) + print_rich_table( + df_year_estimates, + headers=list(df_year_estimates.columns), + show_index=True, + title="Annual Earnings Estimates", + ) + export_data( + export, + os.path.dirname(os.path.abspath(__file__)), + "pt_year", + df_year_estimates, + ) - print_rich_table( - df_quarter_revenues, - headers=list(df_quarter_revenues.columns), - show_index=True, - title="Quarterly Revenue Estimates", - ) + elif estimate == "quarterearnings": + print_rich_table( + df_quarter_earnings, + headers=list(df_quarter_earnings.columns), + show_index=True, + title="Quarterly Earnings Estimates", + ) + export_data( + export, + os.path.dirname(os.path.abspath(__file__)), + "pt_qtr_earnings", + df_quarter_earnings, + ) - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "pt_year", - df_year_estimates, - ) - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "pt_qtr_earnings", - df_quarter_earnings, - ) - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "pt_qtr_revenues", - df_quarter_revenues, - ) + elif estimate == "annualrevenue": + print_rich_table( + df_quarter_revenues, + headers=list(df_quarter_revenues.columns), + show_index=True, + title="Quarterly Revenue Estimates", + ) + + export_data( + export, + os.path.dirname(os.path.abspath(__file__)), + "pt_qtr_revenues", + df_quarter_revenues, + ) + else: + console.print("[red]Invalid estimate type[/red]") diff --git a/openbb_terminal/stocks/due_diligence/dd_controller.py b/openbb_terminal/stocks/due_diligence/dd_controller.py index 5093faa9c40..3395548f812 100644 --- a/openbb_terminal/stocks/due_diligence/dd_controller.py +++ b/openbb_terminal/stocks/due_diligence/dd_controller.py @@ -48,6 +48,7 @@ class DueDiligenceController(StockBaseController): "arktrades", ] PATH = "/stocks/dd/" + ESTIMATE_CHOICES = ["annualrevenue", "annualearnings", "quarterearnings"] def __init__( self, @@ -69,6 +70,7 @@ class DueDiligenceController(StockBaseController): choices: dict = {c: {} for c in self.controller_choices} choices["load"]["-i"] = {c: {} for c in stocks_helper.INTERVALS} choices["load"]["-s"] = {c: {} for c in stocks_helper.SOURCES} + choices["est"]["-e"] = {c: {} for c in self.ESTIMATE_CHOICES} self.completer = NestedCompleter.from_nested_dict(choices) def print_help(self): @@ -161,13 +163,21 @@ class DueDiligenceController(StockBaseController): description="""Yearly estimates and quarter earnings/revenues. [Source: Business Insider]""", ) - + parser.add_argument( + "-e", + "--estimate", + help="Estimates to get", + dest="estimate", + choices=self.ESTIMATE_CHOICES, + default="annualearnings", + ) ns_parser = self.parse_known_args_and_warn( parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED ) if ns_parser: business_insider_view.estimates( symbol=self.ticker, + estimate=ns_parser.estimate, export=ns_parser.export, ) diff --git a/openbb_terminal/stocks/fundamental_analysis/fa_controller.py b/openbb_terminal/stocks/fundamental_analysis/fa_controller.py index 7cccc53d3df..39529656866 100644 --- a/openbb_terminal/stocks/fundamental_analysis/fa_controller.py +++ b/openbb_terminal/stocks/fundamental_analysis/fa_controller.py @@ -80,6 +80,8 @@ class FundamentalAnalysisController(StockBaseController): PATH = "/stocks/fa/" + SHRS_CHOICES = ["major", "institutional", "mutualfund"] + def __init__( self, ticker: str, @@ -113,6 +115,7 @@ class FundamentalAnalysisController(StockBaseController): choices["cash"]["-p"] = { c: {} for c in stocks_helper.CASH_PLOT[self.default_cash] } + choices["shrs"] = {c: {} for c in self.SHRS_CHOICES} self.completer = NestedCompleter.from_nested_dict(choices) def print_help(self): @@ -573,13 +576,24 @@ class FundamentalAnalysisController(StockBaseController): description="""Print Major, institutional and mutualfunds shareholders. [Source: Yahoo Finance]""", ) + parser.add_argument( + "--holder", + choices=self.SHRS_CHOICES, + default="institutional", + help="Table of holders to get", + dest="holder", + ) + + if other_args and "--holder" not in other_args[0][0]: + other_args.insert(0, "--holder") + ns_parser = self.parse_known_args_and_warn( parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED ) if not self.suffix: if ns_parser: yahoo_finance_view.display_shareholders( - self.ticker, export=ns_parser.export + self.ticker, holder=ns_parser.holder, export=ns_parser.export ) else: console.print("Only US tickers are recognized.", "\n") @@ -857,6 +871,7 @@ class FundamentalAnalysisController(StockBaseController): ratios=ns_parser.ratios, plot=ns_parser.plot, export=ns_parser.export, + limit=ns_parser.limit, ) @log_start_end(log=logger) @@ -955,6 +970,7 @@ class FundamentalAnalysisController(StockBaseController): ratios=ns_parser.ratios, plot=ns_parser.plot, export=ns_parser.export, + limit=ns_parser.limit, ) @log_start_end(log=logger) @@ -1059,6 +1075,7 @@ class FundamentalAnalysisController(StockBaseController): ratios=ns_parser.ratios, plot=ns_parser.plot, export=ns_parser.export, + limit=ns_parser.limit, ) @log_start_end(log=logger) diff --git a/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_model.py b/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_model.py index a9391d6f28f..056b6550c48 100644 --- a/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_model.py +++ b/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_model.py @@ -68,22 +68,20 @@ def get_info(symbol: str) -> pd.DataFrame: @log_start_end(log=logger) -def get_shareholders(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: +def get_shareholders(symbol: str, holder: str = "institutional") -> pd.DataFrame: """Get shareholders from yahoo Parameters ---------- symbol : str Stock ticker symbol + holder : str + Which holder to get table for Returns ------- pd.DataFrame Major holders - pd.DataFrame - Institutional holders - pd.DataFrame - Mutual Fund holders """ stock = yf.Ticker(symbol) @@ -123,7 +121,13 @@ def get_shareholders(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFr lambda x: str(f"{100 * x:.2f}") + " %" ) - return df_major_holders, df_institutional_shareholders, df_mutualfund_shareholders + if holder == "major": + return df_major_holders + if holder == "institutional": + return df_institutional_shareholders + if holder == "mutualfund": + return df_mutualfund_shareholders + return pd.DataFrame() @log_start_end(log=logger) diff --git a/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_view.py b/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_view.py index 98fcbfc2806..734d0a6ca45 100644 --- a/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_view.py +++ b/openbb_terminal/stocks/fundamental_analysis/yahoo_finance_view.py @@ -89,54 +89,34 @@ def display_info(symbol: str, export: str = ""): @log_start_end(log=logger) -def display_shareholders(symbol: str, export: str = ""): +def display_shareholders(symbol: str, holder: str = "institutional", export: str = ""): """Yahoo Finance ticker shareholders Parameters ---------- symbol : str Fundamental analysis ticker symbol + holder: str + Shareholder table to get. Can be major/institutional/mutualfund export: str Format to export data """ - ( - df_major_holders, - df_institutional_shareholders, - df_mutualfund_shareholders, - ) = yahoo_finance_model.get_shareholders(symbol) - df_major_holders.columns = ["", ""] - dfs = [df_major_holders, df_institutional_shareholders, df_mutualfund_shareholders] - titles = ["Major Holders", "Institutional Holders", "Mutual Fund Holders"] - console.print() - - for df, title in zip(dfs, titles): - if "Date Reported" in df.columns: - df["Date Reported"] = df["Date Reported"].apply( - lambda x: x.strftime("%Y-%m-%d") - ) - print_rich_table( - df, - headers=list(df.columns), - show_index=False, - title=f"{symbol.upper()} {title}", + df = yahoo_finance_model.get_shareholders(symbol, holder) + if holder == "major": + df.columns = ["", ""] + if "Date Reported" in df.columns: + df["Date Reported"] = df["Date Reported"].apply( + lambda x: x.strftime("%Y-%m-%d") ) + title = f"{holder.title()} Holders" + print_rich_table( + df, + headers=list(df.columns), + show_index=False, + title=f"{symbol.upper()} {title}", + ) export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "major_holders", - df_major_holders, - ) - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "institutional_holders", - df_institutional_shareholders, - ) - export_data( - export, - os.path.dirname(os.path.abspath(__file__)), - "mutualfunds_holders", - df_major_holders, + export, os.path.dirname(os.path.abspath(__file__)), f"{holder}_holders", df ) @@ -399,7 +379,7 @@ def display_mktcap( def display_fundamentals( symbol: str, statement: str, - limit: int = 120, + limit: int = 12, ratios: bool = False, plot: list = None, export: str = "", @@ -493,7 +473,6 @@ def display_fundamentals( fundamentals.index = fundamentals.index.to_series().apply( lambda x: x.replace("_", " ").title() ) - # Readable numbers fundamentals = fundamentals.applymap(lambda_long_number_format).fillna("-") print_rich_table( @@ -521,10 +500,10 @@ def display_earnings(symbol: str, limit: int, export: str): """ earnings = yahoo_finance_model.get_earnings_history(symbol) - if not earnings: + if earnings.empty: console.print("") return - earnings = earnings.drop(columns={"Symbol", "Company"}) + earnings = earnings.drop(columns={"Symbol", "Company"}).fillna("-") print_rich_table( earnings.head(limit), headers=earnings.columns, diff --git a/openbb_terminal/stocks/government/gov_controller.py b/openbb_terminal/stocks/government/gov_controller.py index d6e7938bca0..a39896d3541 100644 --- a/openbb_terminal/stocks/government/gov_controller.py +++ b/openbb_terminal/stocks/government/gov_controller.py @@ -98,7 +98,7 @@ class GovController(StockBaseController): add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="lasttrades", - description="Last government trading trading. [Source: www.quiverquant.com]", + description="Last government trades. [Source: www.quiverquant.com]", ) parser.add_argument( "-g", diff --git a/openbb_terminal/stocks/government/quiverquant_model.py b/openbb_terminal/stocks/government/quiverquant_model.py index 1557ca7507e..9e26542334a 100644 --- a/openbb_terminal/stocks/government/quiverquant_model.py +++ b/openbb_terminal/stocks/government/quiverquant_model.py @@ -183,7 +183,7 @@ def get_government_buys( DataFrame of top government buy trading """ df_gov = get_government_trading(gov_type) - + print(df_gov) if df_gov.empty: return pd.DataFrame() @@ -192,7 +192,8 @@ def get_government_buys( df_gov["TransactionDate"] = pd.to_datetime(df_gov["TransactionDate"]) - df_gov = df_gov[df_gov["TransactionDate"] > start_date].dropna() + df_gov = df_gov[df_gov["TransactionDate"] > start_date].dropna(axis=1) + # Catch bug where error shown for purchase of >5,000,000 df_gov["Range"] = df_gov["Range"].apply( lambda x: "$5,000,001-$5,000,001" if x == ">$5,000,000" else x diff --git a/openbb_terminal/stocks/government/quiverquant_view.py b/openbb_terminal/stocks/government/quiverquant_view.py index 6a4b658efc7..82b1294c733 100644 --- a/openbb_terminal/stocks/government/quiverquant_view.py +++ b/openbb_terminal/stocks/government/quiverquant_view.py @@ -425,7 +425,7 @@ def display_contracts( title=f"Government Contracts for {symbol.upper()}", ) - else: + if df_contracts.Amount.abs().sum() != 0: # This plot has 1 axis if not external_axes: @@ -446,6 +446,8 @@ def display_contracts( if not external_axes: theme.visualize_output() + if df_contracts.Amount.abs().sum() == 0: + console.print("Contracts found, but they are all equal to $0.00.\n") export_data( export, os.path.dirname(os.path.abspath(__file__)), "contracts", df_contracts ) diff --git a/tests/openbb_terminal/cryptocurrency/overview/txt/test_loanscan_view/test_display_crypto_rates.txt b/tests/openbb_terminal/cryptocurrency/overview/txt/test_loanscan_view/test_display_crypto_rates.txt index 8c1bfb8a04e..1e9c848d58e 100644 --- a/tests/openbb_terminal/cryptocurrency/overview/txt/test_loanscan_view/test_display_crypto_rates.txt +++ b/tests/openbb_terminal/cryptocurrency/overview/txt/test_loanscan_view/test_display_crypto_rates.txt @@ -1,5 +1,5 @@ BTC ETH USDT USDC -ledn 5.25% N/A N/A 8.0% +ledn 5.25% - - 8.0% youhodler 4.91% 5.65% 13.07% 12.73% -blockfi 3.2% 4.5% N/A 8.6% +blockfi 3.2% 4.5% - 8.6% swissborg 0.6% 5.0% 8.0% 8.0% diff --git a/tests/openbb_terminal/stocks/due_diligence/test_business_insider_view.py b/tests/openbb_terminal/stocks/due_diligence/test_business_insider_view.py index 72ceb1095b2..6c4178abe11 100644 --- a/tests/openbb_terminal/stocks/due_diligence/test_business_insider_view.py +++ b/tests/openbb_terminal/stocks/due_diligence/test_business_insider_view.py @@ -61,4 +61,6 @@ def test_price_target_from_analysts_plt(capsys, interval, mocker, start): @pytest.mark.vcr @pytest.mark.record_stdout def test_estimates(): - business_insider_view.estimates(symbol="TSLA", export=None) + business_insider_view.estimates( + symbol="TSLA", estimate="annualearnings", export=None + ) diff --git a/tests/openbb_terminal/stocks/due_diligence/test_dd_controller.py b/tests/openbb_terminal/stocks/due_diligence/test_dd_controller.py index c8864851cbc..128b4cb1d3d 100644 --- a/tests/openbb_terminal/stocks/due_diligence/test_dd_controller.py +++ b/tests/openbb_terminal/stocks/due_diligence/test_dd_controller.py @@ -263,6 +263,7 @@ def test_call_func_expect_queue(expected_queue, queue, func): [], { "symbol": "TSLA", + "estimate": "annualearnings", "export": "", }, ), diff --git a/tests/openbb_terminal/stocks/due_diligence/txt/test_business_insider_view/test_estimates.txt b/tests/openbb_terminal/stocks/due_diligence/txt/test_business_insider_view/test_estimates.txt index f7a10f3d32c..a3336f7ea04 100644 --- a/tests/openbb_terminal/stocks/due_diligence/txt/test_business_insider_view/test_estimates.txt +++ b/tests/openbb_terminal/stocks/due_diligence/txt/test_business_insider_view/test_estimates.txt @@ -27,17 +27,3 @@ Capital Expenditure 7,557 7,377 8,031 7,712 2,000 Selling, General & Admin. Exp. 5,342 6,809 7,023 6,906 5,686 Shareholder’s Equity 44,873 63,057 85,777 96,491 - Total Assets 79,406 101,864 129,230 129,102 - - Previous Quarter Current Quarter Next Quarter Current Year Next Year -QUARTER EARNINGS ESTIMATES -Date ending 03/31/22 ending 06/30/22 ending 09/30/22 ending 12/31/22 ending 12/31/23 -No. of Analysts 31 27 26 38 37 -Average Estimate 2.258 USD 2.198 USD 3.175 USD 12.183 USD 16.115 USD -Year Ago 0.930 USD 1.450 USD 1.860 USD 6.780 USD 12.183 USD -Publish Date 4/20/2022 7/27/2022 10/26/2022 - - - Previous Quarter Current Quarter Next Quarter Current Year Next Year -QUARTER REVENUES ESTIMATES -Date ending 03/31/22 ending 06/30/22 ending 09/30/22 ending 12/31/22 ending 12/31/23 -No. of Analysts 16 14 13 27 26 -Average Estimate 17,869 USD 18,200 USD 22,867 USD 86,858 USD 116,788 USD -Year Ago 10,389 USD 11,958 USD 13,757 USD 53,823 USD 86,858 USD -Publish Date 4/20/2022 7/27/2022 10/26/2022 - - diff --git a/tests/openbb_terminal/stocks/fundamental_analysis/test_fa_controller.py b/tests/openbb_terminal/stocks/fundamental_analysis/test_fa_controller.py index 467d0d8d8bc..9d946c77b97 100644 --- a/tests/openbb_terminal/stocks/fundamental_analysis/test_fa_controller.py +++ b/tests/openbb_terminal/stocks/fundamental_analysis/test_fa_controller.py @@ -356,6 +356,7 @@ def test_call_func_expect_queue(expected_queue, queue, func): ratios=False, plot=None, export="csv", + limit=5, ), ), ( @@ -408,6 +409,7 @@ def test_call_func_expect_queue(expected_queue, queue, func): ratios=False, plot=None, export="csv", + limit=5, ), ), ( @@ -460,6 +462,7 @@ def test_call_func_expect_queue(expected_queue, queue, func): ratios=False, plot=None, export="csv", + limit=5, ), ), ( diff --git a/tests/openbb_terminal/stocks/fundamental_analysis/test_yahoo_finance_model.py b/tests/openbb_terminal/stocks/fundamental_analysis/test_yahoo_finance_model.py index a913a0058df..688e2da448e 100644 --- a/tests/openbb_terminal/stocks/fundamental_analysis/test_yahoo_finance_model.py +++ b/tests/openbb_terminal/stocks/fundamental_analysis/test_yahoo_finance_model.py @@ -39,10 +39,8 @@ def test_call_func(func, recorder): @pytest.mark.vcr def test_get_shareholders(recorder): - major_df, institutional_df, mutual_df = yahoo_finance_model.get_shareholders( - symbol="AAPL" - ) - result_list = [major_df, institutional_df, mutual_df] + df = yahoo_finance_model.get_shareholders(symbol="AAPL", holder="major") + result_list = [df] recorder.capture_list(result_list) diff --git a/tests/openbb_terminal/stocks/fundamental_analysis/txt/test_yahoo_finance_view/test_call_func[display_shareholders].txt b/tests/openbb_terminal/stocks/fundamental_analysis/txt/test_yahoo_finance_view/test_call_func[display_shareholders].txt index 3ac733e8c83..a2484aea199 100644 --- a/tests/openbb_terminal/stocks/fundamental_analysis/txt/test_yahoo_finance_view/test_call_func[display_shareholders].txt +++ b/tests/openbb_terminal/stocks/fundamental_analysis/txt/test_yahoo_finance_view/test_call_func[display_shareholders].txt @@ -1,9 +1,3 @@ - - -0 0.13% Percentage of Shares Held by All Insider -1 76.34% Percentage of Shares Held by Institutions -2 76.44% Percentage of Float Held by Institutions -3 2406 Number of Institutions Holding Shares Holder Shares Date Reported Stake Value 0 Vanguard Group, Inc. (The) 128.605 M 2022-03-30 8.30 % 11.598 B 1 Blackrock Inc. 96.512 M 2022-03-30 6.23 % 8.703 B @@ -15,14 +9,3 @@ 7 GQG Partners LLC 29.967 M 2022-03-30 1.93 % 2.702 B 8 Geode Capital Management, LLC 28.199 M 2022-03-30 1.82 % 2.543 B 9 JP Morgan Chase & Company 25.222 M 2022-03-30 1.63 % 2.275 B - Holder Shares Date Reported Stake Value -0 Vanguard Total Stock Market Index Fund 44.724 M 2022-03-30 2.89 % 4.033 B -1 American Balanced Fund 40.320 M 2022-03-30 2.60 % 3.636 B -2 Vanguard 500 Index Fund 33.916 M 2022-03-30 2.19 % 3.059 B -3 Income Fund of America Inc 30.785 M 2022-04-29 1.99 % 2.776 B -4 Investment Company Of America 30.471 M 2022-03-30 1.97 % 2.748 B -5 Fundamental Investors Inc 26.294 M 2022-03-30 1.70 % 2.371 B -6 Capital Income Builder, Inc. 25.245 M 2022-04-29 1.63 % 2.277 B -7 SPDR S&P 500 ETF Trust 16.812 M 2022-06-29 1.08 % 1.516 B -8 Fidelity 500 Index Fund 16.340 M 2022-05-30 1.05 % 1.474 B -9 Capital World Growth and Income Fund 14.947 M 2022-03-30 0.96 % 1.348 B diff --git a/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func[display_government_buys-kwargs_dict1].txt b/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func[display_government_buys-kwargs_dict1].txt index e69de29bb2d..21ee7a404f2 100644 --- a/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func[display_government_buys-kwargs_dict1].txt +++ b/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func[display_government_buys-kwargs_dict1].txt @@ -0,0 +1,14 @@ + ReportDate TransactionDate ... House Range +0 2022-08-08 2022-08-03 ... Representatives $15,001-$50,000 +1 2022-08-08 2022-08-03 ... Representatives $15,001-$50,000 +2 2022-08-08 2022-07-27 ... Representatives $1,001-$15,000 +3 2022-08-07 2022-07-29 ... Representatives $1,001-$15,000 +4 2022-08-05 2022-08-04 ... Representatives $1,001-$15,000 +.. ... ... ... ... ... +995 2021-10-15 2021-09-30 ... Senate $1,001 - $15,000 +996 2021-10-15 2021-09-30 ... Senate $1,001 - $15,000 +997 2021-10-15 2021-09-30 ... Senate $1,001 - $15,000 +998 2021-10-04 2021-09-28 ... Senate $1,001 - $15,000 +999 2021-10-04 2021-09-28 ... Senate $15,001 - $50,000 + +[1000 rows x 8 columns] diff --git a/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func_empty_df[display_government_buys-kwargs_dict1].txt b/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func_empty_df[display_government_buys-kwargs_dict1].txt index 18bb9e2048b..9baf16836f3 100644 --- a/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func_empty_df[display_government_buys-kwargs_dict1].txt +++ b/tests/openbb_terminal/stocks/government/txt/test_quiverquant_view/test_call_func_empty_df[display_government_buys-kwargs_dict1].txt @@ -1,2 +1,5 @@ +Empty DataFrame +Columns: [] +Index: [] No MOCK_TEXT trading data found diff --git a/website/content/terminal/stocks/dd/est/_index.md b/website/content/terminal/stocks/dd/est/_index.md index 18cf9bc4b5b..131952a5917 100755 --- a/website/content/terminal/stocks/dd/est/_index.md +++ b/website/content/terminal/stocks/dd/est/_index.md @@ -1,105 +1,78 @@ ``` -usage: est [-h] [--export {csv,json,xlsx}] +usage: est [-e {annualrevenue,annualearnings,quarterearnings}] [-h] [--export EXPORT] ``` - Yearly estimates and quarter earnings/revenues. [Source: Business Insider] ``` -optional arguments: +options: + -e {annualrevenue,annualearnings,quarterearnings}, --estimate {annualrevenue,annualearnings,quarterearnings} + Estimates to get -h, --help show this help message - --export {csv,json,xlsx} - Export raw data into csv, json, xlsx + --export EXPORT Export raw data into csv, json, xlsx + +For more information and examples, use 'about est' to access the related guide. ``` Example: ``` -2022 Feb 16, 04:28 (✨) /stocks/dd/ $ est - Annual Earnings Estimates -┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓ -┃ ┃ 2022 ┃ 2023 ┃ 2024 ┃ 2025 ┃ 2026 ┃ -┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩ -│ Revenue │ 198,840 │ 227,368 │ 258,184 │ 304,349 │ 329,924 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Dividend │ - │ - │ 2.57 │ 3.16 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Dividend Yield (in %) │ 0.79 % │ 0.79 % │ 0.86 % │ 1.05 % │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ EPS │ 9.38 │ 10.79 │ 12.56 │ 15.45 │ 18.44 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ P/E Ratio │ 31.96 │ 27.79 │ 23.87 │ 19.40 │ 16.26 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ EBIT │ 84,138 │ 96,475 │ 113,177 │ - │ 147,282 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ EBITDA │ 99,584 │ 115,199 │ 132,683 │ 104,977 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Net Profit │ - │ - │ - │ 96,935 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Net Profit Adjusted │ 70,912 │ 80,815 │ 93,717 │ 96,935 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Pre-Tax Profit │ - │ - │ - │ 113,454 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Net Profit (Adjusted) │ - │ - │ - │ - │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ EPS (Non-GAAP) ex. SOE │ 9.38 │ 10.79 │ 12.56 │ 15.45 │ 18.44 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ EPS (GAAP) │ - │ - │ - │ 17.40 │ 18.27 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Gross Income │ 136,567 │ 155,747 │ 179,297 │ 191,558 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Cash Flow from Investing │ -21,317 │ -29,939 │ -34,696 │ -36,887 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Cash Flow from Operations │ 91,127 │ 107,754 │ 122,969 │ 123,564 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Cash Flow from Financing │ -49,957 │ -49,910 │ -54,405 │ -57,207 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Cash Flow per Share │ 11.46 │ 14.30 │ 16.69 │ - │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Free Cash Flow │ 64,929 │ 76,285 │ 88,074 │ 114,306 │ 136,804 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Free Cash Flow per Share │ 8.48 │ 10.04 │ 11.82 │ 11.77 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Book Value per Share │ 24.31 │ 29.34 │ 36.58 │ - │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Net Debt │ - │ - │ - │ -173,383 │ -228,921 │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Research & Development Exp. │ 23,771 │ 26,576 │ 29,532 │ 32,650 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Capital Expenditure │ - │ - │ - │ 36,887 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Selling, General & Admin. Exp. │ 28,218 │ 31,017 │ 32,224 │ - │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Shareholder’s Equity │ 175,057 │ 214,492 │ 253,332 │ 243,941 │ - │ -├────────────────────────────────┼─────────┼─────────┼─────────┼──────────┼──────────┤ -│ Total Assets │ 368,815 │ 418,601 │ 427,972 │ 400,662 │ - │ -└────────────────────────────────┴─────────┴─────────┴─────────┴──────────┴──────────┘ +2022 Sep 16, 23:24 (🦋) /stocks/dd/ $ est -e annualearnings - Quarterly Earnings Estimates -┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ -┃ ┃ Previous Quarter ┃ Current Quarter ┃ Next Quarter ┃ Current Year ┃ Next Year ┃ -┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ -│ Date │ - │ - │ ending 06/29/22 │ ending 06/29/22 │ ending 06/29/23 │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ No. of Analysts │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Average Estimate │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Year Ago │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Publish Date │ - │ - │ - │ - │ - │ -└──────────────────┴──────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┘ - - Quarterly Revenue Estimates -┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ -┃ ┃ Previous Quarter ┃ Current Quarter ┃ Next Quarter ┃ Current Year ┃ Next Year ┃ -┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ -│ Date │ - │ - │ ending 06/29/22 │ ending 06/29/22 │ ending 06/29/23 │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ No. of Analysts │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Average Estimate │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Year Ago │ - │ - │ - │ - │ - │ -├──────────────────┼──────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤ -│ Publish Date │ - │ - │ - │ - │ - │ -└──────────────────┴──────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┘ -``` + Annual Earnings Estimates +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓ +┃ ┃ 2022 ┃ 2023 ┃ 2024 ┃ 2025 ┃ 2026 ┃ +┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩ +│ Revenue │ 392,623 │ 410,909 │ 430,738 │ 454,433 │ 510,220 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Dividend │ 0.91 │ 0.98 │ 1.05 │ 0.99 │ 0.93 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Dividend Yield (in %) │ 0.60 % │ 0.64 % │ 0.69 % │ 0.65 % │ 0.61 % │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ EPS │ 6.09 │ 6.45 │ 6.86 │ 7.24 │ 7.58 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ P/E Ratio │ 24.91 │ 23.52 │ 22.13 │ 20.97 │ 20.03 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ EBIT │ 118,989 │ 121,191 │ 125,432 │ 128,497 │ 146,245 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ EBITDA │ 130,785 │ 132,990 │ 138,897 │ 149,228 │ 158,983 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Net Profit │ 99,530 │ 101,720 │ 105,647 │ 108,662 │ 124,217 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Net Profit Adjusted │ 100,429 │ 103,715 │ 108,643 │ 117,760 │ 132,601 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Pre-Tax Profit │ 118,535 │ 121,213 │ 126,453 │ 131,656 │ 156,001 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Net Profit (Adjusted) │ 118,256 │ 121,673 │ 129,059 │ 133,883 │ 146,138 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ EPS (Non-GAAP) ex. SOE │ 6.06 │ 6.46 │ 6.95 │ 7.36 │ 8.09 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ EPS (GAAP) │ 6.09 │ 6.45 │ 6.86 │ 7.24 │ 7.58 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Gross Income │ 169,560 │ 176,873 │ 185,487 │ 200,666 │ 221,723 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Cash Flow from Investing │ -19,306 │ -8,376 │ -13,356 │ -10,998 │ -11,108 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Cash Flow from Operations │ 123,476 │ 123,734 │ 134,248 │ 143,306 │ 150,627 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Cash Flow from Financing │ -108,858 │ -90,388 │ -78,773 │ -14,759 │ -15,262 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Cash Flow per Share │ 7.16 │ 7.58 │ 8.58 │ 9.09 │ - │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Free Cash Flow │ 111,277 │ 109,160 │ 114,479 │ 120,309 │ 139,519 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Free Cash Flow per Share │ 6.70 │ 6.85 │ 7.44 │ 7.87 │ 8.52 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Book Value per Share │ 3.55 │ 4.39 │ 5.52 │ 7.90 │ - │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Net Debt │ -56,230 │ -81,452 │ -41,666 │ -174,398 │ -493,690 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Research & Development Exp. │ 26,214 │ 28,913 │ 31,890 │ 38,822 │ 40,837 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Capital Expenditure │ 10,282 │ 11,518 │ 12,409 │ 14,097 │ 11,108 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Selling, General & Admin. Exp. │ 24,911 │ 27,190 │ 28,831 │ 31,789 │ 34,641 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Shareholder’s Equity │ 58,270 │ 74,745 │ 100,755 │ 187,040 │ 472,170 │ +├────────────────────────────────┼──────────┼─────────┼─────────┼──────────┼──────────┤ +│ Total Assets │ 343,493 │ 369,736 │ 419,940 │ 529,449 │ 811,911 │ +└────────────────────────────────┴──────────┴─────────┴─────────┴──────────┴──────────┘ +``` \ No newline at end of file