GET /ticks
Get raw tick-level swap data
Understanding Blockchain Tick Data
If you are coming from a traditional Centralized Exchange (CEX) background, handling Decentralized Exchange (DEX) tick data requires a slight shift in mental model.
1. Block Timestamps vs. Exact Execution Time
In traditional finance, every trade has a precise millisecond or nanosecond timestamp representing the exact moment of matching.
In DeFi, trades are "confirmed" when a block is mined. All trades within the same block share the exact same timestamp.
- CEX:
T1: 12:00:00.001,T2: 12:00:00.005,T3: 12:00:00.012 - DEX:
Trade 1,Trade 2, andTrade 3might all share12:00:12if they were included in the same block.
2. Ordering within Blocks
Since timestamps are identical for same-block trades, time alone is not enough to sort trades.
We return trades sorted by blockNumber (implied by time) and logIndex.
3. Atomic Transactions & MEV
You may often see complex bundles of trades (MEV bots, arbitrage) executing atomically. The price you see is the execution price of that specific swap event within the pool, which might differ momentarily from the "market price" due to flash loans or sandwich attacks in the same block.
Parameters
symbolstringTrading pair (e.g., "WETH-USDT"). Provide either symbol OR pool.
poolstringPool address. Provide either symbol OR pool.
fromstringStart time (ISO 8601). Default: 1 hour ago.
tostringEnd time (ISO 8601). Default: now (live data).
limitintegerMax ticks to return (1-1000). Default: 100.
networksstringComma-separated networks (e.g. ethereum,arbitrum).
Response
dataarrayArray of swap ticks
Tick
idstringtimestampstringpricenumbersidestringamount0stringamount1stringamountUSDnumbertoken0stringtoken1stringcredits_usedintegerCredits consumed by this request.
curl "https://api.qoery.com/v0/ticks?pool=0x88e6...&limit=50" \ -H "X-API-KEY: your_api_key_here"
const response = await fetch( 'https://api.qoery.com/v0/ticks?pool=0x88e6...&limit=50', { headers: { 'X-API-KEY': 'your_api_key_here' } } );
import requests response = requests.get( 'https://api.qoery.com/v0/ticks', headers={'X-API-KEY': 'your_api_key_here'}, params={'pool': '0x88e6...', 'limit': 50} )
{ "data": [ { "id": "0x123...-15", "timestamp": "2023-11-30T12:00:12Z", "price": 2050.50, "side": "buy", "amount0": "-1.5", "amount1": "3075.75", "amountUSD": 3075.75, "token0": "WETH", "token1": "USDT" } ], "credits_used": 2 }