diff options
author | Chavithra PARANA <chavithra@gmail.com> | 2022-12-03 22:14:28 +0100 |
---|---|---|
committer | Chavithra PARANA <chavithra@gmail.com> | 2022-12-03 22:14:28 +0100 |
commit | 01aaf2e2f77532842b7e1ae6f950b745ad423673 (patch) | |
tree | 4e149ff740f7d78a81aa929b976f310d1159716e | |
parent | 663b6ce5fe03b0d790cee05d4b1b915febde80c4 (diff) | |
parent | faca7ab67d1ce5d0ae0e5c862332bcfc37f72ea9 (diff) |
Merge branch 'main' of github.com:OpenBB-finance/OpenBBTerminal
29 files changed, 2071 insertions, 1111 deletions
diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 6d913a6a20a..ff320231b5f 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -13,10 +13,10 @@ jobs: - name: Git checkout uses: actions/checkout@v3 # actions/checkout v3.0.2 - - name: Setup Python 3.10 + - name: Setup Python 3.9 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.9" architecture: x64 - name: Install Poetry diff --git a/openbb_terminal/cryptocurrency/due_diligence/ccxt_model.py b/openbb_terminal/cryptocurrency/due_diligence/ccxt_model.py index abb14ad0347..64dd7550fa2 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/ccxt_model.py +++ b/openbb_terminal/cryptocurrency/due_diligence/ccxt_model.py @@ -2,8 +2,10 @@ __docformat__ = "numpy" from typing import Any, Dict, List + import ccxt import pandas as pd + from openbb_terminal.cryptocurrency.dataframe_helpers import prettify_column_names @@ -37,10 +39,45 @@ def get_binance_currencies() -> List[str]: # Refactor this eventually to allow for any entered exchange - # right now only works on default binace for "ob" and "trades" - exchange = ccxt.binance({"fetchCurrencies": True}) - exchange.load_markets() - currencies = exchange.quoteCurrencies - return [c["code"] for c in currencies.values()] + + # Commented out for now, since binance started blocking requests + # exchange = ccxt.binance({"fetchCurrencies": True}) + # exchange.load_markets() + # currencies = exchange.quoteCurrencies + # return [c["code"] for c in currencies.values()] + return [ + "AUD", + "BIDR", + "BKRW", + "BNB", + "BRL", + "BTC", + "BUSD", + "BVND", + "DAI", + "DOGE", + "DOT", + "ETH", + "EUR", + "GBP", + "IDRT", + "NGN", + "PAX", + "PLN", + "RUB", + "TRX", + "TRY", + "TUSD", + "UAH", + "USDC", + "USDP", + "USDS", + "USDT", + "UST", + "VAI", + "XRP", + "ZAR", + ] def get_orderbook(exchange: str, symbol: str, to_symbol: str) -> Dict[str, Any]: diff --git a/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py b/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py index 371390d53df..be2cad10d98 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py +++ b/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py @@ -229,42 +229,41 @@ class DueDiligenceController(CryptoBaseController): def call_nonzero(self, other_args: List[str]): """Process nonzero command""" - if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="nonzero", - description=""" - Display addresses with nonzero assets in a certain blockchain - [Source: https://glassnode.org] - Note that free api keys only allow fetching data with a 1y lag - """, - ) - - parser.add_argument( - "-s", - "--since", - dest="since", - type=valid_date, - help="Initial date. Default: 2 years ago", - default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), - ) + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="nonzero", + description=""" + Display addresses with nonzero assets in a certain blockchain + [Source: https://glassnode.org] + Note that free api keys only allow fetching data with a 1y lag + """, + ) - parser.add_argument( - "-u", - "--until", - dest="until", - type=valid_date, - help="Final date. Default: 1 year ago", - default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-s", + "--since", + dest="since", + type=valid_date, + help="Initial date. Default: 2 years ago", + default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), + ) - ns_parser = self.parse_known_args_and_warn( - parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) + parser.add_argument( + "-u", + "--until", + dest="until", + type=valid_date, + help="Final date. Default: 1 year ago", + default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), + ) - if ns_parser: + ns_parser = self.parse_known_args_and_warn( + parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES + ) + if ns_parser: + if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: glassnode_view.display_non_zero_addresses( symbol=self.symbol.upper(), start_date=ns_parser.since.strftime("%Y-%m-%d"), @@ -272,8 +271,8 @@ class DueDiligenceController(CryptoBaseController): export=ns_parser.export, ) - else: - console.print("Glassnode source does not support this symbol\n") + else: + console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]") @log_start_end(log=logger) def call_stats(self, other_args): @@ -308,52 +307,50 @@ class DueDiligenceController(CryptoBaseController): @log_start_end(log=logger) def call_active(self, other_args: List[str]): """Process active command""" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="active", + description=""" + Display active blockchain addresses over time + [Source: https://glassnode.org] + """, + ) - if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="active", - description=""" - Display active blockchain addresses over time - [Source: https://glassnode.org] - """, - ) - - parser.add_argument( - "-i", - "--interval", - dest="interval", - type=str, - help="Frequency interval. Default: 24h", - default="24h", - choices=glassnode_model.INTERVALS_ACTIVE_ADDRESSES, - ) - - parser.add_argument( - "-s", - "--since", - dest="since", - type=valid_date, - help="Initial date. Default: 1 year ago", - default=(datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-i", + "--interval", + dest="interval", + type=str, + help="Frequency interval. Default: 24h", + default="24h", + choices=glassnode_model.INTERVALS_ACTIVE_ADDRESSES, + ) - parser.add_argument( - "-u", - "--until", - dest="until", - type=valid_date, - help="Final date. Default: Today", - default=(datetime.now()).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-s", + "--since", + dest="since", + type=valid_date, + help="Initial date. Default: 1 year ago", + default=(datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d"), + ) - ns_parser = self.parse_known_args_and_warn( - parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) + parser.add_argument( + "-u", + "--until", + dest="until", + type=valid_date, + help="Final date. Default: Today", + default=(datetime.now()).strftime("%Y-%m-%d"), + ) - if ns_parser: + ns_parser = self.parse_known_args_and_warn( + parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES + ) + if ns_parser: + if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: glassnode_view.display_active_addresses( symbol=self.symbol.upper(), interval=ns_parser.interval, @@ -361,64 +358,61 @@ class DueDiligenceController(CryptoBaseController): end_date=ns_parser.until.strftime("%Y-%m-%d"), export=ns_parser.export, ) - - else: - console.print("Glassnode source does not support this symbol\n") + else: + console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]") @log_start_end(log=logger) def call_change(self, other_args: List[str]): """Process change command""" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="change", + description=""" + Display active blockchain addresses over time + [Source: https://glassnode.org] + Note that free api keys only allow fetching data with a 1y lag + """, + ) - if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="change", - description=""" - Display active blockchain addresses over time - [Source: https://glassnode.org] - Note that free api keys only allow fetching data with a 1y lag - """, - ) - - parser.add_argument( - "-e", - "--exchange", - dest="exchange", - type=str, - help="Exchange to check change. Default: aggregated", - default="aggregated", - choices=glassnode_model.GLASSNODE_SUPPORTED_EXCHANGES, - ) - - parser.add_argument( - "-s", - "--since", - dest="since", - type=valid_date, - help="Initial date. Default: 2 years ago", - default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-e", + "--exchange", + dest="exchange", + type=str, + help="Exchange to check change. Default: aggregated", + default="aggregated", + choices=glassnode_model.GLASSNODE_SUPPORTED_EXCHANGES, + ) - parser.add_argument( - "-u", - "--until", - dest="until", - type=valid_date, - help="Final date. Default: 1 year ago", - default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-s", + "--since", + dest="since", + type=valid_date, + help="Initial date. Default: 2 years ago", + default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), + ) - if other_args: - if not other_args[0][0] == "-": - other_args.insert(0, "-e") + parser.add_argument( + "-u", + "--until", + dest="until", + type=valid_date, + help="Final date. Default: 1 year ago", + default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), + ) - ns_parser = self.parse_known_args_and_warn( - parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) + if other_args: + if not other_args[0][0] == "-": + other_args.insert(0, "-e") - if ns_parser: + ns_parser = self.parse_known_args_and_warn( + parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES + ) + if ns_parser: + if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: glassnode_view.display_exchange_net_position_change( symbol=self.symbol.upper(), exchange=ns_parser.exchange, @@ -426,71 +420,70 @@ class DueDiligenceController(CryptoBaseController): end_date=ns_parser.until.strftime("%Y-%m-%d"), export=ns_parser.export, ) - else: - console.print("Glassnode source does not support this symbol\n") + else: + console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]") @log_start_end(log=logger) def call_eb(self, other_args: List[str]): """Process eb command""" - if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: - parser = argparse.ArgumentParser( - add_help=False, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="eb", - description=""" - Display active blockchain addresses over time - [Source: https://glassnode.org] - Note that free api keys only allow fetching data with a 1y lag - """, - ) - - parser.add_argument( - "-p", - "--pct", - dest="percentage", - action="store_true", - help="Show percentage instead of stacked value. Default: False", - default=False, - ) + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="eb", + description=""" + Display active blockchain addresses over time + [Source: https://glassnode.org] + Note that free api keys only allow fetching data with a 1y lag + """, + ) - parser.add_argument( - "-e", - "--exchange", - dest="exchange", - type=str, - help="Exchange to check change. Default: aggregated", - default="aggregated", - choices=glassnode_model.GLASSNODE_SUPPORTED_EXCHANGES, - ) + parser.add_argument( + "-p", + "--pct", + dest="percentage", + action="store_true", + help="Show percentage instead of stacked value. Default: False", + default=False, + ) - parser.add_argument( - "-s", - "--since", - dest="since", - type=valid_date, - help="Initial date. Default: 2 years ago", - default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-e", + "--exchange", + dest="exchange", + type=str, + help="Exchange to check change. Default: aggregated", + default="aggregated", + choices=glassnode_model.GLASSNODE_SUPPORTED_EXCHANGES, + ) - parser.add_argument( - "-u", - "--until", - dest="until", - type=valid_date, - help="Final date. Default: 1 year ago", - default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), - ) + parser.add_argument( + "-s", + "--since", + dest="since", + type=valid_date, + help="Initial date. Default: 2 years ago", + default=(datetime.now() - timedelta(days=365 * 2)).strftime("%Y-%m-%d"), + ) - if other_args and not other_args[0][0] == "-": - other_args.insert(0, "-e") + parser.add_argument( + "-u", + "--until", + dest="until", + type=valid_date, + help="Final date. Default: 1 year ago", + default=(datetime.now() - timedelta(days=367)).strftime("%Y-%m-%d"), + ) - ns_parser = self.parse_known_args_and_warn( - parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES - ) + if other_args and not other_args[0][0] == "-": + other_args.insert(0, "-e") - if ns_parser: + ns_parser = self.parse_known_args_and_warn( + parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES + ) + if ns_parser: + if self.symbol.upper() in glassnode_model.GLASSNODE_SUPPORTED_ASSETS: glassnode_view.display_exchange_balances( symbol=self.symbol.upper(), exchange=ns_parser.exchange, @@ -499,9 +492,8 @@ class DueDiligenceController(CryptoBaseController): percentage=ns_parser.percentage, export=ns_parser.export, ) - - else: - console.print("Glassnode source does not support this symbol\n") + else: + console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]") @log_start_end(log=logger) def call_oi(self, other_args): diff --git a/openbb_terminal/economy/economy_controller.py b/openbb_terminal/economy/economy_controller.py index 152a705de89..b8f774afb18 100644 --- a/openbb_terminal/economy/economy_controller.py +++ b/openbb_terminal/economy/economy_controller.py @@ -31,7 +31,6 @@ from openbb_terminal.economy import ( yfinance_model, yfinance_view, investingcom_model, - investingcom_view, plot_view, commodity_view, ) @@ -661,6 +660,7 @@ class EconomyController(BaseController): "--query", type=str, action="store", + nargs="+", dest="query", help="Query the FRED database to obtain Series IDs given the query search term.", ) @@ -675,9 +675,8 @@ class EconomyController(BaseController): ) if ns_parser: parameters = list_from_str(ns_parser.parameter.upper()) - if ns_parser.query: - query = ns_parser.query.replace(",", " ") + query = " ".join(ns_parser.query) df_search = fred_model.get_series_notes(search_query=query) if not df_search.empty: @@ -1006,16 +1005,6 @@ class EconomyController(BaseController): " at different maturities.", ) parser.add_argument( - "-c", - "--country", - action="store", - dest="country", - default="united_states", - choices=investingcom_model.BOND_COUNTRIES, - help="Yield curve for a country. Ex: united_states", - ) - - parser.add_argument( "-d", "--date", type=valid_date, @@ -1030,106 +1019,16 @@ class EconomyController(BaseController): raw=True, ) if ns_parser: - country = ns_parser.country.lower().replace("_", " ") - if country == "united states": - fred_view.display_yield_curve( - date=ns_parser.date.strftime("%Y-%m-%d") - if ns_parser.date - else None, - raw=ns_parser.raw, - export=ns_parser.export, |