Skip to content

Commit

Permalink
Single token address and change param (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkersner authored May 15, 2024
1 parent 2aa795e commit a150d32
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions datamaxi/defillama/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def protocol_mcap(

@postprocess()
def token_price(
self, addresses: Union[str, List[str]] = None, pandas: bool = True
self, address: str, change: bool = False, pandas: bool = True
) -> Union[List, pd.DataFrame]:
"""Get token prices
Expand All @@ -263,16 +263,17 @@ def token_price(
<https://docs.datamaxiplus.com/defillama/token-price>
Args:
addresses (Union[str, List[str]]): single address or multiple addresses
address (str): Token address
change (bool): Return price change (default: False)
pandas (bool): Return data as pandas DataFrame
Returns:
Timeseries of token prices
"""
addresses = make_list(addresses)
check_required_parameter_list(addresses, "addresses")
check_required_parameters([[address, "address"], [change, "change"]])
params = {
"addresses": encode_string_list(addresses),
"address": address,
"change": str(change).lower(),
}
return self.query("/v1/defillama/token", params)

Expand Down

0 comments on commit a150d32

Please sign in to comment.