mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-25 18:53:26 +00:00
* Add separate view for finbrain for crypto curreny sentiment analysis * Move json with symbols to separate directory, little refactoring, update readme * Add screenshot of finbrain for PolkaDot * Coinbase menu added * Add more methods for coinbase * Add coinbase views, coinbase models. Add coinbase to load, chart, find commands. Add coinbase to controller * Add auth client for coinbase pro endpoints that needs auth * Add more views for coinbase to crypto menu * Add some print tests for Coinbase view * Add 2 more tests for coinbase view * Update README with Coinbase API keys * Cleaning empty lines, spaces etc. * Use os.path.join in imports, change column names in one normalized df * Move Coinbase to portfolio brokers. Adjust tests, and imports * precommit config return to prev ver * Fix coinbase accounts command, del column filter for deposits
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
"""Coinbase view"""
|
|
__docformat__ = "numpy"
|
|
|
|
import os
|
|
|
|
from tabulate import tabulate
|
|
from gamestonk_terminal.helper_funcs import export_data
|
|
from gamestonk_terminal import feature_flags as gtff
|
|
from gamestonk_terminal.cryptocurrency.overview import coinbase_model
|
|
from gamestonk_terminal.helper_funcs import long_number_format
|
|
|
|
|
|
def display_trading_pairs(top: int, sortby: str, descend: bool, export: str) -> None:
|
|
"""Displays a list of available currency pairs for trading. [Source: Coinbase]
|
|
|
|
Parameters
|
|
----------
|
|
top: int
|
|
Top n of pairs
|
|
sortby: str
|
|
Key to sortby data
|
|
descend: bool
|
|
Sort descending flag
|
|
export : str
|
|
Export dataframe data to csv,json,xlsx file
|
|
"""
|
|
|
|
df = coinbase_model.get_trading_pairs()
|
|
df_data = df.copy()
|
|
|
|
for col in [
|
|
"base_min_size",
|
|
"base_max_size",
|
|
"min_market_funds",
|
|
"max_market_funds",
|
|
]:
|
|
df[col] = df[col].apply(lambda x: long_number_format(x))
|
|
|
|
df = df.sort_values(by=sortby, ascending=descend).head(top)
|
|
|
|
if gtff.USE_TABULATE_DF:
|
|
print(
|
|
tabulate(
|
|
df,
|
|
headers=df.columns,
|
|
floatfmt=".2f",
|
|
showindex=False,
|
|
tablefmt="fancy_grid",
|
|
),
|
|
"\n",
|
|
)
|
|
else:
|
|
print(df.to_string, "\n")
|
|
|
|
export_data(
|
|
export,
|
|
os.path.dirname(os.path.abspath(__file__)),
|
|
"pairs",
|
|
df_data,
|
|
)
|