From 088ca545f113162079f1a53196cf89ad49168476 Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 15 May 2024 15:13:16 +0900 Subject: [PATCH] feat: single token address and `change` param --- datamaxi/defillama/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/datamaxi/defillama/__init__.py b/datamaxi/defillama/__init__.py index d12c8c4..c62bf1c 100644 --- a/datamaxi/defillama/__init__.py +++ b/datamaxi/defillama/__init__.py @@ -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 @@ -263,16 +263,17 @@ def 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)