What is the format / notation / units of price and liquidity data for tick entity in uniswap API?

  Kiến thức lập trình

I am pulling liquidity pool data from the uniswap API and I don’t recognize the format or notation of the numbers that are being generated. Here is the code for ETH/USDT on uniswap v3:

import requests

query = """
{
  pool(id: "0x11b815efb8f581194ae79006d24e0d814b7697f6") { 
    ticks(first: 1000) {
      tickIdx
      price0
    }
  }
}
"""
url = "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3"
response = requests.post(url, json={'query': query})

If you run this code you will see Price0 is a variety of extremely tiny numbers and extremely large numbers, none of which are close to the current price of ETH / USDT (around 3850 at time of writing).

I thought it was Q64.96 notation at first but it can’t be, because some of the numbers are tiny? Or perhaps I am misunderstanding the notation.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT