From e548f7c62dfd195411d7bf64987ac4a9f865b1cf Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Fri, 17 May 2024 13:05:38 +0900 Subject: [PATCH] feat: integrate yield endpoint --- datamaxi/defillama/__init__.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/datamaxi/defillama/__init__.py b/datamaxi/defillama/__init__.py index 324ab65..a158789 100644 --- a/datamaxi/defillama/__init__.py +++ b/datamaxi/defillama/__init__.py @@ -278,13 +278,25 @@ def token_price( } return self.query("/v1/defillama/token", params) - # def yields(self, pools: Union[str, List[str]]=None) -> pd.DataFrame: - # pools = make_list(pools) - # check_required_parameter_list(pools, "pools") - # params = { - # "poolIds": encode_string_list(pools), - # } - # return self.query("/v1/defillama/yield", params) + @postprocess() + def pool_yield(self, poolId: str) -> pd.DataFrame: + """Get yield for given pool + + `GET /v1/defillama/pool/yield` + + + + Args: + poolId (str): Pool ID + + Returns: + Timeseries of yield for given pool + """ + check_required_parameter(poolId, "poolId") + params = { + "poolId": poolId, + } + return self.query("/v1/defillama/pool/yield", params) @postprocess() def stablecoin_mcap(