Python function: getOHLCV()
| Specification | Value |
|---|
| Delivery Frequency | continuous |
| Data Frequency | daily, intraday (min/hour) |
| Reporting Lag | Daily bars on market close; intraday bars in near-real-time |
| Coverage | 10,000+ U.S. equities and ETFs (NYSE, NASDAQ, AMEX, BATS) |
| History | Since 2003-01-02 |
| Availability | Free |
Product Overview
Overview
Equity & ETF OHLCV provides standardized Open, High, Low, Close, and Volume price bars for U.S.-listed equities and exchange-traded funds. The dataset supports daily, hourly, and minute-level granularity, enabling everything from long-horizon backtesting to intraday signal research.
Daily bars are maintained in an internal repository that is continuously updated and automatically backfilled from exchange-consolidated trade feeds. Intraday bars (minute and hourly) are sourced from real-time aggregated exchange data.
Data Pipeline
Daily Bars
Scalar Field maintains a repository of daily OHLCV bars sourced from consolidated exchange feeds:
- Continuous updates: New daily bars are appended as they become available after market close.
- Automatic backfill: If gaps are detected for any ticker, the system automatically backfills from the upstream exchange-consolidated data provider.
- Corporate actions: Prices are adjusted for splits and dividends to produce a continuous adjusted price series.
Intraday Bars
Minute and hourly bars are constructed from real-time trade data:
- Trade-level aggregation: OHLCV bars are built from tick-level trade data. Each trade carries “sale condition” flags that determine which OHLCV components it updates — for example, certain off-exchange trade conditions may update volume but not the high/low prices. This follows Securities Information Processor (SIP) consolidated processing guidelines.
- Granularity: 1-minute bars are the base unit; hourly bars are aggregated from minute bars.
- Timestamps: All intraday timestamps are in New York (Eastern) time.
Coverage
- Universe: 10,000+ U.S.-listed equities and ETFs (NYSE, NASDAQ, AMEX, BATS, and other lit venues).
- Daily history: Back to 2003 for most liquid names; varies by listing date for newer securities.
- Intraday history: Approximately 2 years of minute and hourly bars.
- Update frequency: Daily bars updated on market close; intraday bars available in near-real-time during market hours (typically 10–20 minutes after open, ending 10–20 minutes before close).
Supported Modes
| Mode | Trigger | Notes |
|---|
| Daily historical | start/end as 'YYYY-MM-DD' | Timeframe defaults to 'day'. Stale parquet data is automatically backfilled. |
| Intraday historical | start/end as 'YYYY-MM-DDTHH:MM:SS' | Timeframe defaults to 'min'; can set 'hour'. New York timezone. |
| Near-real-time | Set start/end to recent datetimes | Returns 1-minute bars for the requested window. |
Querying the Data
Basic Usage
from scalarlib import getOHLCV
# Daily bars for multiple equities
data = getOHLCV(tickers=['AAPL', 'MSFT', 'NVDA'], start='2025-01-01', end='2025-12-31')
aapl_df = data['AAPL']
# Intraday minute bars
data = getOHLCV(tickers=['AAPL'], start='2026-03-24T09:30:00', end='2026-03-24T16:00:00')
# Hourly bars with explicit timeframe
data = getOHLCV(tickers=['SPY'], start='2025-06-16', end='2025-06-18', timeframe='hour')
# Near-real-time: last 30 minutes
from datetime import datetime, timedelta
now = datetime.now()
data = getOHLCV(
tickers=['AAPL'],
start=(now - timedelta(minutes=30)).strftime('%Y-%m-%dT%H:%M:%S'),
end=now.strftime('%Y-%m-%dT%H:%M:%S')
)
Parameters
| Parameter | Type | Required | Description |
|---|
tickers | list of str | Yes | Equity/ETF ticker symbols (e.g., ['AAPL', 'SPY']). |
start | str | Yes | Start date ('YYYY-MM-DD') or datetime ('YYYY-MM-DDTHH:MM:SS', New York time). |
end | str | Yes | End date or datetime (same format as start). |
timeframe | str | No | 'day', 'min', or 'hour'. Default: inferred from date format — date-only defaults to daily, datetime defaults to minute. |
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 | Ticker symbol (e.g., AAPL, SPY). |
open | float64 | Opening price of the bar. |
high | float64 | Highest traded price during the bar. |
low | float64 | Lowest traded price during the bar. |
close | float64 | Closing price of the bar. |
volume | int64 | Number of shares traded during the bar. |