curl "https://api.metastreams.dev/v1/ohlcv?tokens=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&chains=solana&timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/ohlcv");
url.searchParams.set("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
url.searchParams.set("chains", "solana");
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const [series] = await response.json();
use serde_json::Value;
let series: Vec<Value> = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/ohlcv")
.query(&[
("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"),
("chains", "solana"),
("timeframe", "1h"),
("metric", "price"),
("countBack", "24"),
])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
[
{
"chain": "solana",
"address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
],
"nextCursor": "eyJ0IjoxNzg5NTQ1NjAwMDAwfQ",
"hasMore": true
}
]
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
REST
OHLCV candles
Returns OHLCV candles for up to 10 tokens at any timeframe, by price or by market cap.
GET
/
v1
/
ohlcv
curl "https://api.metastreams.dev/v1/ohlcv?tokens=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&chains=solana&timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/ohlcv");
url.searchParams.set("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
url.searchParams.set("chains", "solana");
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const [series] = await response.json();
use serde_json::Value;
let series: Vec<Value> = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/ohlcv")
.query(&[
("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"),
("chains", "solana"),
("timeframe", "1h"),
("metric", "price"),
("countBack", "24"),
])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
[
{
"chain": "solana",
"address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
],
"nextCursor": "eyJ0IjoxNzg5NTQ1NjAwMDAwfQ",
"hasMore": true
}
]
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
Returns one OHLCV candle series for each token in
To read a window that ends earlier without a cursor, set
tokens, a comma-separated list of 1 to 10 addresses. chains limits the read to a comma-separated list of chain slugs. Omit it to read every chain. Each series is oldest first, with one candle per bucket that traded. Buckets with no trades are omitted. Each token costs one credit.
The defaults are timeframe=1m, metric=marketCap and denomination=usd.
Pool candles
By default, a token’s candles include trades in all of its pools. To read one pool’s candles, send its address inpool and name that pool’s token alone in tokens. The pool must use the same address format as the token.
Response
The response is a list with one series per chain where each requested token has candles in the window, in the order of the request. Each series containschain, address, candles, nextCursor and hasMore. A token with no candles in the window has no series, so the response can be an empty list. It is not a 404.
Time range
countBack sets the number of bars and overrides from, while to and timeframe still apply. A request with neither countBack nor from returns the most recent 500 buckets, and a window with more than 5000 candles returns the newest 5000. This matches the behavior TradingView’s charting library expects.
Pagination
from is inclusive and to is exclusive, both in milliseconds. Omit to to read up to the current time.
Each series pages back on its own. hasMore is true while the window has older candles for that series, and nextCursor reads the next, older page. Send it as cursor with the same options, with that series’ token alone in tokens and, for an EVM token, its chain in chains. A page can hold fewer candles than requested while hasMore is true, so page until it is false.
curl "https://api.metastreams.dev/v1/ohlcv?tokens=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&chains=solana&timeframe=1m&countBack=5000&cursor=$NEXT_CURSOR" \
-H "Authorization: Bearer $API_KEY"
to to the time of the oldest candle received. Because to is exclusive, that candle is not returned again.
Response fields
Candle values are JSON numbers rather than the decimal strings used in token and trade objects, because charting libraries expect numbers.Errors
| Code | When |
|---|---|
UNSUPPORTED_CHAIN | A slug in chains is not supported |
VALIDATION_ERROR | No token or more than 10, a malformed address, an unknown timeframe, from greater than to, a countBack outside 1–5000, a pool beside more than one token, of another address format than the token or at the zero address, a cursor sent with other tokens, chains or options than its own series, or an unknown parameter |
curl "https://api.metastreams.dev/v1/ohlcv?tokens=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&chains=solana&timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/ohlcv");
url.searchParams.set("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
url.searchParams.set("chains", "solana");
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const [series] = await response.json();
use serde_json::Value;
let series: Vec<Value> = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/ohlcv")
.query(&[
("tokens", "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"),
("chains", "solana"),
("timeframe", "1h"),
("metric", "price"),
("countBack", "24"),
])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
[
{
"chain": "solana",
"address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
],
"nextCursor": "eyJ0IjoxNzg5NTQ1NjAwMDAwfQ",
"hasMore": true
}
]
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
Authorizations
Query Parameters
Response
One series per chain where each named token, or its pool, has candles in the window, in the order the request named them. Each holds one page of candles, one per bucket that traded, oldest first.