format=ohlcv option, which returns data in exactly the shape charting libraries expect.
Endpoint used:
GET /companies/{symbol}/chart(Starter plan)
Live demo
Hover over any candle to see the OHLCV breakdown. This demo runs on generated sample data so it works without an API key. The code below swaps that out for real NGX prices.
What the data looks like
When you requestformat=ohlcv, each entry in the data array is a compact array in this order:
Date constructor — no conversion needed.
One thing to watch: ECharts candlestick series expects data in [open, close, lowest, highest] order, which is different from the API’s [open, high, low, close] order. The mapping section below handles this.
Vanilla JavaScript
You can load ECharts from a CDN with no build step required.HTML
JavaScript
React component
If you’re working in React, here’s a reusable component that handles fetching, rendering, and cleaning up the chart when the component unmounts. It also responds to container resizes automatically.React
React
Adding a volume panel
Volume is the sixth value in each array (index 5). ECharts supports multiple grids in a single chart instance, so you can stack a volume bar chart directly beneath the candlesticks and link their x-axes so zoom and pan stay in sync.JavaScript
A few things worth knowing
The data order mismatch. The API returns[timestamp, open, high, low, close, volume]. ECharts candlestick expects [open, close, lowest, highest]. Always map [open, close, low, high] — swapping high and low will render wicks upside down.
Pick a period that fits your use case. 7d and 30d are good for a focused recent view. 1y works well for trend analysis. 5y is what you want for a long-term research screen. Shorter periods load faster and render more smoothly.
The symbol lookup is case-insensitive. DANGCEM, dangcem, and DangCem all resolve to the same company.
Switching symbols without rebuilding the chart. If you’re building a stock picker where users switch between companies, call chart.setOption({ series: [{ data: newCandles }] }) on the existing instance rather than disposing and reinitialising. The transition is smoother and you keep the zoom and scroll position.
Chart endpoint reference
All parameters for
GET /companies/{symbol}/chartCompany profile reference
Pair this with company data for a full stock detail page