Search code examples
pythonsubgraphuniswap

Reading the price of multiple Uniswap tokens using Python


I'm quite a beginner and I'm doing a Python bot which is comparing prices on exchanges, it is easy and obvious to do it with REST API for CEXs but it's not obvious at all how to fetch prices for Uniswap. Could anybody please tell me what is the most efficient way of getting actual prices for a lot of tokens? One by one - I guess it is not the case cuz it takes a lot of time. Is it possible somehow to fetch actual prices for 1000 tokens at once? Like you can do it with REST API for usual exchanges. Is there any instruments for that? I would be really grateful for any advice, I don't even know where to look.

I tried it with Uniswap Subgraph V3 but it seems that it is not something that is going to work out for me cuz the prices given there for particular pools ignore the liquidity fact and it is actual only for 1 token swap. And it you need to get like 100 tokens - it would be completely different number in fact.


Solution

  • Trading Strategy has datasets for Uniswap v2 (and compatible) and Uniswap v3 pools

    Disclaimer: I am the author