Getting OHLC and Distinct Buys/Sells
Returns 30 DEX trades by token on BNB Chain, where side currency smart contract is 0xbb4c…095c, currency smart contract is 0xfb61…f802 and side type is buy, sorted by block time field, highest first: block time, sum of trade amount, count, currency name, side currency name and trade price.
What it returns
- block time
- sum of trade amount
- count
- currency name
- side currency name
- trade price
Filters
- side currency smart contract is 0xbb4c…095c
- currency smart contract is 0xfb61…f802
- side type is buy
- block date since 2023-07-01
- block date till 2023-08-01
- side amount is at least 0
- trade price asymmetry is below 0.1
The query
{
EVM(dataset: archive, network: bsc) {
buyside: DEXTradeByTokens(
limit: {count: 30}
orderBy: {descendingByField: "Block_time_field"}
where: {Trade: {Side: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}, Amount: {ge: "0"}, Type: {is: buy}}, Currency: {SmartContract: {is: "0xfb6115445bff7b52feb98650c87f44907e58f802"}}, PriceAsymmetry: {lt: 0.1}}, Block: {Date: {since: "2023-07-01", till: "2023-08-01"}}}
) {
Block {
time_field: Time(interval: {in: days, count: 1})
}
volume: sum(of: Trade_Amount)
distinctBuyer: count(distinct: Trade_Buyer)
distinctSeller: count(distinct: Trade_Seller)
distinctSender: count(distinct: Trade_Sender)
distinctTransactions: count(distinct: Transaction_Hash)
total_sales: count(
if: {Trade: {Side: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}}}}
)
total_buys: count(
if: {Trade: {Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}}}
)
total_count: count
Trade {
Currency {
Name
}
Side {
Currency {
Name
}
}
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Number)
close: Price(maximum: Block_Number)
}
}
}
}
Similar queries
- bStocks 3am: QQQB 30-day DEX volume · BNB Chain · DEXTradeByTokens
- bStocks 3am: tokenized Tesla 30-day volume · BNB Chain · DEXTradeByTokens
- bsc token ohlcv · BNB Chain · DEXTradeByTokens
- optimized query to get pools data · Ethereum · DEXTradeByTokens
- KTI_primeiros_trades · BNB Chain · DEXTradeByTokens