My objective is to query/download historical swap data. So for example, information like "Wallet A swapped B amount of C token for D token at time E".

I am having a huge amount of trouble obtaining this information.

Uniswap's Subgraph API (going off information here) seems to be the most promising option, but I can't figure out how to use it in Python to obtain the info I need.

Does anyone know any packages that can obtain this info? If not, perhaps some GraphQL tutorials for this purpose?

Any tutorial I find seems focused on trading, whereas I just need to query and download historical data.

Any tips or help would be massively appreciated.

I'm genuinely mind-boggled by how seemingly difficult it is to obtain what feels like basic historical information.

1 Answer 1

Wallet A swapped B amount of C token for D token at time E

This sort of information likely to aim to find the trace of a person (wallet).

From this point of view, we need to have the user's address. When you have the user address, using etherscan, polygonscan, you can find the transaction and parse the data into the your Python's model.

Another approach is from the token info:

  • We need to know the input token and target token.
  • Find the list of pools (paths)
  • Fetch the recent swaps of pools docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.