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

# Index OHLCV

> Daily and intraday OHLCV bars for major market indices including S&P 500, DJIA, NASDAQ, VIX, and more. Uses I: ticker prefix (e.g., I:SPX). Aggregated from consolidated exchange feeds.

<Info>**Python function:** `getOHLCV()`</Info>

| Specification      | Value                                                                     |
| ------------------ | ------------------------------------------------------------------------- |
| Delivery Frequency | continuous                                                                |
| Data Frequency     | daily, intraday (min/hour)                                                |
| Reporting Lag      | Real-time during market hours                                             |
| Coverage           | Major U.S. indices (S\&P 500, DJIA, NASDAQ, Russell, VIX, sector indices) |
| History            | Since 2003-01-02                                                          |
| Availability       | Free                                                                      |

# Product Overview

## Overview

Index OHLCV provides standardized Open, High, Low, Close, and Volume bars for major market indices. Tickers use the `I:` prefix convention (e.g., `I:SPX` for the S\&P 500, `I:DJI` for the Dow Jones Industrial Average). The legacy `^` prefix (e.g., `^SPX`) is also accepted.

Index values are computed from their constituent securities and disseminated by the index provider or exchange. Scalar Field aggregates tick-level index values into OHLCV bars at the requested granularity.

## Data Pipeline

Index data is sourced from consolidated exchange feeds that disseminate real-time index values:

* **Tick-level collection:** Raw index values are captured at tick granularity as they are published by the exchanges.
* **Bar aggregation:** Tick data is aggregated into OHLCV bars at the requested timeframe (daily, hourly, or minute). Each bar captures the open (first tick), high (maximum), low (minimum), close (last tick), and a transaction count where applicable.
* **Snapshot data:** Real-time snapshots provide the current index value, session high/low, open/close, and change metrics.

## Coverage

* **Major U.S. indices:** S\&P 500 (`I:SPX`), Dow Jones Industrial Average (`I:DJI`), NASDAQ Composite (`I:COMP`), Russell 2000 (`I:RUT`), VIX (`I:VIX`), and many more.
* **Sector and thematic indices:** Technology, healthcare, energy, and other sector-specific indices.
* **Daily history:** Extensive historical data varying by index.
* **Intraday:** Minute and hourly bars available during market hours.

## Supported Modes

| Mode                | Trigger                                  | Notes                                            |
| ------------------- | ---------------------------------------- | ------------------------------------------------ |
| Daily historical    | `start`/`end` as `'YYYY-MM-DD'`          | Timeframe defaults to `'day'`.                   |
| Intraday historical | `start`/`end` as `'YYYY-MM-DDTHH:MM:SS'` | Timeframe defaults to `'min'`; can set `'hour'`. |

## Ticker Convention

Indices use the `I:` prefix. Legacy `^` prefix is also accepted and automatically translated.

| Ticker   | Index                        |
| -------- | ---------------------------- |
| `I:SPX`  | S\&P 500                     |
| `I:DJI`  | Dow Jones Industrial Average |
| `I:COMP` | NASDAQ Composite             |
| `I:RUT`  | Russell 2000                 |
| `I:VIX`  | CBOE Volatility Index (VIX)  |
| `I:NDX`  | NASDAQ-100                   |

# Querying the Data

## Basic Usage

```python theme={null}
from scalarlib import getOHLCV

# Daily S&P 500 bars
data = getOHLCV(tickers=['I:SPX'], start='2025-01-01', end='2025-12-31')
spx_df = data['I:SPX']

# Multiple indices
data = getOHLCV(tickers=['I:SPX', 'I:DJI', 'I:VIX'], start='2025-01-01', end='2025-06-30')

# Intraday minute bars
data = getOHLCV(tickers=['I:SPX'], start='2026-03-24T09:30:00', end='2026-03-24T16:00:00')

# Hourly bars
data = getOHLCV(tickers=['I:VIX'], start='2026-03-20', end='2026-03-24', timeframe='hour')
```

## Parameters

| Parameter   | Type        | Required | Description                                                        |
| ----------- | ----------- | -------- | ------------------------------------------------------------------ |
| `tickers`   | list of str | Yes      | Index tickers with `I:` prefix (e.g., `['I:SPX', 'I:VIX']`).       |
| `start`     | str         | Yes      | Start date (`'YYYY-MM-DD'`) or datetime (`'YYYY-MM-DDTHH:MM:SS'`). |
| `end`       | str         | Yes      | End date or datetime (same format as `start`).                     |
| `timeframe` | str         | No       | `'day'`, `'min'`, or `'hour'`. Default: inferred from date format. |

# Column Definitions

## OHLCV Schema

| Column    | Type            | Description                                                                                           |
| --------- | --------------- | ----------------------------------------------------------------------------------------------------- |
| `ts_recv` | datetime64\[ns] | Bar timestamp. For daily bars, the trading date. For intraday, the bar's start time in New York time. |
| `ticker`  | string          | Index ticker (e.g., `I:SPX`).                                                                         |
| `open`    | float64         | Opening index value of the bar.                                                                       |
| `high`    | float64         | Highest index value during the bar.                                                                   |
| `low`     | float64         | Lowest index value during the bar.                                                                    |
| `close`   | float64         | Closing index value of the bar.                                                                       |
| `volume`  | float64         | Transaction count or notional volume (where available; may be 0 for pure index calculations).         |
