Candles
Returns DEX trades and DEX trades by token on Ethereum, where buy currency smart contract is 0xc02a…6cc2, sell currency smart contract is 0xdac1…1ec7 and buy currency smart contract is 0xdac1…1ec7, sorted by block time: sum of trade buy amount, sum of trade sell amount, block time, sum of trade amount, trade price and count.
What it returns
- sum of trade buy amount
- sum of trade sell amount
- block time
- sum of trade amount
- trade price
- count
Filters
- buy currency smart contract is 0xc02a…6cc2
- sell currency smart contract is 0xdac1…1ec7
- buy currency smart contract is 0xdac1…1ec7
- sell currency smart contract is 0xc02a…6cc2
- side currency smart contract is 0xc02a…6cc2
- currency smart contract is 0xdac1…1ec7
- block time since 2024-04-03
The query
query($since:DateTime!, $token0: String!, $token1: String!) {
EVM(dataset: realtime, network: eth) {
Total_Buy_Amount: DEXTrades(
where: {Block: {Time: {since: $since}}, Trade: {Buy: {Currency: {SmartContract: {is: $token0}}}, Sell: {Currency: {SmartContract: {is: $token1}}}}}
) {
sum(of:Trade_Buy_Amount)
}
Total_Sell_Amount: DEXTrades(
where: {Block: {Time: {since: $since }}, Trade: {Buy: {Currency: {SmartContract: {is: $token1}}}, Sell: {Currency: {SmartContract: {is: $token0}}}}}
) {
sum(of:Trade_Sell_Amount)
}
# Total_Buy_Transactions: DEXTrades(
# where: {Block: {Time: {since: $since}}, Trade: {Buy: {Currency: {SmartContract: {is: $token0}}}, Sell: {Currency: {SmartContract: {is: $token1}}}}}
# ) {
# count(distinct: Transaction_Hash)
# }
# Total_Sell_Transactions: DEXTrades(
# where: {Block: {Time: {since: $since}}, Trade: {Buy: {Currency: {SmartContract: {is: $token1}}}, Sell: {Currency: {SmartContract: {is: $token0}}}}}
# ) {
# count(distinct: Transaction_Hash)
# }
DEXTradeByTokens(
orderBy: {ascendingByField: "Block_Time"}
where: {Block: {Time: {since: $since }}, Trade: {Side: {Currency: {SmartContract: {is: $token0}}}, Currency: {SmartContract: {is: $token1}}}},
) {
Block {
Time(interval: {in: minutes})
}
volume: sum(of: Trade_Amount)
Trade {
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Number)
close: Price(maximum: Block_Number)
}
count
}
}
}
Variables
{
"since": "2024-04-03T12:10:15.839Z", "token0":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token1":"0xdac17f958d2ee523a2206206994597c13d831ec7"
}
Similar queries
- Latest Curve DEX swaps on Ethereum · Ethereum · DEXTrades
- Top Curve liquidity pools by 24h volume on Ethereum · Ethereum · DEXTrades
- STRN_TOKEN_MULTIPLE_DECIMALS_DEX_TRADES · Ethereum · DEXTrades
- USDT DECIMAL SHOWING 0 · Ethereum · DEXTrades
- Trades - 0xEE61159E8A72A08371c52D62c19Efd0C7914f917 · Ethereum · DEXTrades