messari / messari-python-api

Python client for Messari's API
MIT License
89 stars 15 forks source link

Add empty check and chains endpoint #19

Closed akan72 closed 2 years ago

akan72 commented 2 years ago

Summary

New /chains Endpoint

Adding another method to the Defillama class to consume the output from the /chains API endpoint.

This will allow us to programmatically get the TVL and/or names of all protocols for a specific chain.

Sorting the results to ensure that they're returned consistently between runs.

Empty Check for get_chain_tvl_timeseries

When grabbing data from get_chain_tvl_timeseries() for certain chains, the global TVL data can come back empty (ran into this for OntologyEVM)

To fix this, check to see if the global TVL results are empty and return an empty pd.DataFrame before assigning column names.

Tests

New endpoint

image

Results before the check

Screen Shot 2022-06-06 at 3 42 23 PM

Results after the check is added

Screen Shot 2022-06-06 at 3 41 09 PM

get_chain_tvl_timeseries() works for all chains returned when calling the /chains endpoint on Defillama

image
netlify[bot] commented 2 years ago

Deploy Preview for objective-lalande-8ec88b canceled.

Name Link
Latest commit 5695ac6d8652d2e08cae67406286161537510b5a
Latest deploy log https://app.netlify.com/sites/objective-lalande-8ec88b/deploys/62f2dc7d4250350008db78e4