diff --git a/openbb_terminal/economy/economy_controller.py b/openbb_terminal/economy/economy_controller.py index be417eb5bdd..d37cf2462fb 100644 --- a/openbb_terminal/economy/economy_controller.py +++ b/openbb_terminal/economy/economy_controller.py @@ -41,6 +41,7 @@ from openbb_terminal.helper_funcs import ( EXPORT_ONLY_RAW_DATA_ALLOWED, print_rich_table, valid_date, + parse_and_split_input, ) from openbb_terminal.parent_classes import BaseController from openbb_terminal.rich_config import console, MenuText @@ -314,6 +315,22 @@ class EconomyController(BaseController): self.completer = NestedCompleter.from_nested_dict(self.choices) # type: ignore + def parse_input(self, an_input: str) -> List: + """Parse controller input + + Overrides the parent class function to handle github org/repo path convention. + See `BaseController.parse_input()` for details. + """ + # Filtering out sorting parameters with forward slashes like P/E + sort_filter = r"((\ -s |\ --sortby ).*?(P\/E|Fwd P\/E|P\/S|P\/B|P\/C|P\/FCF)*)" + + custom_filters = [sort_filter] + + commands = parse_and_split_input( + an_input=an_input, custom_filters=custom_filters + ) + return commands + def update_runtime_choices(self): if session and obbff.USE_PROMPT_TOOLKIT: if not self.fred_query.empty: diff --git a/openbb_terminal/keys_model.py b/openbb_terminal/keys_model.py index 361efc85151..608fbfa25d7 100644 --- a/openbb_terminal/keys_model.py +++ b/openbb_terminal/keys_model.py @@ -175,7 +175,6 @@ def get_keys_info() -> Dict[str, List[str]]: def set_key(env_var_name: str, env_var_value: str, persist: bool = False) -> None: """Set API key. - Parameters ---------- env_var_name: str @@ -201,13 +200,11 @@ def set_key(env_var_name: str, env_var_value: str, persist: bool = False) -> Non def get_keys(show: bool = False) -> pd.DataFrame: """Get currently set API keys. - Parameters ---------- show: bool Flag to choose whether to show actual keys or not. By default, False. - Returns: pd.DataFrame: currents keys """ @@ -237,7 +234,6 @@ def get_keys(show: bool = False) -> pd.DataFrame: def set_av_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Alpha Vantage key - Parameters ---------- key: str @@ -248,11 +244,9 @@ def set_av_key(key: str, persist: bool = False, show_output: bool = False) -> st By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_KEY_ALPHAVANTAGE", key, persist) @@ -261,16 +255,13 @@ def set_av_key(key: str, persist: bool = False, show_output: bool = False) -> st def check_av_key(show_output: bool = False) -> str: """Check Alpha Vantage key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_KEY_ALPHAVANTAGE == "REPLACE_ME": # pragma: allowlist secret @@ -295,7 +286,6 @@ def check_av_key(show_output: bool = False) -> str: def set_fmp_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Financial Modeling Prep key - Parameters ---------- key: str @@ -306,11 +296,9 @@ def set_fmp_key(key: str, persist: bool = False, show_output: bool = False) -> s By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_KEY_FINANCIALMODELINGPREP", key, persist) @@ -319,16 +307,13 @@ def set_fmp_key(key: str, persist: bool = False, show_output: bool = False) -> s def check_fmp_key(show_output: bool = False) -> str: """Check Financial Modeling Prep key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if ( @@ -358,7 +343,6 @@ def check_fmp_key(show_output: bool = False) -> str: def set_quandl_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Quandl key - Parameters ---------- key: str @@ -369,11 +353,9 @@ def set_quandl_key(key: str, persist: bool = False, show_output: bool = False) - By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_KEY_QUANDL", key, persist) @@ -382,16 +364,13 @@ def set_quandl_key(key: str, persist: bool = False, show_output: bool = False) - def check_quandl_key(show_output: bool = False) -> str: """Check Quandl key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_KEY_QUANDL == "REPLACE_ME": # pragma: allowlist secret @@ -415,7 +394,6 @@ def check_quandl_key(show_output: bool = False) -> str: def set_polygon_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Polygon key - Parameters ---------- key: str @@ -426,11 +404,9 @@ def set_polygon_key(key: str, persist: bool = False, show_output: bool = False) By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_POLYGON_KEY", key, persist) @@ -439,16 +415,13 @@ def set_polygon_key(key: str, persist: bool = False, show_output: bool = False) def check_polygon_key(show_output: bool = False) -> str: """Check Polygon key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_POLYGON_KEY == "REPLACE_ME": @@ -477,7 +450,6 @@ def check_polygon_key(show_output: bool = False) -> str: def set_fred_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set FRED key - Parameters ---------- key: str @@ -488,11 +460,9 @@ def set_fred_key(key: str, persist: bool = False, show_output: bool = False) -> By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_FRED_KEY", key, persist) @@ -501,16 +471,13 @@ def set_fred_key(key: str, persist: bool = False, show_output: bool = False) -> def check_fred_key(show_output: bool = False) -> str: """Check FRED key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_FRED_KEY == "REPLACE_ME": @@ -538,7 +505,6 @@ def check_fred_key(show_output: bool = False) -> str: def set_news_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set News key - Parameters ---------- key: str @@ -549,11 +515,9 @@ def set_news_key(key: str, persist: bool = False, show_output: bool = False) -> By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_NEWS_TOKEN", key, persist) @@ -562,16 +526,13 @@ def set_news_key(key: str, persist: bool = False, show_output: bool = False) -> def check_news_key(show_output: bool = False) -> str: """Check News key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_NEWS_TOKEN == "REPLACE_ME": # nosec @@ -599,7 +560,6 @@ def check_news_key(show_output: bool = False) -> str: def set_tradier_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Tradier key - Parameters ---------- key: str @@ -610,11 +570,9 @@ def set_tradier_key(key: str, persist: bool = False, show_output: bool = False) By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_TRADIER_TOKEN", key, persist) @@ -623,16 +581,13 @@ def set_tradier_key(key: str, persist: bool = False, show_output: bool = False) def check_tradier_key(show_output: bool = False) -> str: """Check Tradier key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_TRADIER_TOKEN == "REPLACE_ME": # nosec @@ -665,7 +620,6 @@ def check_tradier_key(show_output: bool = False) -> str: def set_cmc_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Coinmarketcap key - Parameters ---------- key: str @@ -676,11 +630,9 @@ def set_cmc_key(key: str, persist: bool = False, show_output: bool = False) -> s By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_CMC_KEY", key, persist) @@ -689,16 +641,13 @@ def set_cmc_key(key: str, persist: bool = False, show_output: bool = False) -> s def check_cmc_key(show_output: bool = False) -> str: """Check Coinmarketcap key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_CMC_KEY == "REPLACE_ME": @@ -723,7 +672,6 @@ def check_cmc_key(show_output: bool = False) -> str: def set_finnhub_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Finnhub key - Parameters ---------- key: str @@ -734,11 +682,9 @@ def set_finnhub_key(key: str, persist: bool = False, show_output: bool = False) By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_FINNHUB_KEY", key, persist) @@ -747,16 +693,13 @@ def set_finnhub_key(key: str, persist: bool = False, show_output: bool = False) def check_finnhub_key(show_output: bool = False) -> str: """Check Finnhub key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_FINNHUB_KEY == "REPLACE_ME": @@ -784,7 +727,6 @@ def check_finnhub_key(show_output: bool = False) -> str: def set_iex_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set IEX Cloud key - Parameters ---------- key: str @@ -795,11 +737,9 @@ def set_iex_key(key: str, persist: bool = False, show_output: bool = False) -> s By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_IEX_TOKEN", key, persist) @@ -808,16 +748,13 @@ def set_iex_key(key: str, persist: bool = False, show_output: bool = False) -> s def check_iex_key(show_output: bool = False) -> str: """Check IEX Cloud key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_IEX_TOKEN == "REPLACE_ME": # nosec @@ -850,7 +787,6 @@ def set_reddit_key( show_output: bool = False, ) -> str: """Set Reddit key - Parameters ---------- client_id: str @@ -864,11 +800,9 @@ def set_reddit_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_REDDIT_CLIENT_ID", client_id, persist) @@ -882,16 +816,13 @@ def set_reddit_key( def check_reddit_key(show_output: bool = False) -> str: """Check Reddit key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ reddit_keys = [ @@ -943,7 +874,6 @@ def check_reddit_key(show_output: bool = False) -> str: def set_bitquery_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Bitquery key - Parameters ---------- key: str @@ -954,11 +884,9 @@ def set_bitquery_key(key: str, persist: bool = False, show_output: bool = False) By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_BITQUERY_KEY", key, persist) @@ -967,16 +895,13 @@ def set_bitquery_key(key: str, persist: bool = False, show_output: bool = False) def check_bitquery_key(show_output: bool = False) -> str: """Check Bitquery key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ bitquery = cfg.API_BITQUERY_KEY @@ -1017,7 +942,6 @@ def set_twitter_key( show_output: bool = False, ) -> str: """Set Twitter key - Parameters ---------- key: str @@ -1029,11 +953,9 @@ def set_twitter_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_TWITTER_KEY", key, persist) @@ -1045,16 +967,13 @@ def set_twitter_key( def check_twitter_key(show_output: bool = False) -> str: """Check Twitter key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ twitter_keys = [ @@ -1099,7 +1018,6 @@ def set_rh_key( show_output: bool = False, ) -> str: """Set Robinhood key - Parameters ---------- username: str @@ -1110,11 +1028,9 @@ def set_rh_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_RH_USERNAME", username, persist) @@ -1125,16 +1041,13 @@ def set_rh_key( def check_rh_key(show_output: bool = False) -> str: """Check Robinhood key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ rh_keys = [cfg.RH_USERNAME, cfg.RH_PASSWORD] @@ -1159,7 +1072,6 @@ def set_degiro_key( show_output: bool = False, ) -> str: """Set Degiro key - Parameters ---------- username: str @@ -1171,11 +1083,9 @@ def set_degiro_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_DG_USERNAME", username, persist) @@ -1187,16 +1097,13 @@ def set_degiro_key( def check_degiro_key(show_output: bool = False) -> str: """Check Degiro key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ dg_keys = [cfg.DG_USERNAME, cfg.DG_PASSWORD, cfg.DG_TOTP_SECRET] @@ -1221,7 +1128,6 @@ def set_oanda_key( show_output: bool = False, ) -> str: """Set Oanda key - Parameters ---------- account: str @@ -1233,11 +1139,9 @@ def set_oanda_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_OANDA_ACCOUNT", account, persist) @@ -1249,16 +1153,13 @@ def set_oanda_key( def check_oanda_key(show_output: bool = False) -> str: """Check Oanda key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ oanda_keys = [cfg.OANDA_TOKEN, cfg.OANDA_ACCOUNT] @@ -1294,7 +1195,6 @@ def set_binance_key( show_output: bool = False, ) -> str: """Set Binance key - Parameters ---------- key: str @@ -1305,11 +1205,9 @@ def set_binance_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_BINANCE_KEY", key, persist) @@ -1320,16 +1218,13 @@ def set_binance_key( def check_binance_key(show_output: bool = False) -> str: """Check Binance key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if "REPLACE_ME" in [cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET]: @@ -1358,7 +1253,6 @@ def set_si_key( show_output: bool = False, ) -> str: """Set Sentimentinvestor key. - Parameters ---------- key: str @@ -1368,11 +1262,9 @@ def set_si_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_SENTIMENTINVESTOR_TOKEN", key, persist) @@ -1382,17 +1274,13 @@ def set_si_key( def check_si_key(show_output: bool = False) -> str: """Check Sentimentinvestor key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - - """ si_keys = [cfg.API_SENTIMENTINVESTOR_TOKEN] @@ -1429,7 +1317,6 @@ def set_coinbase_key( show_output: bool = False, ) -> str: """Set Coinbase key - Parameters ---------- key: str @@ -1441,11 +1328,9 @@ def set_coinbase_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_COINBASE_KEY", key, persist) @@ -1457,16 +1342,13 @@ def set_coinbase_key( def check_coinbase_key(show_output: bool = False) -> str: """Check Coinbase key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if "REPLACE_ME" in [ @@ -1501,7 +1383,6 @@ def check_coinbase_key(show_output: bool = False) -> str: def set_walert_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Walert key - Parameters ---------- key: str @@ -1512,11 +1393,9 @@ def set_walert_key(key: str, persist: bool = False, show_output: bool = False) - By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_WHALE_ALERT_KEY", key, persist) @@ -1525,16 +1404,13 @@ def set_walert_key(key: str, persist: bool = False, show_output: bool = False) - def check_walert_key(show_output: bool = False) -> str: """Check Walert key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_WHALE_ALERT_KEY == "REPLACE_ME": @@ -1567,7 +1443,6 @@ def set_glassnode_key( key: str, persist: bool = False, show_output: bool = False ) -> str: """Set Glassnode key. - Parameters ---------- key: str @@ -1578,11 +1453,9 @@ def set_glassnode_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_GLASSNODE_KEY", key, persist) @@ -1591,16 +1464,13 @@ def set_glassnode_key( def check_glassnode_key(show_output: bool = False) -> str: """Check Glassnode key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_GLASSNODE_KEY == "REPLACE_ME": @@ -1635,7 +1505,6 @@ def set_coinglass_key( key: str, persist: bool = False, show_output: bool = False ) -> str: """Set Coinglass key. - Parameters ---------- key: str @@ -1646,11 +1515,9 @@ def set_coinglass_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_COINGLASS_KEY", key, persist) @@ -1659,16 +1526,13 @@ def set_coinglass_key( def check_coinglass_key(show_output: bool = False) -> str: """Check Coinglass key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_COINGLASS_KEY == "REPLACE_ME": @@ -1699,7 +1563,6 @@ def check_coinglass_key(show_output: bool = False) -> str: def set_cpanic_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Cpanic key. - Parameters ---------- key: str @@ -1710,11 +1573,9 @@ def set_cpanic_key(key: str, persist: bool = False, show_output: bool = False) - By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_CRYPTO_PANIC_KEY", key, persist) @@ -1723,16 +1584,13 @@ def set_cpanic_key(key: str, persist: bool = False, show_output: bool = False) - def check_cpanic_key(show_output: bool = False) -> str: """Check Cpanic key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_CRYPTO_PANIC_KEY == "REPLACE_ME": @@ -1759,7 +1617,6 @@ def set_ethplorer_key( key: str, persist: bool = False, show_output: bool = False ) -> str: """Set Ethplorer key. - Parameters ---------- key: str @@ -1770,11 +1627,9 @@ def set_ethplorer_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_ETHPLORER_KEY", key, persist) @@ -1783,16 +1638,13 @@ def set_ethplorer_key( def check_ethplorer_key(show_output: bool = False) -> str: """Check Ethplorer key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_ETHPLORER_KEY == "REPLACE_ME": @@ -1824,7 +1676,6 @@ def set_smartstake_key( key: str, access_token: str, persist: bool = False, show_output: bool = False ): """Set Smartstake key. - Parameters ---------- key: str @@ -1837,11 +1688,9 @@ def set_smartstake_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_SMARTSTAKE_KEY", key, persist) @@ -1851,16 +1700,13 @@ def set_smartstake_key( def check_smartstake_key(show_output: bool = False) -> str: """Check Smartstake key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if "REPLACE_ME" in [ @@ -1905,7 +1751,6 @@ def check_smartstake_key(show_output: bool = False) -> str: def set_github_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set GitHub key. - Parameters ---------- key: str @@ -1916,11 +1761,9 @@ def set_github_key(key: str, persist: bool = False, show_output: bool = False) - By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_GITHUB_KEY", key, persist) @@ -1929,16 +1772,13 @@ def set_github_key(key: str, persist: bool = False, show_output: bool = False) - def check_github_key(show_output: bool = False) -> str: """Check GitHub key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_GITHUB_KEY == "REPLACE_ME": # pragma: allowlist secret @@ -1957,7 +1797,6 @@ def check_github_key(show_output: bool = False) -> str: def set_messari_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Messari key. - Parameters ---------- key: str @@ -1968,11 +1807,9 @@ def set_messari_key(key: str, persist: bool = False, show_output: bool = False) By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_MESSARI_KEY", key, persist) @@ -1981,16 +1818,13 @@ def set_messari_key(key: str, persist: bool = False, show_output: bool = False) def check_messari_key(show_output: bool = False) -> str: """Check Messari key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if ( @@ -2020,7 +1854,6 @@ def check_messari_key(show_output: bool = False) -> str: def set_eodhd_key(key: str, persist: bool = False, show_output: bool = False) -> str: """Set Eodhd key. - Parameters ---------- key: str @@ -2031,11 +1864,9 @@ def set_eodhd_key(key: str, persist: bool = False, show_output: bool = False) -> By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_EODHD_KEY", key, persist) @@ -2044,16 +1875,13 @@ def set_eodhd_key(key: str, persist: bool = False, show_output: bool = False) -> def check_eodhd_key(show_output: bool = False) -> str: """Check Eodhd key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_EODHD_KEY == "REPLACE_ME": # nosec @@ -2079,7 +1907,6 @@ def set_santiment_key( key: str, persist: bool = False, show_output: bool = False ) -> str: """Set Santiment key. - Parameters ---------- key: str @@ -2090,11 +1917,9 @@ def set_santiment_key( By default, False. show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ set_key("OPENBB_API_SANTIMENT_KEY", key, persist) @@ -2103,16 +1928,13 @@ def set_santiment_key( def check_santiment_key(show_output: bool = False) -> str: """Check Santiment key - Parameters ---------- show_output: bool Display status string or not. By default, False. - Returns ------- status: str - """ if cfg.API_SANTIMENT_KEY == "REPLACE_ME":