I'm trying to query the entire transaction history of a given pair (e.g. WETH/USDT). Hence, this question is similar to How to get a token pair's uniswap trade history?
My approach is to use the GraphQL Python client and iterate through the transactions using the skip
keyword. In the example below, I'd increment skip by 1000 for every iteration.
query {
swaps(first: 1000, skip: ''' + str(x) + ''', where: {pair: "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852"} orderBy: timestamp, orderDirection: desc) {
transaction {
id
timestamp
}
id
pair {
token0 {
id
symbol
}
token1 {
id
symbol
}
}
amount0In
amount1In
amount0Out
amount1Out
amountUSD
to
}
}
Sadly, this only works for values from 0 to 5000. Does anyone know how to circumvent this issue or knows another way to get the entire transaction history?