time in unix seconds, TradingView-style interval keys accepted as aliases, a dense time axis with no gaps, and pagination that maps one-to-one to getBars. This guide wires GET /v1/token/ohlcv into both TradingView products, then makes the bars live.
- Advanced Charts (the Charting Library): the full-featured widget behind Axiom, GMGN and every major terminal. Free, but TradingView grants the library access on request; you host the files, you feed the data.
- Lightweight Charts: TradingView’s open-source npm package. A few KB, no approval process, perfect for list previews and compact charts.
The symbol convention
A chart needs one string per market. Use the token’s identity as the ticker,<chain>:<address>:
chain is a public chain id (evm:8453, solana), so the same datafeed serves all 18 EVM chains and Solana.
Resolutions
Our intervals cover every resolution the widget offers, seconds included. The full map:The datafeed
The whole integration is one object implementing four methods.getBars is a direct translation of the endpoint’s paging contract: endTime is TradingView’s to (both unix seconds), limit is countBack, and noData is true when a page comes back empty with meta.hasMore false.
datafeed.ts
Live bars
subscribeBars folds the trades stream: subscribe the token on the trades channel and fold each event into the forming bar, exactly the pattern of the terminal guide:
onResetCacheNeededCallback and chart.resetData() so getBars re-seeds the series from REST, then re-subscribe.
Lightweight Charts
The open-source package expectstime in unix seconds: our candles drop in with no conversion at all.
The details that bite
- Time units. REST candles and Lightweight Charts use unix seconds; Advanced Charts bars want milliseconds. The
* 1000ingetBarsis the whole difference. pricescalemust be an integer power of ten. Size it from the token’s price atresolveSymboltime (helper above) or microcap charts render as a flat line.- Volume.
volumeTokenis the base-asset volume, the number a TradingView volume pane expects.volumeis the quote-side value if you prefer notional. - Paging depth. Up to 2000 candles per
getBarscall,limithonoured however quiet the token is; historical pages are immutable and cached, so scroll-back stays fast. - Interval aliases. The API also accepts
1min,5min,15min,30min,60,7d,30ddirectly and echoes the canonical key inmeta.interval, so a partial map still works during a migration from another provider. - Credits. A
getBarspage is 5 credits; live bars bill 1 credit per delivered event, andmaxUpdatesPerMinuteon the subscription caps the burn of a busy token. Full grid on Authentication & Limits.
Build a Trading Terminal
The rest of the terminal around this chart: discovery, tape, panels, portfolio.
Candles (OHLCV) reference
Every parameter and semantic of the endpoint behind the datafeed.