mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
Fixing crytpo/ov/stables bugs (#3333)
* fixing cgstables bug * edit Co-authored-by: james <jmaslek11@gmail.com>
This commit is contained in:
@@ -91,6 +91,17 @@ class OverviewController(BaseController):
|
||||
|
||||
ORDERED_LIST_SOURCES_EXCHANGES = get_ordered_list_sources(f"{PATH}exchanges")
|
||||
|
||||
STABLES_CHOICES = [
|
||||
"Symbol",
|
||||
"Name",
|
||||
"Price_[$]",
|
||||
"Market_Cap_[$]",
|
||||
"Market_Cap_Rank",
|
||||
"Change_7d_[%]",
|
||||
"Change_24h_[%]",
|
||||
"Volume_[$]",
|
||||
]
|
||||
|
||||
def __init__(self, queue: List[str] = None):
|
||||
"""Constructor"""
|
||||
super().__init__(queue)
|
||||
@@ -141,8 +152,9 @@ class OverviewController(BaseController):
|
||||
"-l": "--limit",
|
||||
"--pie": {},
|
||||
}
|
||||
|
||||
choices["stables"] = {
|
||||
"--sortby": {c: {} for c in pycoingecko_model.COINS_COLUMNS},
|
||||
"--sortby": {c: {} for c in self.STABLES_CHOICES},
|
||||
"-s": "--sortby",
|
||||
"--limit": {str(c): {} for c in range(1, 100)},
|
||||
"-l": "--limit",
|
||||
@@ -765,8 +777,8 @@ class OverviewController(BaseController):
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: market_cap_desc",
|
||||
default=pycoingecko_model.SORT_VALUES[0],
|
||||
choices=pycoingecko_model.SORT_VALUES,
|
||||
# default=pycoingecko_model.SORT_VALUES[0],
|
||||
# choices=pycoingecko_model.SORT_VALUES,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -818,13 +830,12 @@ class OverviewController(BaseController):
|
||||
dest="sortby",
|
||||
type=str,
|
||||
help="Sort by given column. Default: market_cap",
|
||||
default="market_cap",
|
||||
choices=pycoingecko_model.COINS_COLUMNS,
|
||||
default="Market_Cap_[$]",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--descend",
|
||||
action="store_false",
|
||||
action="store_true",
|
||||
help="Flag to sort in descending order (lowest first)",
|
||||
dest="descend",
|
||||
default=False,
|
||||
|
||||
@@ -356,7 +356,17 @@ def display_stablecoins(
|
||||
pie : bool
|
||||
Whether to show a pie chart
|
||||
"""
|
||||
|
||||
sort_mapping = {
|
||||
"Symbol": "symbol",
|
||||
"Name": "name",
|
||||
"Price_[$]": "current_price",
|
||||
"Market_Cap_[$]": "market_cap",
|
||||
"Market_Cap_Rank": "market_cap_rank",
|
||||
"Change_7d_[%]": "price_change_percentage_7d_in_currency",
|
||||
"Change_24h_[%]": "price_change_percentage_24h_in_currency",
|
||||
"Volume_[$]": "total_volume",
|
||||
}
|
||||
sortby = sort_mapping[sortby]
|
||||
df = gecko.get_stable_coins(limit, sortby=sortby, ascend=ascend)
|
||||
|
||||
if not df.empty:
|
||||
@@ -372,13 +382,13 @@ def display_stablecoins(
|
||||
"Price [$]",
|
||||
"Market Cap [$]",
|
||||
"Market Cap Rank",
|
||||
"Change 24h [%]",
|
||||
"Change 7d [%]",
|
||||
"Change 24h [%]",
|
||||
"Volume [$]",
|
||||
f"Percentage [%] of top {limit}",
|
||||
],
|
||||
axis=1,
|
||||
inplace=False,
|
||||
copy=False,
|
||||
)
|
||||
df = df.applymap(lambda x: lambda_long_number_format_with_type_check(x))
|
||||
if pie:
|
||||
|
||||
Reference in New Issue
Block a user