DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) as the example token.
1
Set your API key
If you have no key yet, see Get an API key. Then export it in your shell:
2
Read a token
Request the token object. Every request sends the key as a bearer token.The response is the token object. This one is shortened:Prices and amounts are decimal strings, and every priced value carries a
native and a usd leg. Reading responses explains each convention.3
Fetch candles
Request the last 24 hourly candles, priced in USD:Candles come oldest first, and
time is the bucket’s open time in milliseconds. A bucket with no trades is left out.4
Stream live trades
Install wscat, then connect with your key on the handshake:Once connected, send a subscribe frame:The server confirms the subscription:Then it sends one Each update’s
update frame per trade:data is the trade object the REST trades endpoint returns. A subscription by token leaves out flags and platforms; see spot.trades.Next steps
Reading responses
Money objects, decimal strings, percentages and timestamps.
Connecting to streams
Every frame, every channel, and how to reconnect.
Errors and retries
Handle every error code correctly.
Pagination
Page through a token’s full trade history.