Created
April 28, 2023 13:53
-
-
Save Evan-Kim2028/e7afdd1e617aa34b85c50471df79d1fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from queryportal.subgraphinterface import SubgraphInterface as sgi | |
import polars as pl | |
pl.Config.set_fmt_str_lengths(200) | |
endpoints = [ | |
'https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-ethereum', | |
'https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-arbitrum', | |
'https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-polygon', | |
'https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-optimism', | |
] | |
# instantiate univ3 class with subgraph key | |
univ3 = sgi(endpoints=endpoints) | |
query_paths = [ | |
'hash', | |
'pool_name', | |
'pool_inputTokenBalances', | |
'pool_fees', # this is a nested struct | |
] | |
for subgraph_name in list(univ3.subject.subgraphs.keys()): | |
print('subgraph_name: ', subgraph_name) | |
df = univ3.query_entity( | |
entity='swaps', | |
name=subgraph_name, | |
query_paths=query_paths | |
) | |
print(df.head(5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment