weth-usdt-ohlc-draft

Streams the latest 10 DEX trades by token on Ethereum as they happen, where DEX smart contract is 0x0d4a…1852 and side currency symbol is WETH: block time, sum of trade amount, trade price and count.

By Sy Tran · saved 17 August 2023 · run 1 time · Bitquery API v2

What it returns

Filters

The subscription

subscription OHLCSub($pool: String, $base: String) {
EVM(network: eth, trigger_on: head) {
        DEXTradeByTokens(
            orderBy: {descendingByField: "Block_Time"}
            limit: {count: 10 }
            where: {
                Trade: {
                    Dex: {
                        SmartContract: {is: $pool}
                    }
                    Side: {
                        Currency: {Symbol: {is: $base}}
                    }
                }
            }
        ) {
        
            Block {
                Time(interval: {in: minutes count: 1})
            }
            
            volume: sum(of: Trade_Amount)
            
            Trade {
                high: Price(maximum: Trade_Price)
                low: Price(minimum: Trade_Price)
                open: Price(minimum: Block_Time)
                close: Price(maximum: Block_Time)
            }
            
            count
        }
    }
}

Variables

{
  "pool": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
  "base": "WETH"
}

Similar queries