Skip to main content
Python function: getOHLCV()
SpecificationValue
Delivery Frequencycontinuous
Data Frequencydaily, intraday (min/hour)
Reporting LagReal-time during FX market hours
Coverage1,750+ currency pairs (majors, minors, exotics)
HistorySince 2003-01-02
AvailabilityFree

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

ModeTriggerNotes
Daily historicalstart/end as 'YYYY-MM-DD'Timeframe defaults to 'day'.
Intraday historicalstart/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).
TickerPair
C:EURUSDEuro / US Dollar
C:GBPUSDBritish Pound / US Dollar
C:USDJPYUS Dollar / Japanese Yen
C:USDCHFUS Dollar / Swiss Franc
C:AUDUSDAustralian Dollar / US Dollar
C:USDCADUS Dollar / Canadian Dollar

Querying the Data

Basic Usage

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

ParameterTypeRequiredDescription
tickerslist of strYesForex tickers with C: prefix (e.g., ['C:EURUSD', 'C:GBPUSD']).
startstrYesStart date ('YYYY-MM-DD') or datetime ('YYYY-MM-DDTHH:MM:SS').
endstrYesEnd date or datetime (same format as start).
timeframestrNo'day', 'min', or 'hour'. Default: inferred from date format.

Column Definitions

OHLCV Schema

ColumnTypeDescription
ts_recvdatetime64[ns]Bar timestamp (New York time).
tickerstringForex ticker (e.g., C:EURUSD).
openfloat64Opening mid-price of the bar (derived from bid/ask mid).
highfloat64Highest mid-price during the bar.
lowfloat64Lowest mid-price during the bar.
closefloat64Closing mid-price of the bar.
volumefloat64Tick volume — number of quote updates during the bar (not notional volume).