Price Index for DEX Tokens

One of the major problems we see in DEX space is that many of the DEX assets do not have trading pairs with some popular DEX currencies such as USDT, WETH(Wrapped Ether), USDC, WBNB (Wrapped BNB), etc.

Or if they have pairs with WETH or WBNB, they do not have pairs with stablecoins such as USDT or USDC.

Besides, most of these pairs don’t have much trade data. Therefore calculating USD price against these unpopular assets is challenging, and if you are trying to create TradingView like charts, then life becomes hell.

Working with DEXs

We have seen this problem faced by many businesses trying to build DEX-related tools.

Today, we will show you how you can use our DEX APIs to get an asset price against any other asset, based on DEX trading data. After that, we will discuss how this same technique can be used to build DEX index pricing.

DEX Asset pricing based on intermediate Currency

In the following query, we will try to get the 1inch token’s price in USDT using WETH as an intermediary currency. In other words, we will use 1inch/WETH and WETH/USDT pair and calculate 1inch/USDT value for a given timeframe.

Once you run the query, you will see OHLC (Open, High, Low, Close) for both pairs (1inch/WETH and WETH/USDT) for a given timeframe. Now, if you multiply OHLC or 1inch/WETH pair and OHLC of WETH/USDT pair, you will get 1inch/USDT price for that timeframe. (Note: Multiply Open with Open price, Low with Low price, and so on).

To make this more interesting, you can avoid specific trades, use trade volume or average quote price, add weight based on currency pair or trade count, etc. Basically, to get a more stable price, you can build your own algorithm. Another way to through more intermediate currencies in the mix, as shown in this example.

DEX Price Index

As we mentioned above, there are many tokens with are not listed on centralized exchanges. Therefore price discovery for those coins is still a huge problem in the DEX space. Using the above method, you can drive the price index. For example, in the following query, we are using the average quote price to get the price of 1inch/USDT pair using WETH as an intermediary asset.

In the following query results, if we multiply averageQuotePrice of 1inch/WETH pair with averageQuotePrice of WETH/1inch pair, we will get the 1inch/USDT pair price.

As mentioned above, to make this price index more robust, you can build your algorithm by using extra data we are giving, such as multiplying averageQuotePrice with trading volume or quote volume to normalize the data. You can avoid trades less than a specific size etc.

We are in the process of building a DEX price index, and if you are interested in it, please contact us at hello@bitquery.io or join our Telegram channel.

You might also be interested in:

About Bitquery

Bitquery is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. Our products are:

  • Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.
  • DEX API provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, Kyber Network, Airswap, Matching Network, etc.

If you have any questions about our products, ask them on our Telegram channel or email us at hello@bitquery.io. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.