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

# Forex OHLCV

> Daily and intraday OHLCV bars for 1,750+ currency pairs derived from best bid/offer quotes. Uses C: ticker prefix (e.g., C:EURUSD, C:GBPUSD). Aggregated from institutional-grade FX quote feeds.

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

| Specification      | Value                                           |
| ------------------ | ----------------------------------------------- |
| Delivery Frequency | continuous                                      |
| Data Frequency     | daily, intraday (min/hour)                      |
| Reporting Lag      | Real-time during FX market hours                |
| Coverage           | 1,750+ currency pairs (majors, minors, exotics) |
| History            | Since 2003-01-02                                |
| Availability       | Free                                            |

# Product Overview

## Overview

Forex OHLCV provides standardized Open, High, Low, Close, and Volume bars for foreign exchange currency pairs. Tickers use the `C:` prefix convention (e.g., `C:EURUSD` for EUR/USD, `C:GBPUSD` for GBP/USD). The legacy `=X` suffix format (e.g., `EUR=X`) is also accepted.

Unlike equities or crypto, forex OHLCV bars are derived from **quoted bid/ask prices rather than executed trades**. The global FX market is decentralized and over-the-counter, so there is no single consolidated trade tape. Instead, bars are constructed from the best bid/offer (BBO) quotes streaming from institutional-grade liquidity providers.

## Data Pipeline

### Quote-Based Aggregation

Forex bars are constructed from real-time best bid/offer (BBO) quote feeds:

* **Quote sourcing:** BBO quotes are streamed from institutional FX liquidity providers, capturing the best available bid and ask prices at any given moment.
* **Mid-price bars:** OHLCV bar prices (open, high, low, close) are derived from the mid-point of the bid/ask quotes.
* **Volume:** Represents the number of quote updates (tick volume) within the bar window, not notional traded volume — since FX is OTC and has no consolidated trade tape.
* **No phantom bars:** If no new quotes arrive within a time window, no bar is emitted. This transparently indicates periods without market activity.
* **Timestamps:** All timestamps returned by scalarLib are in New York time.

### Real-Time Delivery

* **BBO quotes:** Real-time bid/ask prices with exchange identification and timestamps.
* **Minute aggregates:** Minute-by-minute OHLC bars derived from BBO quotes, streamed continuously.
* **Historical bars:** Custom date ranges and timeframes via REST.

## Coverage

* **Currency pairs:** 1,750+ pairs including all major, minor, and many exotic crosses.
* **Majors:** EUR/USD, GBP/USD, USD/JPY, USD/CHF, AUD/USD, USD/CAD, NZD/USD.
* **Crosses:** EUR/GBP, EUR/JPY, GBP/JPY, AUD/JPY, and hundreds more.
* **Exotics:** USD/TRY, USD/ZAR, USD/MXN, EUR/PLN, and many more.
* **Daily history:** Extensive historical data.
* **Intraday:** Minute and hourly bars available.

## 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'`. New York time. |

## Ticker Convention

Forex tickers use the `C:` prefix with the pair in `BASQUOTE` format (no separator).

| Ticker     | Pair                          |
| ---------- | ----------------------------- |
| `C:EURUSD` | Euro / US Dollar              |
| `C:GBPUSD` | British Pound / US Dollar     |
| `C:USDJPY` | US Dollar / Japanese Yen      |
| `C:USDCHF` | US Dollar / Swiss Franc       |
| `C:AUDUSD` | Australian Dollar / US Dollar |
| `C:USDCAD` | US Dollar / Canadian Dollar   |

# Querying the Data

## Basic Usage

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

# Daily EUR/USD bars
data = getOHLCV(tickers=['C:EURUSD'], start='2025-01-01', end='2025-12-31')
eurusd_df = data['C:EURUSD']

# Multiple pairs
data = getOHLCV(tickers=['C:EURUSD', 'C:GBPUSD', 'C:USDJPY'], start='2025-06-01', end='2025-06-30')

# Intraday minute bars
data = getOHLCV(tickers=['C:EURUSD'], start='2026-03-24T08:00:00', end='2026-03-24T17:00:00')

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

## Parameters

| Parameter   | Type        | Required | Description                                                        |
| ----------- | ----------- | -------- | ------------------------------------------------------------------ |
| `tickers`   | list of str | Yes      | Forex tickers with `C:` prefix (e.g., `['C:EURUSD', 'C:GBPUSD']`). |
| `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 (New York time).                                              |
| `ticker`  | string          | Forex ticker (e.g., `C:EURUSD`).                                            |
| `open`    | float64         | Opening mid-price of the bar (derived from bid/ask mid).                    |
| `high`    | float64         | Highest mid-price during the bar.                                           |
| `low`     | float64         | Lowest mid-price during the bar.                                            |
| `close`   | float64         | Closing mid-price of the bar.                                               |
| `volume`  | float64         | Tick volume — number of quote updates during the bar (not notional volume). |
