Skip to main content
Every serious terminal renders its chart with TradingView, and our candles were shaped for it: time in unix seconds, TradingView-style interval keys accepted as aliases, traded bars only (TradingView’s has_empty_bars draws the empty ones if you want them), 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 19 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
Two behaviors you get without writing anything: every candle opens at the previous traded close, so a thin token charts as one connected series (pass fill=true if you want a flat bar for every empty bucket), and a token that graduated from a bonding curve draws one continuous series across the migration, curve history stitched in server-side. Mounting the widget is standard TradingView:

Live bars

subscribeBars is one subscription on the ohlcv channel: the forming candle of the same series as getBars (same main pool, same candle shape, time in unix seconds), pushed as it changes, then each closed candle the moment its bucket rolls over. Every event is the complete candle: hand it to onTick, TradingView replaces the bar with the same time. stream is the connection helper of the terminal guide.
On a WebSocket reconnect, subscribe again with since set to the last cursor you received: the candles closed meanwhile come back first, then the forming one. If the stream answers REPLAY_TOO_OLD, call the widget’s onResetCacheNeededCallback and chart.resetData() so getBars re-seeds the series from REST.

Lightweight Charts

The open-source package expects time 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 * 1000 in getBars is the whole difference.
  • pricescale must be an integer power of ten. Size it from the token’s price at resolveSymbol time (helper above) or microcap charts render as a flat line.
  • Volume. volumeToken is the base-asset volume, the number a TradingView volume pane expects. volume is the quote-side value if you prefer notional.
  • Paging depth. Up to 2000 candles per getBars call, limit honoured 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, 30d directly and echoes the canonical key in meta.interval, so a partial map still works during a migration from another provider.
  • Credits. A getBars page is 5 credits; live bars bill 1 credit per update a trade moved, and updatePeriod on the subscription (say 1000 for one update per second) bounds 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.

Token Candles reference

Every parameter and semantic of the endpoint behind the datafeed.