mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 14:02:06 +00:00
More Fixes to Crypto + key sort (#3244)
* fix #3095 - autocomplete and command working + key sort * fix #3056 * fix [Bug] bugs #3048 * fix [Bug] bug #3017 * sort -> sortby, not ascend, tests * fix my goof ups Co-authored-by: james <jmaslek11@gmail.com>
This commit is contained in:
@@ -467,7 +467,7 @@ class CryptoController(CryptoBaseController):
|
||||
-l, --limit it displays top N number of records.
|
||||
coins: Shows list of coins available on CoinGecko, CoinPaprika and Binance.If you provide name of
|
||||
coin then in result you will see ids of coins with best match for all mentioned services.
|
||||
If you provide ALL keyword in your search query, then all coins will be displayed. To move over coins you
|
||||
If you provide "ALL" in your coin search query, then all coins will be displayed. To move over coins you
|
||||
can use pagination mechanism with skip, top params. E.g. coins ALL --skip 100 --limit 30 then all coins
|
||||
from 100 to 130 will be displayed. By default skip = 0, limit = 10.
|
||||
If you won't provide source of the data everything will be displayed (CoinGecko, CoinPaprika, Binance).
|
||||
@@ -517,22 +517,24 @@ class CryptoController(CryptoBaseController):
|
||||
EXPORT_ONLY_RAW_DATA_ALLOWED,
|
||||
)
|
||||
# TODO: merge find + display_all_coins
|
||||
if ns_parser and ns_parser.coin:
|
||||
find(
|
||||
query=ns_parser.coin,
|
||||
source=ns_parser.source,
|
||||
key=ns_parser.key,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
display_all_coins(
|
||||
symbol=ns_parser.coin,
|
||||
source=ns_parser.source,
|
||||
limit=ns_parser.limit,
|
||||
skip=ns_parser.skip,
|
||||
show_all=bool("ALL" in other_args),
|
||||
export=ns_parser.export,
|
||||
)
|
||||
if ns_parser:
|
||||
if ns_parser.coin == "ALL":
|
||||
display_all_coins(
|
||||
symbol=ns_parser.coin,
|
||||
source=ns_parser.source,
|
||||
limit=ns_parser.limit,
|
||||
skip=ns_parser.skip,
|
||||
show_all=True,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
else:
|
||||
find(
|
||||
query=ns_parser.coin,
|
||||
source=ns_parser.source,
|
||||
key=ns_parser.key,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_forecast(self, _):
|
||||
|
||||
@@ -136,8 +136,6 @@ class OnchainController(BaseController):
|
||||
"-s": "--since",
|
||||
}
|
||||
choices["ttcp"] = {c: {} for c in bitquery_model.DECENTRALIZED_EXCHANGES}
|
||||
choices["baas"]["-c"] = {c: {} for c in bitquery_model.POSSIBLE_CRYPTOS}
|
||||
choices["baas"]["--coin"] = {c: {} for c in bitquery_model.POSSIBLE_CRYPTOS}
|
||||
choices["balance"] = {
|
||||
"--sort": {c: None for c in ethplorer_model.BALANCE_FILTERS},
|
||||
"-s": "--sort",
|
||||
@@ -235,7 +233,7 @@ class OnchainController(BaseController):
|
||||
choices["ttcp"]["-l"] = "--limit"
|
||||
choices["ttcp"]["--descend"] = {}
|
||||
choices["baas"] = {
|
||||
"--coin": None,
|
||||
"--coin": {c: {} for c in bitquery_model.POSSIBLE_CRYPTOS},
|
||||
"-c": "--coin",
|
||||
"--vs": {c: {} for c in bitquery_model.CURRENCIES},
|
||||
"-vs": "--vs",
|
||||
@@ -1589,7 +1587,6 @@ class OnchainController(BaseController):
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
|
||||
)
|
||||
|
||||
if ns_parser:
|
||||
if ns_parser.coin:
|
||||
if ns_parser.coin in bitquery_model.POSSIBLE_CRYPTOS:
|
||||
@@ -1613,26 +1610,27 @@ class OnchainController(BaseController):
|
||||
n=1,
|
||||
cutoff=0.75,
|
||||
)
|
||||
token = similar_cmd[0]
|
||||
if similar_cmd[0]:
|
||||
console.print(f"Replacing with '{token}'")
|
||||
bitquery_view.display_spread_for_crypto_pair(
|
||||
token=token,
|
||||
to_symbol=ns_parser.vs,
|
||||
days=ns_parser.days,
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=not ns_parser.descend,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
else:
|
||||
similar_cmd = difflib.get_close_matches(
|
||||
ns_parser.coin,
|
||||
bitquery_model.POSSIBLE_CRYPTOS,
|
||||
n=1,
|
||||
cutoff=0.5,
|
||||
)
|
||||
if similar_cmd:
|
||||
console.print(f"Did you mean '{similar_cmd[0]}'?")
|
||||
try:
|
||||
token = similar_cmd[0]
|
||||
if similar_cmd[0]:
|
||||
console.print(f"Replacing with '{token}'")
|
||||
bitquery_view.display_spread_for_crypto_pair(
|
||||
token=token,
|
||||
to_symbol=ns_parser.vs,
|
||||
days=ns_parser.days,
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=not ns_parser.descend,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
except Exception:
|
||||
similar_cmd = difflib.get_close_matches(
|
||||
ns_parser.coin,
|
||||
bitquery_model.POSSIBLE_CRYPTOS,
|
||||
n=1,
|
||||
cutoff=0.5,
|
||||
)
|
||||
if similar_cmd:
|
||||
console.print(f"Did you mean '{similar_cmd[0]}'?")
|
||||
|
||||
else:
|
||||
console.print("You didn't provide coin symbol.\n")
|
||||
|
||||
@@ -272,7 +272,10 @@ def get_coins_market_info(
|
||||
"pct_from_ath",
|
||||
]
|
||||
df = _get_coins_info_helper(symbols=symbols)[cols].sort_values(by="rank")
|
||||
df.sort_values(by=sortby, ascending=ascend)
|
||||
if sortby == "rank":
|
||||
df = df.sort_values(by=sortby, ascending=not ascend)
|
||||
else:
|
||||
df = df.sort_values(by=sortby, ascending=ascend)
|
||||
return df
|
||||
|
||||
|
||||
@@ -329,11 +332,14 @@ def get_list_of_exchanges(
|
||||
lambda x: "\n".join(textwrap.wrap(x, width=28)) if isinstance(x, str) else x
|
||||
)
|
||||
df.rename(
|
||||
columns={"adjusted_rank": "rank", "confidence_score": "confidence"},
|
||||
columns={"adjusted_rank": "Rank", "confidence_score": "confidence"},
|
||||
inplace=True,
|
||||
)
|
||||
df.columns = [x.replace("reported_", "") for x in df.columns]
|
||||
df = df.sort_values(by=sortby, ascending=ascend)
|
||||
if sortby == "Rank":
|
||||
df = df.sort_values(by=sortby, ascending=not ascend)
|
||||
else:
|
||||
df = df.sort_values(by=sortby, ascending=ascend)
|
||||
return df
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,10 @@ class OverviewController(BaseController):
|
||||
"""Constructor"""
|
||||
super().__init__(queue)
|
||||
|
||||
self.combined_filters = (
|
||||
pycoingecko_model.EXCHANGES_FILTERS + coinpaprika_model.EXCHANGES_FILTERS
|
||||
)
|
||||
|
||||
if session and obbff.USE_PROMPT_TOOLKIT:
|
||||
crypto_hack_slugs = rekt_model.get_crypto_hack_slugs()
|
||||
choices: dict = {c: {} for c in self.controller_choices}
|
||||
@@ -116,7 +120,7 @@ class OverviewController(BaseController):
|
||||
choices["cr"]["--type"] = {c: {} for c in ["borrow", "supply"]}
|
||||
choices["cr"]["-t"] = "--type"
|
||||
choices["ch"] = {
|
||||
"--sort": {c: {} for c in rekt_model.HACKS_COLUMNS},
|
||||
"--sortby": {c: {} for c in rekt_model.HACKS_COLUMNS},
|
||||
"--slug": {c: {} for c in crypto_hack_slugs},
|
||||
"-s": "--slug",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
@@ -131,26 +135,23 @@ class OverviewController(BaseController):
|
||||
"--bar": {},
|
||||
}
|
||||
choices["categories"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.CATEGORIES_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in pycoingecko_model.CATEGORIES_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--pie": {},
|
||||
}
|
||||
choices["stables"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.COINS_COLUMNS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in pycoingecko_model.COINS_COLUMNS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
"--pie": {},
|
||||
}
|
||||
choices["exchanges"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.EXCHANGES_FILTERS}
|
||||
if self.ORDERED_LIST_SOURCES_EXCHANGES
|
||||
and self.ORDERED_LIST_SOURCES_EXCHANGES[0] == "CoinGecko"
|
||||
else {c: {} for c in coinpaprika_model.EXCHANGES_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in self.combined_filters},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
@@ -160,30 +161,30 @@ class OverviewController(BaseController):
|
||||
"--source": {c: {} for c in self.ORDERED_LIST_SOURCES_EXCHANGES},
|
||||
}
|
||||
choices["exrates"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.EXRATES_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in pycoingecko_model.EXRATES_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
}
|
||||
choices["indexes"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.INDEXES_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in pycoingecko_model.INDEXES_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
}
|
||||
choices["derivatives"] = {
|
||||
"--sort": {c: {} for c in pycoingecko_model.DERIVATIVES_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in pycoingecko_model.DERIVATIVES_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
}
|
||||
choices["markets"] = {
|
||||
"--vs": {c: {} for c in CURRENCIES},
|
||||
"--sort": {c: {} for c in coinpaprika_model.MARKETS_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in coinpaprika_model.MARKETS_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
@@ -191,8 +192,8 @@ class OverviewController(BaseController):
|
||||
choices["exmarkets"] = {
|
||||
"--exchange": None,
|
||||
"-e": "--exchange",
|
||||
"--sort": {c: {} for c in coinpaprika_model.EXMARKETS_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in coinpaprika_model.EXMARKETS_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
@@ -202,10 +203,10 @@ class OverviewController(BaseController):
|
||||
choices["contracts"] = {
|
||||
c: None for c in get_all_contract_platforms()["platform_id"].tolist()
|
||||
}
|
||||
choices["contracts"]["--sort"] = {
|
||||
choices["contracts"]["--sortby"] = {
|
||||
c: None for c in coinpaprika_model.CONTRACTS_FILTERS
|
||||
}
|
||||
choices["contracts"]["-s"] = "--sort"
|
||||
choices["contracts"]["-s"] = "--sortby"
|
||||
choices["contracts"]["--limit"] = {str(c): {} for c in range(1, 100)}
|
||||
choices["contracts"]["-l"] = "--limit"
|
||||
choices["contracts"]["--descend"] = {}
|
||||
@@ -214,15 +215,15 @@ class OverviewController(BaseController):
|
||||
choices["hm"]["-l"] = "--limit"
|
||||
choices["info"] = {
|
||||
"--vs": {c: {} for c in CURRENCIES},
|
||||
"--sort": {c: {} for c in coinpaprika_model.INFO_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in coinpaprika_model.INFO_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
}
|
||||
choices["pairs"] = {
|
||||
"--sort": {c: {} for c in coinbase_model.PAIRS_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in coinbase_model.PAIRS_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(10, 100)},
|
||||
"-l": "--limit",
|
||||
"--descend": {},
|
||||
@@ -233,8 +234,8 @@ class OverviewController(BaseController):
|
||||
"--filter": {c: {} for c in cryptopanic_model.FILTERS},
|
||||
"--region": {c: {} for c in cryptopanic_model.REGIONS},
|
||||
"-r": "--region",
|
||||
"--sort": {c: {} for c in cryptopanic_model.SORT_FILTERS},
|
||||
"-s": "--sort",
|
||||
"--sortby": {c: {} for c in cryptopanic_model.SORT_FILTERS},
|
||||
"-s": "--sortby",
|
||||
"--descend": {},
|
||||
"--urls": {},
|
||||
"-u": "--urls",
|
||||
@@ -412,7 +413,7 @@ class OverviewController(BaseController):
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
description="""Display list of major crypto-related hacks [Source: https://rekt.news]
|
||||
Can be sorted by {Platform,Date,Amount [$],Audit,Slug,URL} with --sort
|
||||
Can be sorted by {Platform,Date,Amount [$],Audit,Slug,URL} with --sortby
|
||||
and reverse the display order with --descend
|
||||
Show only N elements with --limit
|
||||
Accepts --slug or -s to check individual crypto hack (e.g., -s polynetwork-rekt)
|
||||
@@ -428,7 +429,7 @@ class OverviewController(BaseController):
|
||||
default=15,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: Amount [$]",
|
||||
@@ -744,7 +745,7 @@ class OverviewController(BaseController):
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
description="""Shows top cryptocurrency categories by market capitalization. It includes categories like:
|
||||
stablecoins, defi, solana ecosystem, polkadot ecosystem and many others.
|
||||
You can sort by {}, using --sort parameter""",
|
||||
You can sort by {}, using --sortby parameter""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -758,7 +759,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: market_cap_desc",
|
||||
@@ -797,7 +798,7 @@ class OverviewController(BaseController):
|
||||
Stablecoins are cryptocurrencies that attempt to peg their market value to some external reference
|
||||
like the U.S. dollar or to a commodity's price such as gold.
|
||||
You can display only N number of coins with --limit parameter.
|
||||
You can sort data by {} with --sort""",
|
||||
You can sort data by {} with --sortby""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -811,7 +812,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: market_cap",
|
||||
@@ -906,13 +907,19 @@ class OverviewController(BaseController):
|
||||
@log_start_end(log=logger)
|
||||
def call_exchanges(self, other_args):
|
||||
"""Process exchanges command"""
|
||||
filters = (
|
||||
pycoingecko_model.EXCHANGES_FILTERS + coinpaprika_model.EXCHANGES_FILTERS
|
||||
)
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="exchanges",
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
description="""Shows Top Crypto Exchanges
|
||||
You can display only N number exchanges with --limit parameter.
|
||||
You can sort data by Trust_Score, Id, Name, Country, Year_Established, Trade_Volume_24h_BTC with --sort
|
||||
You can sort data by Trust_Score, Id, Name, Country, Year_Established, Trade_Volume_24h_BTC with --sortby
|
||||
Or you can sort data by 'name', 'currencies', 'markets', 'fiats', 'confidence',
|
||||
'volume_24h', 'volume_7d', 'volume_30d', 'sessions_per_month'
|
||||
if you are using the alternative source CoinPaprika
|
||||
and also with --descend flag to sort descending.
|
||||
Flag --urls will display urls.
|
||||
Displays: Trust_Score, Id, Name, Country, Year_Established, Trade_Volume_24h_BTC""",
|
||||
@@ -929,16 +936,12 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: Rank",
|
||||
default="Rank"
|
||||
if self.ORDERED_LIST_SOURCES_EXCHANGES
|
||||
and self.ORDERED_LIST_SOURCES_EXCHANGES[0] == "CoinGecko"
|
||||
else "rank",
|
||||
choices=pycoingecko_model.EXCHANGES_FILTERS
|
||||
and coinpaprika_model.EXCHANGES_FILTERS,
|
||||
default="Rank",
|
||||
choices=filters,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--descend",
|
||||
@@ -1011,7 +1014,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: Index",
|
||||
@@ -1049,7 +1052,7 @@ class OverviewController(BaseController):
|
||||
Each crypto index is made up of a selection of cryptocurrencies,
|
||||
grouped together and weighted by market cap.
|
||||
You can display only N number of indexes with --limit parameter.
|
||||
You can sort data by Rank, Name, Id, Market, Last, MultiAsset with --sort
|
||||
You can sort data by Rank, Name, Id, Market, Last, MultiAsset with --sortby
|
||||
and also with --descend flag to sort descending.
|
||||
Displays: Rank, Name, Id, Market, Last, MultiAsset
|
||||
""",
|
||||
@@ -1066,7 +1069,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: Rank",
|
||||
@@ -1106,7 +1109,7 @@ class OverviewController(BaseController):
|
||||
The most popular crypto derivatives are crypto futures, crypto options, and perpetual contracts.
|
||||
You can look on only N number of records with --limit,
|
||||
You can sort by Rank, Market, Symbol, Price, Pct_Change_24h, Contract_Type, Basis, Spread, Funding_Rate,
|
||||
Volume_24h with --sort and also with --descend flag to set it to sort descending.
|
||||
Volume_24h with by and also with --descend flag to set it to sort descending.
|
||||
Displays:
|
||||
Rank, Market, Symbol, Price, Pct_Change_24h, Contract_Type, Basis, Spread, Funding_Rate, Volume_24h
|
||||
""",
|
||||
@@ -1123,7 +1126,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: Rank",
|
||||
@@ -1209,7 +1212,7 @@ class OverviewController(BaseController):
|
||||
description="""Show market related (price, supply, volume) coin information for all coins on CoinPaprika.
|
||||
You can display only N number of coins with --limit parameter.
|
||||
You can sort data by rank, name, symbol, price, volume_24h, mcap_change_24h, pct_change_1h, pct_change_24h,
|
||||
ath_price, pct_from_ath, --sort parameter and also with --descend flag to sort descending.
|
||||
ath_price, pct_from_ath, --sortby parameter and also with --descend flag to sort descending.
|
||||
Displays:
|
||||
rank, name, symbol, price, volume_24h, mcap_change_24h,
|
||||
pct_change_1h, pct_change_24h, ath_price, pct_from_ath,
|
||||
@@ -1236,7 +1239,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: rank",
|
||||
@@ -1274,7 +1277,7 @@ class OverviewController(BaseController):
|
||||
description="""Get all exchange markets found for given exchange
|
||||
You can display only N number of records with --limit parameter.
|
||||
You can sort data by pair, base_currency_name, quote_currency_name, market_url, category,
|
||||
reported_volume_24h_share, trust_score --sort parameter and also with --descend flag to sort descending.
|
||||
reported_volume_24h_share, trust_score --sortby parameter and also with --descend flag to sort descending.
|
||||
You can use additional flag --urls to see urls for each market
|
||||
Displays:
|
||||
exchange_id, pair, base_currency_name, quote_currency_name, market_url,
|
||||
@@ -1301,7 +1304,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: reported_volume_24h_share",
|
||||
@@ -1353,7 +1356,7 @@ class OverviewController(BaseController):
|
||||
description="""Show basic coin information for all coins from CoinPaprika API
|
||||
You can display only N number of coins with --limit parameter.
|
||||
You can sort data by rank, name, symbol, price, volume_24h, circulating_supply,
|
||||
total_supply, max_supply, market_cap, beta_value, ath_price --sort parameter
|
||||
total_supply, max_supply, market_cap, beta_value, ath_price --sortby parameter
|
||||
and also with --descend flag to sort descending.
|
||||
|
||||
Displays:
|
||||
@@ -1382,7 +1385,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: rank",
|
||||
@@ -1438,7 +1441,7 @@ class OverviewController(BaseController):
|
||||
description="""Gets all contract addresses for given platform.
|
||||
Provide platform id with -p/--platform parameter
|
||||
You can display only N number of smart contracts with --limit parameter.
|
||||
You can sort data by id, type, active, balance --sort parameter
|
||||
You can sort data by id, type, active, balance --sortby parameter
|
||||
and also with --descend flag to sort descending.
|
||||
|
||||
Displays:
|
||||
@@ -1467,7 +1470,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column",
|
||||
@@ -1519,7 +1522,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: id",
|
||||
@@ -1598,7 +1601,7 @@ class OverviewController(BaseController):
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--sort",
|
||||
"--sortby",
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: published_at",
|
||||
|
||||
@@ -209,7 +209,7 @@ def get_stable_coins(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_exchanges(sortby: str = "name", ascend: bool = False) -> pd.DataFrame:
|
||||
def get_exchanges(sortby: str = "Rank", ascend: bool = True) -> pd.DataFrame:
|
||||
"""Get list of top exchanges from CoinGecko API [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -249,7 +249,10 @@ def get_exchanges(sortby: str = "name", ascend: bool = False) -> pd.DataFrame:
|
||||
"Url",
|
||||
]
|
||||
create_df_index(df, "Rank")
|
||||
df = df.sort_values(by=sortby, ascending=ascend)
|
||||
if sortby == "Rank":
|
||||
df = df.sort_values(by=sortby, ascending=not ascend)
|
||||
else:
|
||||
df = df.sort_values(by=sortby, ascending=ascend)
|
||||
return df
|
||||
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ def display_categories(
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_exchanges(
|
||||
sortby: str = "name",
|
||||
sortby: str = "Rank",
|
||||
ascend: bool = False,
|
||||
limit: int = 15,
|
||||
links: bool = False,
|
||||
|
||||
@@ -82,6 +82,9 @@ API_DICT: Dict = {
|
||||
"stocksera": "STOCKSERA",
|
||||
}
|
||||
|
||||
# sorting api key section by name
|
||||
API_DICT = dict(sorted(API_DICT.items()))
|
||||
|
||||
|
||||
class KeyStatus(str, Enum):
|
||||
"""Class to handle status messages and colors"""
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
Rank Trust_Score Id Name Country Year_Established Trade_Volume_24h_BTC
|
||||
0 1 10.0 binance Binance Cayman Islands 2017.0 1192179.768168
|
||||
1 2 10.0 ftx_spot FTX Antigua and Barbuda 2019.0 156286.013644
|
||||
2 3 10.0 okex OKX Belize 2013.0 143218.301919
|
||||
3 4 10.0 gdax Coinbase Exchange United States 2012.0 134642.761023
|
||||
4 5 10.0 bybit_spot Bybit None 2018.0 95859.900953
|
||||
5 6 10.0 gate Gate.io Hong Kong None 65909.352994
|
||||
6 7 10.0 huobi Huobi Global Seychelles 2013.0 49046.455566
|
||||
7 8 10.0 bitfinex Bitfinex British Virgin Islands 2014.0 48037.709355
|
||||
8 9 10.0 kraken Kraken United States 2011.0 44096.918333
|
||||
9 10 10.0 binance_us Binance US United States 2019.0 39782.517362
|
||||
10 11 10.0 ftx_us FTX.US United States 2020.0 20603.912069
|
||||
11 12 10.0 crypto_com Crypto.com Exchange Cayman Islands 2019.0 19917.375949
|
||||
12 13 10.0 gemini Gemini United States 2014.0 6615.439516
|
||||
13 14 9.0 mxc MEXC Global None 2018.0 258068.479716
|
||||
14 15 9.0 ftx_tr FTX TR Turkey None 139774.569945
|
||||
Rank Trust_Score Id Name Country Year_Established Trade_Volume_24h_BTC
|
||||
249 250 5.0 yoshi_exchange_bsc Yoshi.exchange (BSC) None None 0.923042
|
||||
248 249 5.0 sphynx_brise Sphynx (Brise) None None 1.080215
|
||||
247 248 5.0 solarflare Solarflare None None 1.095427
|
||||
246 247 5.0 wigoswap Wigoswap None 2022.0 1.142818
|
||||
245 246 5.0 glide_finance Glide Finance None None 1.211922
|
||||
244 245 5.0 milkyswap-milkada MilkySwap None 2022.0 1.233885
|
||||
243 244 5.0 elk_finance_bsc Elk Finance (BSC) None None 1.251304
|
||||
242 243 5.0 sphynx_swap Sphynx Swap (BSC) None None 1.278942
|
||||
241 242 5.0 crodex Crodex None None 1.342047
|
||||
240 241 5.0 diffusion Diffusion Finance None 2022.0 1.385367
|
||||
239 240 5.0 zenlink_moonbeam Zenlink (Moonbeam) None None 1.431943
|
||||
238 239 5.0 kuswap Kuswap None 2021.0 1.610176
|
||||
237 238 6.0 radioshack_bsc RadioShack (BSC) None None 1.639109
|
||||
236 237 5.0 sushiswap_harmony Sushiswap (Harmony) None None 1.761501
|
||||
235 236 5.0 pegasys Pegasys None None 1.786929
|
||||
|
||||
Reference in New Issue
Block a user