← Back to Blog
Developer Guide

How to Build a Nigerian Stock Market App with the NGX API

May 4, 2026 NGX Pulse Team 12 min read

Building a Nigerian stock market app used to mean scraping unreliable sources, dealing with broken data, or paying thousands of dollars for official NGX data feeds. That changed when the NGX Pulse API launched — a clean, developer-friendly REST API giving programmatic access to live Nigerian Exchange data, free to start.

This guide walks you through building a fully functional Nigerian stock market app from scratch. By the end you will have a working app that displays live NGX stock prices, top gainers and losers, market overview, and corporate disclosures — the core features every Nigerian investment app needs.

Base URL: All NGX Pulse API endpoints live at https://ngxpulse.ng/api. Every request requires your key in the header: X-API-Key: ngxpulse_sk_xxxxxxxx

What You Can Build

Before diving into code, here is what the Nigerian stock market API provides:

All responses are clean JSON. No XML, no SOAP, no legacy formats. If you have built on any modern financial API before, the NGX Pulse API will feel familiar.

Getting Your API Key

Go to ngxpulse.ng/api and register for a free Personal tier key. The Personal tier gives you 100 requests per day — enough to build and test your app. When you are ready to go to production, upgrade to Starter at $19/month for 1,000 requests per day or Professional at $50/month for 10,000 requests per day.

Your API key looks like this:

ngxpulse_sk_xxxxxxxxxxxxxxxxxxxxxxxx

Every request requires this key in the header:

X-API-Key: ngxpulse_sk_xxxxxxxxxxxxxxxxxxxxxxxx

Step 1 — Fetch All NGX Stocks

The most fundamental endpoint. Returns live prices for every NGX listed equity.

const fetchNGXStocks = async (apiKey) => {
  const response = await fetch('https://ngxpulse.ng/api/ngxdata/stocks', {
    headers: {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    }
  });
  const data = await response.json();
  return data;
};

Sample response:

{
  "stocks": [
    {
      "symbol": "DANGCEM",
      "name": "Dangote Cement Plc",
      "current_price": 665.00,
      "previous_close": 650.00,
      "change_percent": 2.31,
      "pct_change_7d": 4.92,
      "volume": 1245890,
      "market_cap": 11341500000000,
      "shares_outstanding": 17040507405,
      "sector": "Industrial Goods",
      "market": "NGX",
      "trade_date": "2026-05-04T00:00:00"
    }
  ],
  "total": 150,
  "total_stocks": 150
}

Step 2 — Get Market Overview

One call for the full market picture — ASI, market cap, breadth, turnover, and top movers. If you are new to interpreting those numbers, read our guide on how to read NGX market data.

const fetchMarketOverview = async (apiKey) => {
  const response = await fetch('https://ngxpulse.ng/api/ngxdata/market', {
    headers: { 'X-API-Key': apiKey }
  });
  const data = await response.json();
  return data;
};

Sample response:

{
  "success": true,
  "data": {
    "asi": 243161.42,
    "pct_change": 0.21,
    "market_cap": 156200000000000,
    "volume": 1469952245,
    "value": 64206659765,
    "deals": 80963,
    "advancers": 42,
    "decliners": 30,
    "unchanged": 61,
    "updated_at": "2026-05-04T15:00:12.000Z"
  }
}

Step 3 — Get a Single Stock Price

For stock detail pages, fetch the live board and select the symbol you want.

const fetchStockSnapshot = async (apiKey, symbol) => {
  const data = await fetchNGXStocks(apiKey);
  return data.stocks.find(
    stock => stock.symbol === symbol.toUpperCase()
  ) || null;
};

// Usage
const dangote = await fetchStockSnapshot(apiKey, 'DANGCEM');
const gtco    = await fetchStockSnapshot(apiKey, 'GTCO');
const mtnn    = await fetchStockSnapshot(apiKey, 'MTNN');

Step 4 — Historical Price Data

One of the most powerful endpoints in the Nigerian stock market API — daily price history going back to January 2017. Nine years of NGX data for backtesting, charting, and technical analysis.

const fetchHistoricalPrices = async (apiKey, symbol, from, to) => {
  const url =
    `https://ngxpulse.ng/api/ngxdata/prices/${symbol}?from=${from}&to=${to}`;

  const response = await fetch(url, {
    headers: { 'X-API-Key': apiKey }
  });

  const data = await response.json();
  return data;
};

// Get GTCO prices for the last year
const history = await fetchHistoricalPrices(
  apiKey,
  'GTCO',
  '2025-01-01',
  '2026-05-04'
);

Sample response:

{
  "success": true,
  "symbol": "GTCO",
  "prices": [
    {
      "symbol": "GTCO",
      "trade_date": "2026-05-04",
      "open_price": 51.90,
      "high_price": 53.00,
      "low_price": 51.80,
      "close_price": 52.80,
      "volume": 6523100
    },
    {
      "symbol": "GTCO",
      "trade_date": "2026-05-03",
      "open_price": 50.40,
      "high_price": 52.10,
      "low_price": 50.20,
      "close_price": 51.90,
      "volume": 4821000
    }
  ],
  "count": 2
}

Response note: Historical data comes back in a { success, symbol, prices, count } wrapper. The rows you want for charts and backtests live inside prices.

Step 5 — Corporate Disclosures

Track dividend notices, earnings releases, rights issues, and board resolutions in real time. Corporate disclosures are one of the most underused data points in Nigerian investment apps. Dividend announcements and earnings releases move stock prices significantly on the NGX.

const fetchDisclosures = async (apiKey) => {
  const response = await fetch('https://ngxpulse.ng/api/ngxdata/disclosures', {
    headers: { 'X-API-Key': apiKey }
  });
  const disclosures = await response.json();
  return disclosures;
};

Surfacing this data in your app gives users an edge over platforms that only show price data.

Step 6 — NASD OTC Market Data

The NGX Pulse API is the only Nigerian stock market API with NASD OTC coverage. The NASD OTC Securities Exchange is Nigeria's second exchange — a regulated OTC market for unlisted public companies. No other developer API provides this data.

const fetchNASDStocks = async (apiKey) => {
  const response = await fetch('https://ngxpulse.ng/api/nasddata/stocks', {
    headers: { 'X-API-Key': apiKey }
  });
  const nasdStocks = await response.json();
  return nasdStocks;
};

If you are building a comprehensive Nigerian capital market app, NASD OTC coverage gives you complete market coverage — both the NGX main board and the OTC market in one API.

Step 7 — Check Market Status

Know whether the market is currently open or closed. Useful for UI state management — showing a live indicator during market hours and a closed state after 4:00 PM WAT.

const fetchMarketStatus = async (apiKey) => {
  const response = await fetch('https://ngxpulse.ng/api/ngxdata/market-status', {
    headers: { 'X-API-Key': apiKey }
  });
  const status = await response.json();
  return status;
};

// When open:
// { "success": true, "data": { "status": "Market Open", "raw_status": "START_INDEX", "is_open": true } }

// When closed:
// { "success": true, "data": { "status": "Closed", "raw_status": "CLOSE", "is_open": false } }

Building the Full App

Now let us put it all together. In a production React app, call your own backend proxy routes so your NGX Pulse key stays server-side.

import { useState, useEffect } from 'react';

const API_BASE = '/api/ngx';

export default function NGXDashboard() {
  const [market,  setMarket]  = useState(null);
  const [stocks,  setStocks]  = useState([]);
  const [status,  setStatus]  = useState(null);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const loadData = async () => {
      try {
        const [marketRes, stocksRes, statusRes] = await Promise.all([
          fetch(`${API_BASE}/market`),
          fetch(`${API_BASE}/stocks`),
          fetch(`${API_BASE}/market-status`),
        ]);

        const [marketJson, stocksJson, statusJson] = await Promise.all([
          marketRes.json(),
          stocksRes.json(),
          statusRes.json(),
        ]);

        setMarket(marketJson.data || null);
        setStocks(stocksJson.stocks || []);
        setStatus(statusJson.data || null);
      } catch (error) {
        console.error('Failed to load NGX data:', error);
      } finally {
        setLoading(false);
      }
    };

    loadData();
    const interval = setInterval(loadData, 30000);
    return () => clearInterval(interval);
  }, []);

  if (loading) return <div>Loading NGX market data...</div>;

  const gainers = stocks
    .filter(s => s.change_percent > 0)
    .sort((a, b) => b.change_percent - a.change_percent)
    .slice(0, 5);

  const losers = stocks
    .filter(s => s.change_percent < 0)
    .sort((a, b) => a.change_percent - b.change_percent)
    .slice(0, 5);

  return (
    <div className="ngx-dashboard">

      {/* Market Status */}
      <div className="market-status">
        <span className={status?.is_open ? 'open' : 'closed'}>
          {status?.is_open ? '● MARKET OPEN' : '○ MARKET CLOSED'}
        </span>
      </div>

      {/* Market Overview */}
      {market && (
        <div className="market-overview">
          <div className="metric">
            <label>All Share Index</label>
            <span>{market.asi?.toLocaleString()}</span>
            <span className={market.pct_change >= 0 ? 'up' : 'down'}>
              {market.pct_change >= 0 ? '▲' : '▼'}
              {Math.abs(market.pct_change || 0).toFixed(2)}%
            </span>
          </div>
          <div className="metric">
            <label>Market Cap</label>
            <span>₦{(market.market_cap / 1e12).toFixed(1)}T</span>
          </div>
          <div className="metric">
            <label>Deals</label>
            <span>{market.deals?.toLocaleString()}</span>
          </div>
          <div className="metric">
            <label>Breadth</label>
            <span>{market.advancers}A / {market.decliners}D</span>
          </div>
        </div>
      )}

      {/* Top Gainers */}
      <div className="movers">
        <h3>Top Gainers</h3>
        {gainers.map(stock => (
          <div key={stock.symbol} className="stock-row">
            <span className="symbol">{stock.symbol}</span>
            <span className="price">₦{stock.current_price?.toLocaleString()}</span>
            <span className="change up">+{stock.change_percent?.toFixed(2)}%</span>
          </div>
        ))}
      </div>

      {/* Full Stock Board */}
      <div className="stock-board">
        <h3>All NGX Stocks</h3>
        <table>
          <thead>
            <tr>
              <th>Symbol</th><th>Name</th>
              <th>Price</th><th>Change</th><th>Volume</th>
            </tr>
          </thead>
          <tbody>
            {stocks.map(stock => (
              <tr key={stock.symbol}>
                <td>{stock.symbol}</td>
                <td>{stock.name}</td>
                <td>₦{stock.current_price?.toLocaleString()}</td>
                <td className={stock.change_percent >= 0 ? 'up' : 'down'}>
                  {stock.change_percent >= 0 ? '+' : ''}
                  {stock.change_percent?.toFixed(2)}%
                </td>
                <td>{stock.volume?.toLocaleString()}</td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>

    </div>
  );
}

Rate Limiting and Best Practices

A few things to keep in mind when building on the Nigerian stock market API:

API Tiers for Production Apps

TierPriceRequests/DayBest For
PersonalFree100Development and testing
Starter$19/month1,000Early-stage apps up to ~50 daily users
Professional$50/month10,000Production apps with growing user base
Institutional$200/monthCustomTrading terminals and enterprise integrations

The Starter tier at $19/month comfortably supports an app with 50 daily active users running standard polling every 30 seconds. The Professional tier at $50/month supports apps with 300–500 daily active users.

What to Build Next

Once your core Nigerian stock market app is running, here are the features that drive the most user engagement:

Get your free NGX API key

The Personal tier is free forever and gives you enough requests to build and test your app. Full documentation, response schemas, and code examples in Python, JavaScript, and cURL are available at the link below.

Get API Key →
Stay ahead of the Nigerian market

Get the NGX closing summary, top movers, dividend updates, and key corporate actions in your inbox every Saturday.

100% free. No spam. Unsubscribe anytime.

How to Get Started with the Nigerian Stock Market API

Get your free NGX API key at ngxpulse.ng/api. The Personal tier is free forever and gives you enough requests to build and test your app. Upgrade when you are ready to launch.

Full API documentation, response schemas, and code examples in Python, JavaScript, and cURL are available at the same link.

If you are building something interesting on Nigerian market data — a portfolio tracker, a stock screener, a quant model, a fintech app — email hello@ngxpulse.ng. We actively support developers building on the NGX API and have helped teams integrate everything from retail investment apps to institutional scoring engines. We also feature promising apps built on our API to our 2,500+ newsletter subscribers — giving your product direct exposure to an engaged audience of Nigerian investors and developers.

Data powered by NGX Pulse — Nigeria's stock market intelligence platform.