Sampling Frequency for Price Data

I am looking a POC that can derive the price of a cryptocurrency on the Binance Smart Chain up to 16 months in the past. Regarding this, I have a few questions:

  • What is the sampling frequency for the pricing data. I noticed that, on average, the price data is updated every 4 minutes if I check up to 5000 queries in the past. Is this true? With the paid version of the API, is it possible to get price data for every block (~3 seconds)?
  • How accurate is this pricing data? Some queries to check the historical prices show big spikes in price from one row to the other, are these prices subject to sporadic changes?
1 Like

@gaurav waiting for your reply

We have a little delay in our APIs, check here (https://bloxy.info/status)…however, we are building a new real-time system.

  • How accurate is this pricing data? Some queries to check the historical prices show big spikes in price from one row to the other, are these prices subject to sporadic changes?

Please show us queries and results and how did you verify the problem…

We get market data for different vendors and apply them with dex data. The main thing is here we use one hour candle for market data …and then show prices in DEX trades… … so prices of the past won’t be changes .however if we decide to add more granularity … you will get more granular data…

is this answers your question?

@gaurav thank you for your reply. Is there any documentation on the granularity of the data depending on the timestamp? I assume more recent data has higher granularity.

Regarding the price spikes, this is the query and result.

{
  ethereum(network: bsc) {
    dexTrades(
      baseCurrency: {is: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"}
      quoteCurrency: {is: "0x55d398326f99059ff775485246999027b3197955"}
      options: {asc: ["block.height", "transaction.index"], limit: 10}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      transaction {
        index
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
    }
  }
}

Result:

{
  "ethereum": {
    "dexTrades": [
      {
        "block": {
          "height": 440486,
          "timestamp": {
            "time": "2020-09-13 10:33:58"
          }
        },
        "transaction": {
          "index": 1
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 0.9870299999999957
      },
      {
        "block": {
          "height": 441894,
          "timestamp": {
            "time": "2020-09-13 11:44:22"
          }
        },
        "transaction": {
          "index": 0
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 0.889351298011014
      },
      {
        "block": {
          "height": 444900,
          "timestamp": {
            "time": "2020-09-13 14:14:40"
          }
        },
        "transaction": {
          "index": 1
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.473754147838687
      },
      {
        "block": {
          "height": 445116,
          "timestamp": {
            "time": "2020-09-13 14:25:28"
          }
        },
        "transaction": {
          "index": 0
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.007290100350136
      },
      {
        "block": {
          "height": 445155,
          "timestamp": {
            "time": "2020-09-13 14:27:25"
          }
        },
        "transaction": {
          "index": 2
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.194174399175598
      },
      {
        "block": {
          "height": 445572,
          "timestamp": {
            "time": "2020-09-13 14:48:16"
          }
        },
        "transaction": {
          "index": 0
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 54.32703983278307
      },
      {
        "block": {
          "height": 445612,
          "timestamp": {
            "time": "2020-09-13 14:50:16"
          }
        },
        "transaction": {
          "index": 1
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": **6.248908679122841**
      },
      {
        "block": {
          "height": 445627,
          "timestamp": {
            "time": "2020-09-13 14:51:01"
          }
        },
        "transaction": {
          "index": 4
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": **30.88798047749476**
      },
      {
        "block": {
          "height": 445640,
          "timestamp": {
            "time": "2020-09-13 14:51:40"
          }
        },
        "transaction": {
          "index": 4
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": **40.07092312475807**
      },
      {
        "block": {
          "height": 445659,
          "timestamp": {
            "time": "2020-09-13 14:52:37"
          }
        },
        "transaction": {
          "index": 1
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": **20.638651371935147**
      }
    ]
  }
}

You can see the price of WBNB spikes from ~6USDT to 31USDT in a matter of minutes. Can you please address this issue or explain the underlying problem & solution.

I guess we are showing the correct data

I just added hash in the query so you can look into individual transactions

{
  ethereum(network: bsc) {
    dexTrades(
      baseCurrency: {is: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"}
      quoteCurrency: {is: "0x55d398326f99059ff775485246999027b3197955"}
      options: {asc: ["block.height", "transaction.index"], limit: 10}
    ) {
      block {
        height
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
      }
      transaction {
        index
        hash
      }
      baseCurrency {
        symbol
      }
      quoteCurrency {
        symbol
      }
      quotePrice
    }
  }
}

Now if you see that 6USDT price transaction

Looks at the buy amount and sell amount… It will give you the price of 6USDT.

Using your query with added transaction hash, I get this result

{
  "ethereum": {
    "dexTrades": [
      {
        "block": {
          "height": 440486,
          "timestamp": {
            "time": "2020-09-13 10:33:58"
          }
        },
        "transaction": {
          "index": 1,
          "hash": "0xd87c8679aaae81a7db8a304e68201799d266d66684c1bc110987e6042e3e82a9"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 0.9870299999999957
      },
      {
        "block": {
          "height": 441894,
          "timestamp": {
            "time": "2020-09-13 11:44:22"
          }
        },
        "transaction": {
          "index": 0,
          "hash": "0xeb78ed774a9bfaf4aa399640e02b312880608abdd7b44cd7a49fbd677092af4c"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 0.889351298011014
      },
      {
        "block": {
          "height": 444900,
          "timestamp": {
            "time": "2020-09-13 14:14:40"
          }
        },
        "transaction": {
          "index": 1,
          "hash": "0x116ba21f5fa4ee2b18bede12be493255fb175c3082ce94e863d26f214a25ab82"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.473754147838687
      },
      {
        "block": {
          "height": 445116,
          "timestamp": {
            "time": "2020-09-13 14:25:28"
          }
        },
        "transaction": {
          "index": 0,
          "hash": "0xbee9d449a9ae5b8d7e4376d6c451f2e21c4e28afcc181e7064c707831bd41501"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.007290100350136
      },
      {
        "block": {
          "height": 445155,
          "timestamp": {
            "time": "2020-09-13 14:27:25"
          }
        },
        "transaction": {
          "index": 2,
          "hash": "0x3e3452667a04275408a9bb9478083e2c61e3a907133802b2e62a8bbdaf4fcf7a"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 31.194174399175598
      },
      {
        "block": {
          "height": 445572,
          "timestamp": {
            "time": "2020-09-13 14:48:16"
          }
        },
        "transaction": {
          "index": 0,
          "hash": "0xb5dca7e59b420ddc40d37285c972031f28bb7e3408224bdb1f487097a67752b4"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 54.32703983278307
      },
      {
        "block": {
          "height": 445612,
          "timestamp": {
            "time": "2020-09-13 14:50:16"
          }
        },
        "transaction": {
          "index": 1,
          "hash": "0x96f7e723660c9d32d34a0f914334c45a2d49da5adbbff7a8567f0c72cf0a3251"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 6.248908679122841
      },
      {
        "block": {
          "height": 445627,
          "timestamp": {
            "time": "2020-09-13 14:51:01"
          }
        },
        "transaction": {
          "index": 4,
          "hash": "0xc680256966f99de79bb30011c3f4d954cb2e39813bac3f072246c5acb6dfb28b"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 30.88798047749476
      },
      {
        "block": {
          "height": 445640,
          "timestamp": {
            "time": "2020-09-13 14:51:40"
          }
        },
        "transaction": {
          "index": 4,
          "hash": "0x313febcc758933c51db9dec12b84b677b0bc34ddaa328d337a09d97f65ee1da2"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 40.07092312475807
      },
      {
        "block": {
          "height": 445659,
          "timestamp": {
            "time": "2020-09-13 14:52:37"
          }
        },
        "transaction": {
          "index": 1,
          "hash": "0x1b7515382c251a4f80cb70adbf2b14af39910ff22deb6d2d665be812a0a18c23"
        },
        "baseCurrency": {
          "symbol": "WBNB"
        },
        "quoteCurrency": {
          "symbol": "USDT"
        },
        "quotePrice": 20.638651371935147
      }
    ]
  }
}

Here you can see that the prices for timestamp "2020-09-13 10:33:58" = 0.9870299999999957 which seems incorrect. Also if you look at these consecutive rows for timestamp and price,
"2020-09-13 14:48:16" = 54.32703983278307
"2020-09-13 14:50:16" = 6.248908679122841
"2020-09-13 14:51:01" = 30.88798047749476
"2020-09-13 14:51:40" = 40.07092312475807
There are large fluctuations in price in short periods of time. Can you explain how this works?

If you check the details of the corresponding transaction, using which we calculate the price, you will see we are showing what we are getting.

For example, in the case of 6USDT price, check the following sell and buy amount - tx

in case of 54 USDT - Check this tx

You can check all transactions in a similar way…

is this answer your query?

If not please DM me on Telegram @gaurav_zen

1 Like

This transaction has very low volume. For such transations, the price can be very different from a regular one.
What you can do to filter out such queries are several options to modify your query:

  1. Use filter by minimum amount in USD, say to 100USD minimum by trade
  2. Use price assymetry filter, set. it to 0.5…0.9 and see if it will solve the issue
  3. Filter out specific exchanges from query, or use query by specific exchanges

Hopefully that helps

1 Like

@vaibhav have you got the answer to what you were looking for?

Yes, thank you @sayon

1 Like