Skip to content

Instantly share code, notes, and snippets.

@p-mc2
Created November 17, 2020 18:11
Show Gist options
  • Save p-mc2/1f90c092011b275fd5f3e8f5bbc3bc0a to your computer and use it in GitHub Desktop.
Save p-mc2/1f90c092011b275fd5f3e8f5bbc3bc0a to your computer and use it in GitHub Desktop.
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
sample_transport=RequestsHTTPTransport(
url='https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
verify=True,
retries=5,
)
client = Client(
transport=sample_transport
)
query = gql('''
query {
uniswapFactory(id: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", block: {number: 11276855}) {
totalLiquidityUSD
}
}
''')
response = client.execute(query)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment