Skip to content

Commit

Permalink
Integrate yield endpoint (#17)
Browse files Browse the repository at this point in the history
* feat: integrate yield endpoint

* feat: add yield pandas parameter
  • Loading branch information
martinkersner authored May 17, 2024
1 parent 8dae1d8 commit 6dfd7f2
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions datamaxi/defillama/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,26 @@ 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, pandas: bool = True) -> Union[List, pd.DataFrame]:
"""Get yield for given pool
`GET /v1/defillama/pool/yield`
<https://docs.datamaxiplus.com/defillama/yield>
Args:
poolId (str): Pool ID
pandas (bool): Return data as pandas DataFrame
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(
Expand Down

0 comments on commit 6dfd7f2

Please sign in to comment.