Skip to main content
Python function: getOHLCV()
SpecificationValue
Delivery Frequencycontinuous
Data Frequencydaily, intraday (min/hour)
Reporting LagReal-time
CoverageMajor cryptocurrency pairs (BTC, ETH, SOL, DOGE, XRP, and more vs USD/BTC/ETH/USDT)
HistorySince 2003-01-02
AvailabilityFree

Product Overview

Overview

Crypto OHLCV provides standardized Open, High, Low, Close, and Volume price bars for cryptocurrencies. Tickers use the X: prefix convention (e.g., X:BTCUSD for Bitcoin/USD, X:ETHUSD for Ethereum/USD). The legacy hyphenated format (e.g., BTC-USD) is also accepted. Crypto OHLCV bars are constructed by aggregating qualifying trades from multiple cryptocurrency exchanges. Each trade carries eligibility flags (“sale conditions”) that determine which OHLCV components it updates, following a methodology analogous to Securities Information Processor (SIP) consolidated processing in equity markets. All timestamps returned by scalarLib are in New York time.

Data Pipeline

Trade Aggregation

Crypto OHLCV bars are built from tick-level trade data collected across major cryptocurrency exchanges:
  • Multi-exchange sourcing: Trades are ingested from qualifying centralized exchanges, providing broad market coverage and reducing the impact of single-venue anomalies.
  • Trade eligibility: Each trade record includes price, size, exchange identification, trade conditions, and a precise timestamp. Sale condition flags determine which trades update specific OHLCV components — for example, a trade may update volume but not the high/low if it carries certain condition codes.
  • Bar construction: Qualifying trades within each time window are aggregated into a single OHLCV bar with open (first qualifying trade), high (max), low (min), close (last qualifying trade), volume (sum of qualifying trade sizes), and a volume-weighted average price (VWAP).
  • No phantom bars: If no qualifying trades occur within a time window, no bar is emitted. This transparently indicates periods without trading activity.

Real-Time Delivery

  • REST API: Historical aggregated bars over custom date ranges and time intervals.
  • WebSocket: Minute-by-minute aggregated bars streamed in real-time. If no trades occur in a given minute, no bar is emitted.

Coverage

  • Pairs: Major cryptocurrency pairs including BTC, ETH, SOL, DOGE, XRP, ADA, AVAX, MATIC, LINK, DOT, and many more — all quoted against USD, BTC, ETH, or USDT.
  • Daily history: Extensive historical data varying by pair.
  • Intraday: Minute and hourly bars available.
  • Timestamp convention: All timestamps returned by scalarLib are in New York time (the upstream exchange data is collected in UTC but converted to New York time before delivery).

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

Crypto tickers use the X: prefix with the pair in BASEQUOTE format.
TickerPair
X:BTCUSDBitcoin / US Dollar
X:ETHUSDEthereum / US Dollar
X:SOLUSDSolana / US Dollar
X:DOGEUSDDogecoin / US Dollar
X:XRPUSDXRP / US Dollar
X:BTCETHBitcoin / Ethereum

Querying the Data

Basic Usage

from scalarlib import getOHLCV

# Daily Bitcoin bars
data = getOHLCV(tickers=['X:BTCUSD'], start='2025-01-01', end='2025-12-31')
btc_df = data['X:BTCUSD']

# Multiple crypto pairs
data = getOHLCV(tickers=['X:BTCUSD', 'X:ETHUSD', 'X:SOLUSD'], start='2025-06-01', end='2025-06-30')

# Intraday minute bars
data = getOHLCV(tickers=['X:BTCUSD'], start='2026-03-24T09:00:00', end='2026-03-24T17:00:00')

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

Parameters

ParameterTypeRequiredDescription
tickerslist of strYesCrypto tickers with X: prefix (e.g., ['X:BTCUSD', 'X:ETHUSD']).
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).
tickerstringCrypto ticker (e.g., X:BTCUSD).
openfloat64Opening price of the bar (first qualifying trade).
highfloat64Highest price during the bar.
lowfloat64Lowest price during the bar.
closefloat64Closing price of the bar (last qualifying trade).
volumefloat64Total trading volume during the bar (in base currency units).