How to get OHLC Candle data for DEX?

Hi, I am looking to build charting similar to dex.vision for my app. Currently, I can find any tutorial or documentation that helps with OHLCV directly.
Any tutorial on how to fetch OHLC (open, high, low, close) price data for different timeframe using infra would help. Thanks.

Hey @TradePlan, and welcome to the Infura community! We don’t provide historical gas prices and actually use geth implementation (except on Kovan where geth is not an option) to estimate the gas prices for our methods. There are, however, multiple sites with price data such as this to find the information you’re looking for, just not via Infura.

They might be some confusion @Leiya_Kenney . I didn’t want the gas price. I needed the actual price. For example dex.vision type of price data of coin listed of DEX

Ah, apologies! So are you looking for price data for Ethereum then?

Yes the price data such as open,close,high and low for different time frame.

Got it - that’s not something Infura provides through our API; we provide access to the Ethereum network, but don’t store the prices of Ethereum itself. There are a few options for getting this data, however, such as Coin Telegraph and Kraken.

@Leiya_Kenney that’s not exactly what he is asking if you read his title it’s pretty clear he wants to get OHCLV data from decentralised exchanges like uniswap. I’m actually a bit puzzled how that wasn’t clear from the very start.

@TradePlan i’m not sure if you will be able to get such data from the blockchain via infura because it’s very unlikely a smart contract will be storing OHLCV data from markets as it would be really expensive to do and infura just gives you access to information that’s on the chain.

If you would use INFURA to get information you would have to read all the swaps on the exchange and then build the candles yourself which would be very complicated. In that case you would be better off using something like THE GRAPH to read the SWAPS and build your candles from there, without needing infura at all: https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2

Depending on your use case you might be able rely on a 3rd party, such as coinigy ( there is even a video on youtube about coinigy and uniswap ) or cryptocompare, altough i’m not sure if cryptocompare alerady support dexes…

check their documentation you should be able to find out.

good luck

We don’t provide that information via our API, so @TradePlan will need to get that information elsewhere, correct.