ohlc for a pair on Arbitrum
Historical data This query uses the realtime dataset (the default), which holds only a recent window - hours to days depending on the cube. For older data add a dataset to the top-level element: EVM(network: $network, dataset: $dataset, dataset: combined) archive full history combined archive + r
What it returns
- block time
- price in USD
- sum of trade amount in USD
Filters
- side currency smart contract is 0xff97…5cc8
- currency smart contract is 0x912c…6548
- block time since 2024-11-17
- side amount is above 0
- trade price asymmetry is at most 0.1
The query
# Historical data
# This query uses the realtime dataset (the default), which holds only a
# recent window - hours to days depending on the cube.
#
# For older data add a dataset to the top-level element:
#
# EVM(network: $network, dataset: $dataset, dataset: combined)
#
# archive full history
# combined archive + realtime in one result
#
# Archive and combined need the historical data add-on:
# https://bitquery.io/pricing
#
# Datasets: https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#
query tradingViewPairs($network: evm_network, $dataset: dataset_arg_enum, $interval: Int, $token: String, $base: String, $time_ago: DateTime) {
EVM(network: $network, dataset: $dataset) {
DEXTradeByTokens(
orderBy: {ascendingByField: "Block_Time"}
where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Currency: {SmartContract: {is: $base}}, PriceAsymmetry: {le: 0.1}}, Block: {Time: {since: $time_ago}}}
) {
Block {
Time(interval: {count: $interval, in: minutes})
}
Trade {
open: PriceInUSD(minimum: Block_Time)
close: PriceInUSD(maximum: Block_Time)
max: PriceInUSD(maximum: Trade_PriceInUSD)
min: PriceInUSD(minimum: Trade_PriceInUSD)
}
volume: sum(of: Trade_AmountInUSD)
}
}
}
Variables
{
"network": "arbitrum",
"base": "0x912ce59144191c1204e64559fe8253a0e49e6548",
"token": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
"time_ago": "2024-11-17T07:59:49Z",
"interval": 5,
"dataset": "realtime"
}
Similar queries
- optimized query to get pools data · Ethereum · DEXTradeByTokens
- AfricaCryptoChainx · Ethereum · DEXTradeByTokens
- UniversalSearch EVM · Ethereum · DEXTradeByTokens
- without fragment · Ethereum · DEXTradeByTokens
- trade stats for a token pair on uniswap v4 arbitrum · Arbitrum · DEXTradeByTokens