> ## 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.

# Index Chart

> Retrieve historical daily closing values for any NGX market index.

This endpoint returns a time series of daily closing values for a specific NGX market index. Narrow the result set with `from` and `to` date parameters, or use `period` (`7d`, `30d`, `90d`, `1y`, `5y`, `all`) to request a named time window.

In `detailed` format, each data point includes a `normalized_value` field that rebases the index to 100 at the start of the requested period — useful for comparing two indices on the same scale in a single chart.

The statistics block now also includes **`return_1m`**, **`return_3m`**, **`return_1y`**, and **`return_ytd`** — percentage returns versus fixed historical reference points, computed independently of the `period` you requested.

Use `format=chart` for compact `[timestamp, value]` arrays suited for line charting libraries.

For example, to fetch one year of NGX 30 closes in chart-ready format:

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

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

  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/indices/NGX30/chart',
      params={'period': '1y', 'format': 'chart'},
      headers={'Authorization': 'Bearer ngm_live_YOUR_KEY'},
  )
  data = res.json()['data']
  ```
</CodeGroup>


## OpenAPI

````yaml GET /indices/{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:
  /indices/{symbol}/chart:
    get:
      tags:
        - Indices
      summary: Historical index values
      description: >
        Returns a time series of daily closing values for a specific NGX market
        index. Use `period` for a preset lookback window or `from`/`to` for a
        custom range. Returns a statistics block alongside the data array.


        **Plan required:** Hobby
      operationId: getIndexChart
      parameters:
        - name: symbol
          in: path
          description: Index symbol (e.g. `NGX30`). Case-insensitive.
          required: true
          schema:
            type: string
            example: NGX30
        - 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
            default: 30d
        - 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. `detailed` returns objects; `chart` returns compact
            `[timestamp, value]` pairs.
          required: false
          schema:
            type: string
            enum:
              - detailed
              - chart
            default: detailed
      responses:
        '200':
          description: Index chart data retrieved successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/IndexChart'
              examples:
                ngx30Chart:
                  summary: NGX 30 Index chart data
                  value:
                    success: true
                    data:
                      symbol: NGX30
                      format: detailed
                      period: 30d
                      count: 3
                      statistics:
                        start_date: '2026-04-15'
                        end_date: '2026-04-17'
                        start_value: 2819.3
                        end_value: 2841.45
                        change: 22.15
                        change_percent: 0.79
                        min_value: 2819.3
                        max_value: 2841.45
                        return_1m: 3.42
                        return_3m: 8.17
                        return_1y: 24.55
                        return_ytd: 11.83
                      data:
                        - date: '2026-04-15'
                          timestamp: 1744675200000
                          index_value: 2819.3
                          normalized_value: 100
                          daily_change: 0
                          daily_change_percent: 0
                        - date: '2026-04-16'
                          timestamp: 1744761600000
                          index_value: 2829.88
                          normalized_value: 100.38
                          daily_change: 10.58
                          daily_change_percent: 0.38
                        - date: '2026-04-17'
                          timestamp: 1744848000000
                          index_value: 2841.45
                          normalized_value: 100.79
                          daily_change: 11.57
                          daily_change_percent: 0.41
                    meta:
                      plan: starter
                      calls_used: 4823
                      calls_remaining: 95177
                      reset_at: '2026-05-01T00:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/PlanRequired'
        '404':
          description: Index not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Index 'UNKNOWN' not found.
        '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'
    IndexChart:
      type: object
      properties:
        symbol:
          type: string
        format:
          type: string
          enum:
            - detailed
            - chart
        period:
          type: string
        count:
          type: integer
        statistics:
          type: object
          properties:
            start_date:
              type: string
              format: date
            end_date:
              type: string
              format: date
            start_value:
              type: number
            end_value:
              type: number
            change:
              type: number
            change_percent:
              type: number
              nullable: true
            min_value:
              type: number
            max_value:
              type: number
            return_1m:
              type: number
              nullable: true
              description: Percentage return versus the index value 30 days ago.
              example: 3.42
            return_3m:
              type: number
              nullable: true
              description: Percentage return versus the index value 90 days ago.
              example: 8.17
            return_1y:
              type: number
              nullable: true
              description: Percentage return versus the index value 1 year ago.
              example: 24.55
            return_ytd:
              type: number
              nullable: true
              description: >-
                Percentage return from the first trading day of the current
                year.
              example: 11.83
        data:
          type: array
          description: >
            Shape varies by `format`.

            - `detailed`: objects with `date`, `timestamp`, `index_value`,
            `normalized_value` (rebased to 100 at period start), `daily_change`,
            `daily_change_percent`.

            - `chart`: compact `[timestamp, index_value]` arrays.
          items: {}
    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).

````