Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix onchain issues #2466

Merged
merged 11 commits into from
Aug 30, 2022
30 changes: 24 additions & 6 deletions openbb_terminal/cryptocurrency/onchain/bitquery_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from openbb_terminal.cryptocurrency.dataframe_helpers import (
lambda_very_long_number_formatter,
)
from openbb_terminal.cryptocurrency.dataframe_helpers import (
prettify_column_names,
)
from openbb_terminal.cryptocurrency.onchain import bitquery_model
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import export_data, print_rich_table
Expand Down Expand Up @@ -58,7 +61,10 @@ def display_dex_trades(
if not df.empty:
df_data = df.copy()

df[["tradeAmount", "trades"]] = df[["tradeAmount", "trades"]].applymap(
column_names = ["tradeAmount", "trades"]
column_names = prettify_column_names(column_names)

df[column_names] = df[column_names].applymap(
lambda x: lambda_very_long_number_formatter(x)
)

Expand Down Expand Up @@ -184,7 +190,11 @@ def display_dex_volume_for_token(
)
if not df.empty:
df_data = df.copy()
df[["tradeAmount", "trades"]] = df[["tradeAmount", "trades"]].applymap(

column_names = ["tradeAmount", "trades"]
column_names = prettify_column_names(column_names)

df[column_names] = df[column_names].applymap(
lambda x: lambda_very_long_number_formatter(x)
)

Expand Down Expand Up @@ -238,9 +248,13 @@ def display_ethereum_unique_senders(

df = bitquery_model.get_ethereum_unique_senders(interval, limit, sortby, ascend)
if not df.empty:
df[["uniqueSenders", "transactions", "maximumGasPrice"]] = df[
["uniqueSenders", "transactions", "maximumGasPrice"]
].applymap(lambda x: lambda_very_long_number_formatter(x))

column_names = ["uniqueSenders", "transactions", "maximumGasPrice"]
column_names = prettify_column_names(column_names)

df[column_names] = df[column_names].applymap(
lambda x: lambda_very_long_number_formatter(x)
)

df_data = df.copy()

Expand Down Expand Up @@ -295,7 +309,11 @@ def display_most_traded_pairs(
)
if not df.empty:
df_data = df.copy()
df[["tradeAmount", "trades"]] = df[["tradeAmount", "trades"]].applymap(

column_names = ["tradeAmount", "trades"]
column_names = prettify_column_names(column_names)

df[column_names] = df[column_names].applymap(
lambda x: lambda_very_long_number_formatter(x)
)

Expand Down
6 changes: 3 additions & 3 deletions openbb_terminal/cryptocurrency/onchain/onchain_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ def call_hr(self, other_args: List[str]):
display_hashrate(
symbol=ns_parser.coin,
interval=ns_parser.interval,
since=int(datetime.timestamp(ns_parser.since)),
until=int(datetime.timestamp(ns_parser.until)),
start_date=int(datetime.timestamp(ns_parser.since)),
end_date=int(datetime.timestamp(ns_parser.until)),
export=ns_parser.export,
)

Expand Down Expand Up @@ -1107,7 +1107,7 @@ def call_tv(self, other_args: List[str]):

if ns_parser:
bitquery_view.display_dex_volume_for_token(
token=ns_parser.coin,
symbol=ns_parser.coin,
trade_amount_currency=ns_parser.vs,
top=ns_parser.limit,
sortby=ns_parser.sortby,
Expand Down
6 changes: 5 additions & 1 deletion openbb_terminal/cryptocurrency/onchain/whale_alert_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ def display_whales_transactions(
Export dataframe data to csv,json,xlsx file
"""

df = whale_alert_model.get_whales_transactions(min_value, sortby, ascend)
df = whale_alert_model.get_whales_transactions(
min_value=min_value,
sortby=sortby,
ascend=ascend,
)

if df.empty:
console.print("Failed to retrieve data.")
Expand Down