1

I am relatively new to decentralised development, and apologies in advance if a bit of a dumb question.

I am doing a project where I am looking to download the following data. I am trying to figure out what is the best way to do it and a bit lost with available options.

  • Current yield on ETH deposits
  • Reward token mechanism for providing
  • USDC/USDT pair liquidity
  • Size of liquidity pool for USDC/USDT pair
  • Historical daily closing price data for ETH

I am using Golang and looking to pool data from Uniswap, Curve, Balancer, and Aave to compare it.

Options I have considered are:

  • TheGraph + Golang through JSON: all of these pools have a subgraph. Disadvantage is data is in different format for each pool and availability is different. For example I can pull size of liquidity pools from Uniswap, but not from Balancer
  • Custom API: Uniswap has a full on Javascript API which is very good. Disadvantage is that Curve doesn't have a comparable API and this presents an integration issue using several different languages for pulling data
  • Straight from the blockchain using Solidity: I've not really been able to figure out how to pull this data since some of it is not specific to an exact smart contract.

Would really appreciate any help, if you could point me in the right direction on where to look.

Thank you very much!

6
  • I have done this but for ALL Uniswap pairs and Balancer pools in Golang, and the way I did it is by reading contract events.
    – Nulik
    Commented Feb 15, 2021 at 14:29
  • so I would recommend to calculate ETHUSD price by averaging DAI and USDC swaps , both of them. Otherwise you would get a small skew
    – Nulik
    Commented Feb 15, 2021 at 14:30
  • got it, that is very helpful, thank you! Commented Feb 18, 2021 at 16:07
  • how do you actually read contract events? Like do you have a solidity script that looks up the nearest transaction to a particular date in array? Like for say 17-Feb-21 23:59, for 16-Feb-21 23:59 etc? I ended up just downloading historicals from Uniswap Graph API for now rather than the blockchain directly, seems easier for now. Commented Feb 18, 2021 at 16:08
  • you can read events by FilterLogs() api RPC function in go-ethereum/ethclient
    – Nulik
    Commented Feb 18, 2021 at 23:55

0

Your Answer

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