Aurelia

OHLCV candles API

Open, high, low, close and volume for a token or a pool, from 1 minute to 1 day, built from every indexed swap.

Get a token's candles

GET /tokens/:chain/:address/candles answers from the pool that charts the token, and names that pool. A pool's own candles are at GET /pools/:chain/:address/candles.

Hourly candles in USD:

curl -s -H 'Authorization: Bearer <key>' 'https://app.aurelia.build/api/tokens/solana/So11111111111111111111111111111111111111112/candles?res=1h&currency=usd'
ParameterValuesDefault
res1m, 5m, 15m, 1h, 4h, 1d1m
from, toUnix seconds, at most 5,000 bars apartThe last 500 bars, up to now
currencyusd, or quote for the pool's quote tokenusd
fill1 repeats the previous close through empty intervalsOff

What a bar holds

FieldWhat it is
tThe bar's start, unix seconds
o, h, l, cOpen, high, low and close
vVolume in USD
nNumber of trades: the priced ones in usd, all of them in quote

Draw a chart

The bars map directly onto a candlestick series in a charting library. A price history is the bars' closes.

Bars for a candlestick chart:

const res = await fetch(
  "https://app.aurelia.build/api/tokens/solana/So11111111111111111111111111111111111111112/candles?res=1h",
  { headers: { Authorization: "Bearer <key>" } },
);
const { bars } = await res.json();
const candles = bars.map(({ t, o, h, l, c }) => ({ time: t, open: o, high: h, low: l, close: c }));

Keep the last bar live

  1. Subscribe to the candles channel with token or pool, res and currency, and wait for subscribed, which names the pool.
  2. Load the bars so far from GET /pools/:chain/:address/candles for that pool.
  3. Apply each candle message by its t: it replaces the bar with that t, or adds it.

Subscribe:

{"op":"subscribe","id":"c","channel":"candles","chain":"solana","token":"So11111111111111111111111111111111111111112","res":"1m","currency":"usd"}

Related

Free to start: 10,000 credits, with no card and no subscription.

Create a free accountRead the API reference