Skip to content

Token price candles (OHLCV)

View as Markdown
GET
/v2/token/{chain_id}/{address}/ohlcv
curl --request GET \
--url 'https://api.chainmetric.io/v2/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/ohlcv?interval=1h&pool=88e6a0c2ddd26feeb64f039a2c41296fcb3f5640&from=1795887600000000&to=1796037600000000&limit=500' \
--header 'Authorization: <Authorization>'

Returns price candles for one token at one interval, oldest first. Use it to draw a price chart or to read the price at a past time. Without pool, the series follows the token’s main pool. A candle exists only for a bucket that had at least one trade; empty buckets are not filled. To page back in time, send an earlier to.

chain_id
required
integer
Allowed values: 1 56 8453 1399811149

Chain id: 1 Ethereum, 56 BNB Chain, 8453 Base, 1399811149 Solana.

Example

1
address
required
string

Token address. EVM is 40 lowercase hex characters without 0x; Solana is base58.

Example

c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
interval
string
default: 5m
Allowed values: 1s 5s 15s 30s 1m 5m 15m 30m 1h 4h 6h 12h 1d 1w

Candle width.

Example

1h
pool
string

Only this pool’s rows. A pool that is not the token’s gives an empty answer.

Example

88e6a0c2ddd26feeb64f039a2c41296fcb3f5640
from
integer format: int64

Earliest bucket start, Unix microseconds.

Example

1795887600000000
to
integer format: int64

Latest bucket start, Unix microseconds, inclusive.

Example

1796037600000000
limit
integer
default: 500 >= 1 <= 5000

Candles per answer.

Example

500

The candles.

Media typeapplication/json
object
kind
required

The document type, for example token_stats.

string
version
required

The document schema version.

integer
chain_id
required

The chain the document is about.

integer
address

The token or wallet the document is about.

string
subject

The stream topic of this document: <kind>.<chain_id>.<address>.

string
lane
required

fast data is published as soon as a block is seen. safe data is published again once the block is final and replaces it.

string
Allowed values: fast safe
commitment
required

How settled the data is: processed (Solana fast), confirmed (EVM fast) or finalized (safe).

string
Allowed values: processed confirmed finalized
as_of

The block height (or Solana slot) the document reflects.

integer format: int64
seq
required

Increases with every newer version of the document. Keep the highest.

integer format: int64
updated_us

When the document was built, Unix microseconds.

integer format: int64
data
required

The document body. Its shape depends on kind.

object
data
required
object
interval
string
candles
Array<object>
object
time_us

Bucket start, Unix microseconds.

integer format: int64
open

Price in quote-token units. Also high, low, close.

number
high
number
low
number
close
number
open_usd

USD price. Also high_usd, low_usd, close_usd.

number | null
high_usd
number | null
low_usd
number | null
close_usd
number | null
volume_token

Volume in whole tokens.

number
volume_quote

Volume in whole quote tokens.

number
volume_usd

Volume in USD.

number | null
trades

Swaps in the bucket.

integer
pool

The pool the candle was read from.

string

Examples

WETH on Ethereum, 5m

{
"kind": "token_ohlcv",
"version": 1,
"chain_id": 1,
"address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"subject": "token_ohlcv.1.c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.5m",
"lane": "fast",
"commitment": "confirmed",
"seq": 1796037600000,
"updated_us": 1796037750364351,
"data": {
"candles": [
{
"time_us": 1795887600000000,
"open": 1647.7789049068542,
"high": 1648.3065379720567,
"low": 1647.4683169924433,
"close": 1647.7960438688235,
"open_usd": 1647.5482158601671,
"high_usd": 1648.0757750567407,
"low_usd": 1647.2376714280642,
"close_usd": 1647.5653524226818,
"volume_token": 30.080292851519083,
"volume_quote": 49563.494918,
"volume_usd": 49556.55602871148,
"trades": 14,
"pool": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
},
{
"time_us": 1795887900000000,
"open": 1647.6538931195128,
"high": 1647.6538931195128,
"low": 1642.5918730202952,
"close": 1643.1482367238566,
"open_usd": 1647.423221574476,
"high_usd": 1647.423221574476,
"low_usd": 1642.3619101580723,
"close_usd": 1642.9181959707153,
"volume_token": 158.8748922578638,
"volume_quote": 261096.127194,
"volume_usd": 261059.57373619283,
"trades": 28,
"pool": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
}
],
"interval": "5m"
}
}

The request is malformed, for example a bad address, an unknown chain or an out-of-range parameter. Do not retry unchanged.

Media typeapplication/json

Every error answer has this shape. error and message carry the same text.

object
error
required

What went wrong. For 5xx answers this is the status text.

string
message
required

The same text as error.

string
statusCode
required

The HTTP status.

integer

Examples

ExampleunknownChain
{
"error": "blockchain: unknown chain: \"ethereum\"",
"message": "blockchain: unknown chain: \"ethereum\"",
"statusCode": 400
}

The key is missing (api key missing), unknown (api key unknown) or revoked (api key revoked). Send Authorization: <key>.

Media typeapplication/json

Every error answer has this shape. error and message carry the same text.

object
error
required

What went wrong. For 5xx answers this is the status text.

string
message
required

The same text as error.

string
statusCode
required

The HTTP status.

integer

Examples

Examplemissing
{
"error": "api key missing",
"message": "api key missing",
"statusCode": 401
}

The key’s request rate limit is reached. No Retry-After is sent; back off and retry.

Media typeapplication/json

Every error answer has this shape. error and message carry the same text.

object
error
required

What went wrong. For 5xx answers this is the status text.

string
message
required

The same text as error.

string
statusCode
required

The HTTP status.

integer

Examples

Examplelimited
{
"error": "api key rate limit reached",
"message": "api key rate limit reached",
"statusCode": 429
}

The service is busy or catching up. Wait for the Retry-After header’s seconds when present (5 or 10), then retry. Without it, retry with exponential backoff.

Media typeapplication/json

Every error answer has this shape. error and message carry the same text.

object
error
required

What went wrong. For 5xx answers this is the status text.

string
message
required

The same text as error.

string
statusCode
required

The HTTP status.

integer

Examples

Exampleunavailable
{
"error": "Service Unavailable",
"message": "Service Unavailable",
"statusCode": 503
}
Retry-After
integer

Seconds to wait before retrying.