使用Python读取多个Uniswap代币的价格

huangapple go评论77阅读模式
英文:

Reading the price of multiple Uniswap tokens using Python

问题

我是一个相当初学者,正在制作一个Python机器人,用于比较交易所的价格,使用REST API来比较中心化交易所(CEXs)的价格非常容易明了。但是如何获取Uniswap的价格却一点也不明了。请问有人能告诉我获取大量代币的实际价格的最有效方法是什么吗?一一获取可能不适用,因为会耗费大量时间。是否有可能一次获取1000个代币的实际价格?就像你可以使用常规交易所的REST API一样。有什么工具可以做到这一点吗?我会非常感激任何建议,我甚至不知道从哪里开始。

我尝试使用Uniswap Subgraph V3,但似乎不适用于我,因为其中给出的特定池子价格忽略了流动性因素,只适用于1个代币的交换。如果你需要获取100个代币,实际价格将完全不同。

英文:

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.

答案1

得分: 0

交易策略具有Uniswap v2(和兼容的版本)和Uniswap v3池的数据集。

免责声明:我是作者。

英文:

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

Disclaimer: I am the author

huangapple
  • 本文由 发表于 2023年4月7日 01:34:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952292.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定