Skip to content

Charts

candles.get returns price candles of up to 200 tokens at once, and candles.subscribe keeps them live.

Candles come as columns rather than one object per candle, so a chart library can often take them as they are:

{
"height": 219969220,
"timestamp_millis": 1792003477277,
"tokens": {
"wrap.near": {
"time": [1791921600000, 1791925200000],
"usd": { "open": [4.79, 4.8], "high": [4.83, 4.82], "low": [4.77, 4.79], "close": [4.8, 4.81] }
}
},
"missing": []
}

time is when each candle opens, in milliseconds, oldest first.

const params = new URLSearchParams({
tokens: 'wrap.near',
resolution: '60',
count_back: '24',
series: 'open,high,low,close',
});
const response = await fetch(`https://api.intea.rs/candles?${params}`);
const result = await response.json();
if (!response.ok) throw new Error(result.error.message);
const { time, usd } = result.tokens['wrap.near'];
const candles = [];
for (const [i, openedAt] of time.entries()) {
candles.push({ time: openedAt, open: usd.open[i], high: usd.high[i], low: usd.low[i], close: usd.close[i] });
}
resolution Candle Also accepted
1S 1 second
1 1 minute 1m
5 5 minutes 5m
15 15 minutes 15m
60 1 hour 60m, 1h
240 4 hours 240m, 4h
D 1 day 24h, 1d
W 1 week 7d, 1w

The aliases work in any case.

"quote": "near" gives prices in NEAR instead of USD: the token’s USD price over NEAR’s at the same block. A token traded against NEAR then stays flat while only NEAR moves. Ask for both with "quote": ["usd", "near"], and each token has a usd and a near object.

candles.subscribe takes the same params except to_millis, with count_back defaulting to 0. Set count_back to get the chart’s history in the reply too. Each push has the candles that changed in that block: the latest one, and a new one when it opens. A push can also carry the candle before the latest one. A candle replaces the one you have with the same time.

Embed https://chart.intear.tech/?token=token.intear.near in an iframe for a live TradingView chart, it already connects to the API and does all the work by itself.