Skip to main content
POST
/
v1
/
evm
/
prices
/
spot
/
crypto
/
ohlc
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
}'
{
  "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "meta": {
    "chain_id": 1,
    "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": [
    {
      "chain_id": 1,
      "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
      "exchange_id": 1,
      "type_id": 201,
      "first_block_number": 18930100,
      "first_block_time": "2025-11-11T00:05:11.000Z",
      "first_tx_index": 42,
      "first_log_index": 18,
      "last_block_number": 18930188,
      "last_block_time": "2025-11-11T00:58:02.000Z",
      "last_tx_index": 17,
      "last_log_index": 3,
      "bucket_start": "2025-11-11T00:00:00.000Z",
      "bucket_seconds": 3600,
      "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "open": "3010.112233445566778899",
      "high": "3033.998877665544332211",
      "low": "3008.001122334455667788",
      "close": "3025.219821481234567890",
      "volume_in": "420.000000000000000000",
      "volume_out": "1269000.000000000000000000",
      "trades_count": 128,
      "_tracing_id": "0404000000000000000000000000000000000001",
      "_created_at": "2025-11-11T01:00:05.000Z",
      "_updated_at": "2025-11-11T01:00:05.000Z"
    }
  ],
  "cursor": null,
  "count": 1
}

Overview

Parameters

chain_id
number
required
Target EVM chain. See the Chain enumeration for supported values.
base_token_address
string
required
ERC-20 contract address for the base asset (hex string, 20 bytes, no 0x prefix).
quote_token_address
string
required
ERC-20 contract address for the quote asset (hex string, 20 bytes, no 0x prefix).

Range Filters (mutually exclusive)

from_block
number
Starting block number (inclusive) for the query. Use with to_block.
to_block
number
Ending block number (inclusive) for the query. Use with from_block.
from_timestamp
string
Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with to_timestamp.
to_timestamp
string
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

exchange_ids
number[]
Filter by exchange identifiers. See the DigitalExchange enumeration.
pool_uids
string[]
Restrict to specific BlockDB pool identifiers.

Candle Controls

aggregation_interval
string
Candle width, expressed as an ISO-8601 duration shorthand (1m, 5m, 1h, 1d). Default is 1m.
aggregation_timezone
string
IANA timezone identifier used to anchor candle boundaries. Default is UTC.

Pagination Controls

limit
number
default:"250"
Recommended default 250; maximum 1000 to stay under ~10 MB responses.
cursor
string
Opaque pagination cursor supplied by a previous response.

Response Fields

base_token_address
string
ERC-20 contract address of the base asset.
quote_token_address
string
ERC-20 contract address of the quote asset.

Meta

meta
object
Echo of request metadata applied to the response.
meta.chain_id
number
EVM chain ID echoed from the request.
meta.request_window
object
Normalized block/timestamp bounds derived from the request.
meta.filters
object
Filter parameters echoed from the request.

Data

data
object[]
OHLC candles matching the request.
data.chain_id
number
EVM chain identifier.
data.pool_uid
string
BlockDB pool identifier for the candle.
data.exchange_id
number
Exchange/DEX identifier.
data.type_id
number
Pool type identifier.
data.first_block_number
number
Block number of the first trade included in the bucket.
data.first_block_time
string
Block time of the first trade (ISO-8601).
data.first_tx_index
number
Transaction index of the first trade in the bucket.
data.first_log_index
number
Log index of the first trade in the bucket.
data.last_block_number
number
Block number of the last trade included in the bucket.
data.last_block_time
string
Block time of the last trade (ISO-8601).
data.last_tx_index
number
Transaction index of the last trade in the bucket.
data.last_log_index
number
Log index of the last trade in the bucket.
data.bucket_start
string
Inclusive UTC start of the candle bucket (ISO-8601).
data.bucket_seconds
number
Candle width in seconds (for example 60, 300).
data.token_in
string
Input token address (hex, 20 bytes, no 0x prefix).
data.token_out
string
Output token address (hex, 20 bytes, no 0x prefix).
data.open
string
Opening price for the bucket (token_out per 1 token_in, decimals-adjusted). Returned as a string to preserve precision.
data.high
string
Highest price within the bucket. Returned as a string to preserve precision.
data.low
string
Lowest price within the bucket. Returned as a string to preserve precision.
data.close
string
Closing price for the bucket. Returned as a string to preserve precision.
data.volume_in
string
Volume of token_in in the bucket (decimals-adjusted). Returned as a string to preserve precision.
data.volume_out
string
Volume of token_out in the bucket (decimals-adjusted). Returned as a string to preserve precision.
data.trades_count
number
Number of trades aggregated into the bucket.
data._tracing_id
string
Tracing identifier for the candle row (hex string, no 0x prefix).
data._created_at
string
Record creation timestamp (ISO-8601).
data._updated_at
string
Record update timestamp (ISO-8601).

Envelope Fields

cursor
string | null
Pagination cursor.
count
number
Number of candles returned.

Usage Notes

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
}'
{
  "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "meta": {
    "chain_id": 1,
    "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": [
    {
      "chain_id": 1,
      "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000",
      "exchange_id": 1,
      "type_id": 201,
      "first_block_number": 18930100,
      "first_block_time": "2025-11-11T00:05:11.000Z",
      "first_tx_index": 42,
      "first_log_index": 18,
      "last_block_number": 18930188,
      "last_block_time": "2025-11-11T00:58:02.000Z",
      "last_tx_index": 17,
      "last_log_index": 3,
      "bucket_start": "2025-11-11T00:00:00.000Z",
      "bucket_seconds": 3600,
      "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "open": "3010.112233445566778899",
      "high": "3033.998877665544332211",
      "low": "3008.001122334455667788",
      "close": "3025.219821481234567890",
      "volume_in": "420.000000000000000000",
      "volume_out": "1269000.000000000000000000",
      "trades_count": 128,
      "_tracing_id": "0404000000000000000000000000000000000001",
      "_created_at": "2025-11-11T01:00:05.000Z",
      "_updated_at": "2025-11-11T01:00:05.000Z"
    }
  ],
  "cursor": null,
  "count": 1
}
Last modified on March 21, 2026