Cover Image for A marriage of Market data with Blockchain data

A marriage of Market data with Blockchain data

Community

Blockchains don’t have any outside data. It means blockchains don’t know the fiat price of any asset or token. However, fiat data makes blockchain analytics more meaningful.

For example, it is easier to understand that today’s average bitcoin fee was $1.5 rather than it was 0.00003323 BTC.

Our motto at Bitquery is “Adding meaning to Blockchain data.” Therefore providing market data with our Onchain APIs was on our road map for a long time.

Today I am happy to tell you that we have added market data to our Ethereum dataset. Therefore now you can get fiat valued in our APIs when you query Ethereum data.

Market data will be helpful for many use cases, such as USD-based DEX or token analysis.

How to get blockchain values in Fiat?

Let’s also understand how you can get USD based data using our APIs.

You need to add (in: USD) against any value for which you want a USD amount. For example, in the following query, we are adding (in: USD) against the tradeAmount .

In addition, you can also get these values in USDT and ETH. For example: tradeAmount(in: USDT) or tradeAmount(in: ETH).


Here are a few more query examples with USD data.

Note: Checkout our GraphQL playground, we are making some improvements to make it easy to work with Blockchain data APIs. Another important thing to remember is that, you can use GraphQL queries as API.

Top DEX trades in USD

The following query gives you the top DEX trades based on USD value.

{
  ethereum(network: ethereum) {
    dexTrades(
      options: { desc: ["block.height", "tradeIndex"], limit: 10, offset: 0 }
      time: { since: "2023-07-17T00:00:00", till: "2023-07-17T23:59:59" }
    ) {
      block {
        timestamp {
          time(format: "%Y-%m-%d %H:%M:%S")
        }
        height
      }
      tradeIndex
      protocol
      exchange {
        fullName
      }
      smartContract {
        address {
          address
          annotation
        }
      }
      buyAmount
      buyCurrency {
        address
        symbol
      }
      buy_amount_usd: buyAmount(in: USD)
      sellAmount
      sellCurrency {
        address
        symbol
      }
      sell_amount_usd: sellAmount(in: USD)
      transaction {
        hash
      }
      PriceInUSD1: expression(get: "buy_amount_usd / buyAmount")
      PriceInUSD2: expression(get: "sell_amount_usd / buyAmount")
    }
  }
}

Top DEX trades by Gas value in USD

The query below gives you trades with the highest Gas spent.

query MyQuery {
  ethereum {
    dexTrades(
      date: { after: "2023-10-10" }
      options: { desc: "gasValue", limit: 10 }
    ) {
      block {
        timestamp {
          iso8601
        }
      }
      gasValue(in: USD)
      side
      taker {
        address
      }
      transaction {
        hash
      }
    }
  }
}

USD based metrics on Biquery explorer

We also added some USD based metrics on explorer to show how market data enriches the blockchain data.

DEX market share

The following image shows to DEX market share based on trade volume.

DEX Trading Volume

Ethereum miners reward in USD

The query below shows the Ethereum miner rewards in USD.

query MyQuery {
  ethereum {
    blocks(
      date: { after: "2023-10-10" }
      options: { desc: "timestamp.iso8601", limit: 10 }
    ) {
      timestamp {
        iso8601
      }
      reward(in: USD)
    }
  }
}

DEX traded currencies

The following image shows the top DEX currencies based on trading volume.

Pair Trading Volume

We believe mixing market data with blockchain data will help many analysts looking to build custom blockchain analytics. If you have any questions please, join our Telegram group and let us know.

You might also be interested in:

About Bitquery

Bitquery is your comprehensive toolkit designed with developers in mind, simplifying blockchain data access. Our products offer practical advantages and flexibility.

  • APIs - Explore API: Easily retrieve precise real-time and historical data for over 40 blockchains using GraphQL. Seamlessly integrate blockchain data into your applications, making data-driven decisions effortless.

  • Coinpath® - Try Coinpath: Streamline compliance and crypto investigations by tracing money movements across 40+ blockchains. Gain insights for efficient decision-making.

  • Data in Cloud - Try Demo Bucket: Access indexed blockchain data cost-effectively and at scale for your data pipeline. We currently support Ethereum, BSC, Solana, with more blockchains on the horizon, simplifying your data access.

  • Explorer - Try Explorer: Discover an intuitive platform for exploring data from 40+ blockchains. Visualize data, generate queries, and integrate effortlessly into your applications.

Bitquery empowers developers with straightforward blockchain data tools. If you have questions or need assistance, connect with us on our Telegram channel or via email at sales@bitquery.io. Stay updated on the latest in cryptocurrency by subscribing to our newsletter below.

Subscribe to our newsletter

Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.