nftpricefloor_view - fix integer division or modulo by zero

This commit is contained in:
Danglewood
2023-07-21 21:22:08 -07:00
committed by Igor Radovanovic
parent 6185159ed4
commit 969d5cee42
2 changed files with 8 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ import logging
import os
from typing import Optional, Union
import pandas as pd
from openbb_terminal import OpenBBFigure, theme
from openbb_terminal.cryptocurrency.cryptocurrency_helpers import read_data_file
from openbb_terminal.cryptocurrency.defi import llama_model
@@ -128,7 +130,7 @@ def display_defi_protocols(
@log_start_end(log=logger)
def display_historical_tvl(
dapps: str = "sushiswap",
dapps: str = "",
export: Optional[str] = "",
sheet_name: Optional[str] = None,
external_axes: bool = False,
@@ -156,6 +158,7 @@ def display_historical_tvl(
if dapp in available_protocols:
df = llama_model.get_defi_protocol(dapp)
df = df.query("`totalLiquidityUSD` > 0")
df.index = pd.DatetimeIndex(df.index.strftime("%Y-%m-%d"))
if not df.empty:
fig.add_scatter(
x=df.index,

View File

@@ -5,6 +5,7 @@ __docformat__ = "numpy"
import logging
import os
import pandas as pd
from typing import Optional, Union
from openbb_terminal import OpenBBFigure, theme
@@ -56,6 +57,9 @@ def display_collections(
fig.set_title("Collections Floor Price" if show_fp else "Collections Sales")
for collection in df["slug"].head(limit).values:
df_collection = nftpricefloor_model.get_floor_price(collection)
df_collection.index = pd.DatetimeIndex(
df_collection.index.rename("date").strftime("%Y-%m-%d")
)
if not df_collection.empty:
values = (
df_collection["floorEth"].values