top of page
Search

Technical API Query Analysis - Blockchain Query

  • Sujatha R
  • Nov 2, 2023
  • 1 min read

Updated: Nov 12, 2023

Query Overview

The query (utilizes the Bitquery API) obtains a comprehensive dataset focusing on critical parameters explained below.


Query Image
Query Image

Input Variables

  • $network: Specifies the Ethereum network to be queried

  • $dateFormat: The date format to be displayed

  • $exchange: The target exchange for which data is requested

  • $from: The start date of the time range for the data query

  • $till: The end date of the time range for the data query

Query Execution

1. Network Selection

The query begins by specifying the Ethereum network variable using the $network parameter.

2. dexTrades Query

  • Options: Trades are sorted in ascending order based on the date field

  • Date Filter: Restrict trades to those occurring within the specified time range using the since and till parameters.

  • Exchange Filter: The exchangeName parameter ensures that data is only retrieved for the specified exchange.

3. Data Fields

  • date:

    • The date field is formatted using the provided $dateFormat to display the date in the specified format.

  • protocol:

    • The protocol associated with the trade.

  • count:

    • The count of trades within the specified time range & exchange

  • tradeAmount

    • Retrieves the trade amount, converted to USD for better understanding

Query Parameters

Query Parameter Image
Query Parameter Image

Parameter

Purpose

Technical Details

limit

Dictates the maximum results (here 10) that will be returned by the query

Users are only interested in a specific subset of data due to factors such as visualization constraints or computational limitations

offset

Determines the starting point (here 0) from which the results will be fetched

Users can navigate to different sections of the data

network

Specifies the blockchain network (here “ethereum”) that will be queried

Ensures that the query retrieves information from the correct blockchain

exchange

Designates the specific exchange (here “Uniswap”) from which the user desires to retrieve data.

Allows users to pinpoint the exact source of data among multiple exchanges on the specified network

from & till

Establishes a time range (here "2023-10-25" and till is set to "2023-11-01T23:59:59") within which the queried trades must fall

Enable users to focus on trades that occurred within the defined time frame

dateFormat

dateFormat ( here "%Y-%m-%d" "Year-Month-Day" ) governs how the dates in the results will be formatted

Ensures that the dates are displayed in a manner that aligns with the user's preferences


Query Result


Query Result Image
Query Result Image

  • Date: The date of each trade, presented in the specified format

  • Protocol: The protocol linked to each trade

  • Trade Count: The total number of trades within the specified time range and exchange

  • Trade Amount (USD): The trade amount, converted to USD (easier interpretation)

 
 
 

Comments


bottom of page