DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) as the example token.
REST samples come in cURL, TypeScript for Node.js 18 or later, and Rust. Stream samples come in Node.js and Rust. The Node.js stream samples need the ws package, and the Rust samples need these dependencies:
Cargo.toml
1
Set your API key
If you don’t have a key yet, see Get an API key. Then export it in your shell:
2
Fetch a token
Request the token object, sending your key as a bearer token:The response is a list with one token object per chain that holds the token. Shortened here:Prices and amounts are decimal strings, and every priced value includes both a
native and a usd value. See Response format for details on each convention.3
Fetch candles
Request the last 24 hourly candles, priced in USD:Candles are sorted oldest first, and
time is the open time of each bucket in milliseconds. Buckets with no trades are omitted.4
Stream live trades
Connect, passing your key in the handshake, and send a subscribe frame. Each sample prints every frame it receives:An After that, you receive one The
ack frame confirms the subscription:update frame per trade:data field of each update contains the same trade object that the REST trades endpoint returns. You can also filter by wallet, venue, trader flag or trade size; see spot.trades.Next steps
Response format
Prices, decimals, percentages and timestamps.
WebSocket streams
Frames, channels and reconnection.
Errors and rate limits
Error codes, retries and rate limits.
Trades
Trades by token, wallet or identity feed, with pagination.