> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ngnmarket.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Price Chart

> Retrieve historical price series for an NGX-listed company.

The chart endpoint returns daily price history for a company, going back as far as records exist for that symbol. Each data point includes a timestamp and date, plus close price. Where available, it also includes the full OHLCV fields, VWAP (volume-weighted average price), trade count, and daily change.

Use `from` and `to` (`YYYY-MM-DD`) to narrow results to a specific date range, or use the `period` parameter to request a named time window (`7d`, `30d`, `90d`, `1y`, `5y`, `all`). Three `format` options let you pick the shape that fits your charting library:

* **`detailed`** (default) — full objects per day. Includes `price` as an alias for `close` for backward compatibility, plus `open`, `high`, `low`, `close`, `volume`, `value_traded`, `vwap`, `trade_count`, `change`, `change_percent`.
* **`chart`** — compact `[timestamp, close]` arrays. Backward-compatible with the previous API behaviour, suited for line charts.
* **`ohlcv`** — compact `[timestamp, open, high, low, close, volume]` arrays. Pass this directly to TradingView Lightweight Charts, ApexCharts, or Highcharts candlestick series.

<Note>
  `close` is the only field guaranteed to be present on every data point. Depending on the company and date, `open`, `high`, `low`, `volume`, `value_traded`, `vwap`, `trade_count`, `change`, and `change_percent` may come back as `null`.

  This means no intraday range data is available for that specific day. It does not mean the day itself is missing or that the value is zero. This applies in both `detailed` (named fields) and `ohlcv` (positional array, where a `null` appears in place of the missing element) formats.

  When rendering a candlestick chart, check for `null` before drawing the candle body and fall back to a marker or line segment on the close price for those points. See the [candlestick chart guide](/guides/candlestick-chart#handling-missing-ohlc-data) to understand better.
</Note>

A statistics block summarises the full range — first/last price, min, max, and total change — so you can render a summary card without extra computation.

For example, to fetch one year of DANGCEM data in candlestick format:

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.ngnmarket.com/v1/companies/DANGCEM/chart?period=1y&format=ohlcv" \
    -H "Authorization: Bearer ngm_live_YOUR_KEY"
  ```

  ```javascript JavaScript theme={null}
  const url = new URL('https://api.ngnmarket.com/v1/companies/DANGCEM/chart');
  url.searchParams.set('period', '1y');
  url.searchParams.set('format', 'ohlcv');

  const res = await fetch(url, {
    headers: { Authorization: 'Bearer ngm_live_YOUR_KEY' },
  });
  const { data } = await res.json();
  ```

  ```python Python theme={null}
  import requests

  res = requests.get(
      'https://api.ngnmarket.com/v1/companies/DANGCEM/chart',
      params={'period': '1y', 'format': 'ohlcv'},
      headers={'Authorization': 'Bearer ngm_live_YOUR_KEY'},
  )
  data = res.json()['data']
  ```
</CodeGroup>

<Card title="Build a candlestick chart" icon="chart-candlestick" href="/guides/candlestick-chart">
  Step-by-step guide showing how to fetch OHLCV data and render it as an interactive candlestick chart with TradingView Lightweight Charts. Includes a live demo, vanilla JS, and a React component.
</Card>


## OpenAPI

````yaml GET /companies/{symbol}/chart
openapi: 3.1.0
info:
  title: NGN Market API
  version: '1.0'
  description: >
    The NGN Market API provides programmatic access to Nigerian Exchange Group
    (NGX) market data, including equities, forex rates, company profiles,
    indices, bonds, and financial news.


    ## Base URL


    All endpoints are served from:


    ```

    https://api.ngnmarket.com/v1

    ```


    ## Authentication


    Every request requires a Bearer token in the `Authorization` header:


    ```

    Authorization: Bearer ngm_live_YOUR_KEY

    ```


    Generate and manage your API keys from the [developer
    dashboard](https://ngnmarket.com/developer).


    ## Plans & Quotas


    | Plan | Monthly Calls | Requests/min | Price |

    | :--- | ---: | ---: | :--- |

    | Free | 3,000 | 30 | Free |

    | Hobby | 10,000 | 60 | ₦15,000/mo |

    | Starter | 100,000 | 120 | ₦50,000/mo |

    | Growth | 500,000 | 200 | ₦200,000/mo |

    | Business | 2,000,000 | 300 | ₦700,000/mo |

    | Enterprise | Unlimited | Unlimited | Custom |


    Every response includes a `meta` object showing your current usage and
    remaining quota. Exceeding the per-minute rate limit returns `429
    RATE_LIMITED`. Exceeding the monthly quota returns `429 QUOTA_EXCEEDED`.


    ## Response Envelope


    All responses use a consistent JSON envelope:


    ```json

    {
      "success": true,
      "data": { ... },
      "meta": {
        "plan": "starter",
        "calls_used": 4821,
        "calls_remaining": 95179,
        "reset_at": "2026-05-01T00:00:00.000Z"
      }
    }

    ```
  contact:
    name: NGN Market Support
    email: support@ngnmarket.com
    url: https://ngnmarket.com
  license:
    name: Proprietary
servers:
  - url: https://api.ngnmarket.com/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Market
    description: >-
      Daily market snapshots, top trades, movers, market breadth, sectors, and
      YTD performers.
  - name: Companies
    description: >-
      Browse, search, and retrieve profiles, price charts, and financial
      statements for NGX-listed companies.
  - name: Forex
    description: Current and historical NGN exchange rates against major currencies.
  - name: Indices
    description: >-
      All NGX market indices, including list, detail with constituents, and
      historical chart data.
  - name: ETFs
    description: >-
      NGX-listed Exchange Traded Funds and ETPs — list, full fund detail, and
      historical daily price data.
  - name: Bonds
    description: >-
      NGX-listed bond instruments with issuer details, coupon rates, and
      maturity dates.
  - name: Disclosures
    description: >-
      Official corporate filings from NGX-listed companies (financial
      statements, AGM notices, board meetings, director dealings, earnings
      forecasts). Sourced from NGX Group and updated twice daily.
  - name: Blog
    description: >-
      Published NGN Market blog posts. List, search, and filter by category or
      company.
  - name: Dividends
    description: >-
      Market-wide NGX dividend calendar. Browse upcoming and recently paid
      dividends across all listed companies with optional search and pagination.
  - name: Account
    description: >-
      Quota status, 30-day request analytics, and paginated request logs for the
      authenticated user.
paths:
  /companies/{symbol}/chart:
    get:
      tags:
        - Companies
      summary: Historical price series
      description: >
        Returns the complete OHLCV (open, high, low, close, volume) history for
        a company sourced from daily exchange data. Each data point includes a
        Unix timestamp, calendar date, and full OHLCV fields plus VWAP, trade
        count, and daily change. Use `format=chart` for compact `[timestamp,
        close]` pairs or `format=ohlcv` for candlestick-ready `[timestamp, open,
        high, low, close, volume]` arrays.


        **Plan required:** Hobby
      operationId: getCompanyChart
      parameters:
        - name: symbol
          in: path
          description: NGX ticker symbol (e.g. `DANGCEM`). Case-insensitive.
          required: true
          schema:
            type: string
            example: DANGCEM
        - name: period
          in: query
          description: Preset lookback window. Ignored when `from`/`to` are supplied.
          required: false
          schema:
            type: string
            enum:
              - 7d
              - 30d
              - 90d
              - 1y
              - 5y
              - all
        - name: from
          in: query
          description: >-
            Start date in `YYYY-MM-DD` format (inclusive). Takes priority over
            `period`.
          required: false
          schema:
            type: string
            format: date
            example: '2026-01-01'
        - name: to
          in: query
          description: End date in `YYYY-MM-DD` format (inclusive). Use with `from`.
          required: false
          schema:
            type: string
            format: date
            example: '2026-04-17'
        - name: format
          in: query
          description: >
            Response shape for data points.

            - `detailed` (default): full objects with OHLCV, VWAP, and change
            fields. Includes `price` as an alias for `close` for backward
            compatibility.

            - `chart`: compact `[timestamp, close]` arrays — backward-compatible
            line chart format.

            - `ohlcv`: compact `[timestamp, open, high, low, close, volume]`
            arrays — use this for candlestick charts.
          required: false
          schema:
            type: string
            enum:
              - detailed
              - chart
              - ohlcv
            default: detailed
      responses:
        '200':
          description: Price chart data retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/CompanyChart'
              examples:
                detailedFormat:
                  summary: Detailed format (default)
                  value:
                    success: true
                    data:
                      symbol: DANGCEM
                      company_name: Dangote Cement Plc
                      format: detailed
                      period: 30d
                      count: 2
                      data:
                        - timestamp: 1744243200000
                          date: '2026-04-10'
                          price: 295
                          open: 293
                          high: 297.5
                          low: 292
                          close: 295
                          volume: 3821000
                          value_traded: 1128270500
                          vwap: 295.28
                          trade_count: 289
                          change: -1.5
                          change_percent: -0.5063
                          source: historical
                        - timestamp: 1744502400000
                          date: '2026-04-13'
                          price: 302.5
                          open: 296
                          high: 303
                          low: 295.5
                          close: 302.5
                          volume: 5143000
                          value_traded: 1556300000
                          vwap: 302.54
                          trade_count: 412
                          change: 7.5
                          change_percent: 2.5423
                          source: historical
                      statistics:
                        first_price: 295
                        last_price: 302.5
                        min_price: 295
                        max_price: 302.5
                        price_change: 7.5
                        price_change_percent: 2.5423
                        start_date: '2026-04-10'
                        end_date: '2026-04-13'
                    meta:
                      plan: starter
                      calls_used: 4822
                      calls_remaining: 95178
                      reset_at: '2026-05-01T00:00:00.000Z'
                chartFormat:
                  summary: Compact chart format — [timestamp, close]
                  value:
                    success: true
                    data:
                      symbol: DANGCEM
                      company_name: Dangote Cement Plc
                      format: chart
                      period: 30d
                      count: 2
                      data:
                        - - 1744243200000
                          - 295
                        - - 1744502400000
                          - 302.5
                      statistics:
                        first_price: 295
                        last_price: 302.5
                        min_price: 295
                        max_price: 302.5
                        price_change: 7.5
                        price_change_percent: 2.5423
                        start_date: '2026-04-10'
                        end_date: '2026-04-13'
                    meta:
                      plan: starter
                      calls_used: 4823
                      calls_remaining: 95177
                      reset_at: '2026-05-01T00:00:00.000Z'
                ohlcvFormat:
                  summary: OHLCV format — [timestamp, open, high, low, close, volume]
                  value:
                    success: true
                    data:
                      symbol: DANGCEM
                      company_name: Dangote Cement Plc
                      format: ohlcv
                      period: 30d
                      count: 2
                      data:
                        - - 1744243200000
                          - 293
                          - 297.5
                          - 292
                          - 295
                          - 3821000
                        - - 1744502400000
                          - 296
                          - 303
                          - 295.5
                          - 302.5
                          - 5143000
                      statistics:
                        first_price: 295
                        last_price: 302.5
                        min_price: 295
                        max_price: 302.5
                        price_change: 7.5
                        price_change_percent: 2.5423
                        start_date: '2026-04-10'
                        end_date: '2026-04-13'
                    meta:
                      plan: starter
                      calls_used: 4824
                      calls_remaining: 95176
                      reset_at: '2026-05-01T00:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/PlanRequired'
        '404':
          description: No chart data available for this symbol.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No chart data available for DANGCEM.
        '429':
          $ref: '#/components/responses/QuotaExceeded'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    SuccessEnvelope:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          const: true
        meta:
          $ref: '#/components/schemas/Meta'
    CompanyChart:
      type: object
      properties:
        symbol:
          type: string
        company_name:
          type: string
        format:
          type: string
          enum:
            - detailed
            - chart
            - ohlcv
          description: >-
            `detailed` = full objects, `chart` = [timestamp, close], `ohlcv` =
            [timestamp, open, high, low, close, volume]
        period:
          type: string
          description: The period used for this request (e.g. "30d", "custom").
        count:
          type: integer
        data:
          type: array
          description: >
            Shape varies by `format`.

            - `detailed`: array of objects with `timestamp`, `date`, `price`
            (alias for close), `open`, `high`, `low`, `close`, `volume`,
            `value_traded`, `vwap`, `trade_count`, `change`, `change_percent`,
            `source`.

            - `chart`: compact `[timestamp, close]` arrays.

            - `ohlcv`: compact `[timestamp, open, high, low, close, volume]`
            arrays.
          items: {}
        statistics:
          type: object
          properties:
            first_price:
              type: number
            last_price:
              type: number
            min_price:
              type: number
            max_price:
              type: number
            price_change:
              type: number
            price_change_percent:
              type: number
              nullable: true
            start_date:
              type: string
              format: date
            end_date:
              type: string
              format: date
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error identifier.
              example: NOT_FOUND
            message:
              type: string
              description: Human-readable error description.
              example: Resource not found.
            required_plan:
              type: string
              description: _(PLAN_REQUIRED only)_ Minimum plan needed.
            current_plan:
              type: string
              description: _(PLAN_REQUIRED only)_ Your current plan.
    Meta:
      type: object
      description: Quota and plan metadata included on every authenticated response.
      properties:
        plan:
          type: string
          description: Current plan name.
          enum:
            - free
            - starter
            - growth
            - business
            - enterprise
          example: starter
        calls_used:
          type: integer
          description: Total calls made this calendar month across all your keys.
          example: 4821
        calls_remaining:
          type: integer
          description: Calls remaining before your quota is exhausted.
          example: 95179
        reset_at:
          type: string
          format: date-time
          description: ISO 8601 UTC timestamp of your next quota reset (1st of next month).
          example: '2026-05-01T00:00:00.000Z'
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            missingKey:
              summary: Missing Authorization header
              value:
                success: false
                error:
                  code: MISSING_API_KEY
                  message: 'Provide your API key via: Authorization: Bearer <key>'
            invalidKey:
              summary: Invalid or revoked key
              value:
                success: false
                error:
                  code: INVALID_API_KEY
                  message: API key not found or revoked.
    PlanRequired:
      description: Endpoint requires a higher plan.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: PLAN_REQUIRED
              message: This endpoint requires a starter plan or higher.
              required_plan: starter
              current_plan: free
    QuotaExceeded:
      description: Monthly call limit reached.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ErrorEnvelope'
              - type: object
                properties:
                  meta:
                    $ref: '#/components/schemas/Meta'
          example:
            success: false
            error:
              code: QUOTA_EXCEEDED
              message: >-
                Monthly call limit of 100,000 reached. Resets on
                2026-05-01T00:00:00.000Z.
            meta:
              plan: starter
              calls_used: 100000
              calls_remaining: 0
              reset_at: '2026-05-01T00:00:00.000Z'
    ServerError:
      description: Unexpected server-side failure. Safe to retry with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: SERVER_ERROR
              message: Something went wrong on our end. Please try again.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ngm_live_*
      description: >
        Pass your API key as a Bearer token: `Authorization: Bearer
        ngm_live_YOUR_KEY`.

        Generate keys at
        [ngnmarket.com/dashboard/developer](https://ngnmarket.com/developer).

````