Description
Returns open-high-low-close (OHLC) candles for ERC-20 base and quote token pairs. Candles are computed using BlockDB’s consolidated trade and quote data.
For fiat quotes (e.g., USD, EUR), use the dedicated /evm/prices/spot/fiat/* endpoints.
Parameters
Target EVM chain. See the Chain enumeration for supported values.
ERC-20 contract address for the base asset (hex string, 20 bytes, no 0x prefix).
ERC-20 contract address for the quote asset (hex string, 20 bytes, no 0x prefix).
Range Filters (mutually exclusive)
Starting block number (inclusive) for the query. Use with to_block.
Ending block number (inclusive) for the query. Use with from_block.
Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with to_timestamp.
Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with from_timestamp.
Validation rule:
You must provide either a block range, a time range, or at least one direct selector.
Providing more than one option results in HTTP 400.
Providing none results in HTTP 400.
Direct Selectors
Restrict to specific BlockDB pool identifiers.
Candle Controls
Candle width, expressed as an ISO-8601 duration shorthand (1m, 5m, 1h, 1d). Default is 1m.
IANA timezone identifier used to anchor candle boundaries. Default is UTC.
Recommended default 250; maximum 1000 to stay under ~10 MB responses.
Opaque pagination cursor supplied by a previous response.
Response Fields
EVM chain ID echoed at the response root.
ERC-20 contract address of the base asset.
ERC-20 contract address of the quote asset.
Echo of request metadata applied to the response.
Normalized block/timestamp bounds derived from the request.
Filter parameters echoed from the request.
Data
OHLC candles matching the request.
Opening price for the bucket.
Highest price within the bucket.
Lowest price within the bucket.
Closing price for the bucket.
Aggregated executed volume in base units.
Aggregated executed volume in quote units.
Inclusive start of the candle window (ISO-8601).
Inclusive end of the candle window (ISO-8601).
Bucket anchor timestamp for the interval.
Tracing identifier for the candle.
Parent lineage references.
data._genesis_tracing_ids
Lineage references to original on-chain events.
Record creation timestamp.
Envelope Fields
Number of candles returned.
Usage Notes
- Fiat quotes adopt decimal precision specified by the fiat currency enumeration.
- When multiple exchanges contribute to the candle, BlockDB emits consolidated OHLC values weighted by trade volume.
curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc" \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chain_id": 1,
"base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"from_timestamp": "2025-11-11T00:00:00Z",
"to_timestamp": "2025-11-11T01:00:00Z",
"exchange_ids": [
1,
2
],
"aggregation_interval": "1m",
"aggregation_timezone": "UTC",
"limit": 200,
"cursor": null
}'
{
"chain_id": 1,
"base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"meta": {
"request_window": {
"from_block": null,
"to_block": null,
"from_timestamp": "2025-11-11T00:00:00Z",
"to_timestamp": "2025-11-11T01:00:00Z"
},
"filters": {
"exchange_ids": [
1,
2
],
"pool_uids": []
}
},
"data": [
{
"open": "3010.112233445566778899",
"high": "3033.998877665544332211",
"low": "3008.001122334455667788",
"close": "3025.219821481234567890",
"volume_base": "420.000000000000000000",
"volume_quote": "1269000.000000000000000000",
"start_timestamp": "2025-11-11T00:00:00Z",
"end_timestamp": "2025-11-11T00:59:59Z",
"bucket": "2025-11-11T00:00:00Z",
"_tracing_id": "0403000000000000000000000000000000000000",
"_parent_tracing_ids": [
"0203000000000000000000000000000000000000"
],
"_genesis_tracing_ids": [
"0103000000000000000000000000000000000000"
],
"_created_at": "2025-11-11T01:00:05.000Z",
"_updated_at": "2025-11-11T01:00:05.000Z"
}
],
"cursor": null,
"count": 1
}