Solana Tracker LogoSolana Tracker
Swap
Developers
⌘K
Affiliate
All Resources
Get Solana OHLCV Candles Without Building Price History
Data APITypeScriptJune 4, 20265 min read

Get Solana OHLCV Candles Without Building Price History

Fetch OHLCV bars for Solana tokens with timestamp-safe examples for TradingView charts and backtests.

  • data-api,
  • ohlcv,
  • chart,
  • tradingview,
  • typescript
Solana Data API›

Charting starts with timestamp discipline

To chart a Solana token you need OHLCV bars, call GET /chart/{mint}?type=1h (or use client.getChartData()) and you get timestamped open, high, low, close, and volume arrays ready for TradingView or any chart library.

What you need

  • A Solana Tracker API key (free, 2,500 requests/month)
  • Node.js 18+

Step 1: Fetch hourly bars

import { Client } from '@solana-tracker/data-api';

const client = new Client({ apiKey: process.env.ST_API_KEY, baseUrl: 'https://data.solanatracker.io' });
const now = Math.floor(Date.now() / 1000);
const weekAgo = now - 7 * 24 * 3600;

const chart = await client.getChartData({
  tokenAddress: MINT,
  type: '1h',
  timeFrom: weekAgo,
  timeTo: now,
  removeOutliers: true,
});

const bars = chart.oclhv ?? chart.ohlcv ?? [];

Step 2: Map to TradingView format

TradingView expects time in seconds (UTC), not milliseconds:

const tvBars = bars.map((b) => ({
  time: b.time,
  open: b.open,
  high: b.high,
  low: b.low,
  close: b.close,
  volume: b.volume,
}));

Step 3: Pick the right interval

Common type values: 1m, 5m, 15m, 1h, 4h, 1d. Use shorter intervals for scalping dashboards, longer for weekly views. Pass time_from / time_to as Unix seconds to limit the window and save credits.

Step 4: Pool-specific charts

If a token trades on multiple pools, pass the pool address for pool-scoped OHLCV:

const poolChart = await client.getPoolChartData({
  tokenAddress: MINT,
  poolAddress: POOL_ID,
  type: '15m',
});

Pitfall: mixing millisecond timestamps with the API's second-based time field will shift your chart by orders of magnitude. Always confirm the unit before plotting.

FAQ

Does the chart include volume?

Yes, each bar includes volume (and optionally volumeUsd depending on pool).

Can I get market-cap candles instead of price?

Pass marketCap: true in getChartData().

How is this different from the price REST endpoint?

/price returns the latest quote. /chart returns historical bars for plotting.

Related: Get a Solana token price (REST) -> · Solana Data API

Download the example

Clone the full runnable project on GitHub, npm install && npm start with your keys in .env. Or open it in StackBlitz to run in your browser (free). See the tutorial for step-by-step context.

View source on GitHub›Run in StackBlitz›

Runnable Node.js project — clone from GitHub, add keys to .env, then npm start. StackBlitz runs REST and Datastream examples in your browser for free.

Related Guides

Rank Solana Traders by PnL, Not Follower Count
Data API

Rank Solana Traders by PnL, Not Follower Count

Read more
Stream a Live Solana Trade Tape over WebSocket
Data API

Stream a Live Solana Trade Tape over WebSocket

Read more
Build a Solana Token Screener with Search Filters
Data API

Build a Solana Token Screener with Search Filters

Read more

Products

  • Data API
  • Pump.fun API
  • Solana RPC
  • Dedicated Nodes
  • Yellowstone gRPC
  • Raptor Swap API
  • Enterprise

Trading

  • Swap
  • Latest Tokens
  • Trending
  • Top Gainers
  • Memescope
  • Whale Watch
  • KOL Tracker

Tools

  • Wallet Tracker
  • Rugcheck
  • PnL Leaderboard
  • KOLScan
  • Axiom Leaderboard
  • Photon Leaderboard
  • Bloom Leaderboard
  • FOMO Leaderboard
  • GMGN Leaderboard
  • Pump.fun App Leaderboard
  • Terminal Leaderboard
  • Platform Compare
  • My Positions
  • Teams

Resources

  • Developer Guides
  • Blog
  • Documentation
  • API Reference
  • Status
  • Affiliate Program — 25% recurring, uncapped
Solana TrackerSolana Tracker© 2026
Terms of ServicePrivacy PolicyContact