Various Defi Token PVT Query Via API

does any one know how or where i can query an api for price volume trend (PVT) data or how i might accomplish this. say FEG for example … 0x389999216860ab8e0175387a0c90e5c52522c945

thanks :slight_smile:

so, more info here: we have an app that is using various api’s to pull token data. we have a need now that we need to print our app output on a website next to a coins PVT numerical value. next upgrade we do will contain graphs but is all numerical now. thanks

The Price-Volume-Trend can be deciphered using the following queries

DEX VOLUME PER DAY

{
  ethereum(network: ethereum) {
    dexTrades(
      options: {asc: "date.date"}
      baseCurrency: {is: "0x389999216860ab8e0175387a0c90e5c52522c945"}
      date: {since: "2021-07-01"}
    ) {
      date {
        date(format: "%Y-%m-%d")
      }
      trades_count: count
      baseCurrency {
        symbol
      }
      smartcontracts_count: count(uniq: smart_contracts)
      currency_count: count(uniq: quote_currency)
    }
  }
}

DEX QUOTEPRICE PER DAY

{
  ethereum(network: ethereum) {
    dexTrades(
      options: {asc: "date.date"}
      baseCurrency: {is: "0x389999216860ab8e0175387a0c90e5c52522c945"}
      date: {since: "2021-07-01"}
    ) {
      date {
        date(format: "%Y-%m-%d")
      }
      quotePrice
      quoteCurrency {
        symbol
      }
    }
  }
}

Thanks, @sayon for your excellent response. I, too, am interested in the PVT data, but on BSC and in one of five-minute intervals for the past 24 hours. Do you have any guidance there?

This site mentions a calculation for PVT as follows:

Calculation: The first step to calculate Price volume trend is to find percentage change in the close price:

Change = (Close(today) - Close(yesterday) ) / Close(yesterday)

Price volume trend (PVT) is calculated using following formula:

PVT(today) = Change * Volume(today) + PVT(yesterday)

Based on your response @sayon, it seems this points me in the right direction (for Ethereum) but I’d need more granular data and then I’d have to throw a good deal of math at it. I’d really appreciate any guidance. Sorry if these are basic questions. I’m completely brand new to Bitquery and I’m even struggling to navigate the API docs well via the IDE. Thanks so much!

1 Like

Try this query

{
  ethereum(network: bsc) {
    dexTrades(options: {limit: 10000, desc: "timeInterval.minute"},
      time: {since:"2021-07-30"},
      baseCurrency: {is: "0x6507458bb53aec6be863161641ec28739c41cc97"},
      quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}) {
      timeInterval {
        minute(count: 5)
      }
      baseCurrency {
        symbol
        address
      }
      baseAmount
      quoteCurrency {
        symbol
        address
      }
      tradeAmount(in: USD) 
      trades: count
      price: quotePrice
      volume: quoteAmount
      maximum_price: quotePrice(calculate: maximum)
      minimum_price: quotePrice(calculate: minimum)
      median_price: quotePrice(calculate: median)
      open_price: minimum(of: block get: quote_price)
      close_price: maximum(of: block get: quote_price)
  
    }
  }
}

@haxtuf did this resolve your primary problem?

Hi! No, I’m still stumped. Thanks for reaching out. The problem is that when I use this query to get my source data and apply the formula above, the PVT numbers are very small. In fact they are a tiny fractional number that hovers around zero. However in the “real world”, PVT is a much larger number. So for example, run this query and then look at the results and compare it to poocoin in the same timeframe (with the PVT indicator applied). You’ll see large PVT numbers on poocoin and tiny numbers on bitquery. Then I can’t figure out how to chart my results like poocoin and I can’t easily determine whether or not the bitquery numbers are what I need or if I need to ask for different results.

Thank you for any insight. I’m so confused. :sweat_smile: