Data API
On this page
Data API
Every data API exposes only information available by the current simulation time and returns a pandas DataFrame indexed by UTC timestamps. Missing data raises DataNotPrefetched — check your universe and __data__ declaration.
history#
The past window bars, ending at the last closed bar (the forming bar is never included). The UTC DatetimeIndex is named ts.
| Parameter | Default | Description |
|---|---|---|
| instrument | — | e.g. binance:UPERP:BTCUSDT |
| fields | 'close' | open/high/low/close/volume/quote_volume, string or list |
| window | 100 | number of bars |
| freq | run frequency | may be a coarser frequency (declared in extra_freqs) |
Read completed history for multiple instruments in one bounded call. Every returned frame uses the same UTC ts index as history.
Canonical completed OHLCV + quote_volume K-lines in every mode, with a UTC ts index.
Returns the current best bid and ask, not a full-depth order book. Backtest has no historical BBO archive, so it exposes the latest completed-bar close as a BAR_PROXY; this is useful for portable Strategy code but does not affect the separate backtest fill model. Paper and Live read a current OnePort BBO. Invalid or stale OnePort quotes are unavailable and cannot be used for an order.
funding_history#
Settled funding rates. Columns: rate (positive = longs pay shorts, normalized across venues), interval_hours (the venue's actual interval). Indexed by settlement time.
open_interest · liquidations#
Open interest (~5min sampling). Columns: oi and price. oi keeps the venue-native position_size unit and must not be compared or aggregated across venues. Cross-venue OI requires a future authoritative normalized API field; OPR never converts it downstream. Requires ‘oi’ in extra_freqs.
Liquidation events (tick-level, since 2025-04-18, 5 venues). Columns: price / qty / value / side. side is the venue's raw direction and is not normalized across venues; do not infer long- or short-liquidation direction from it. Requires ‘liq’ in extra_freqs.
Availability by execution mode#
| Surface | Backtest | Paper | Live |
|---|---|---|---|
| history · history_many · klines | UTC ts | UTC ts | UTC ts |
| bbo · orderbook | BAR_PROXY · completed close | OnePort BBO | OnePort BBO |
| ctx.accounts · order_status · open_orders | Available | Available | Available |
| OI · liq · snapshot · ticker · trade_flow · ADL history | Historical only | Rejected | Rejected |
market_snapshots#
Hourly monitoring snapshots keyed by the venue's raw symbol. Nullable columns: bid_price / ask_price / mid_price, open_interest / open_interest_usd, volume_24h_usd_m, funding_rate_8h / funding_period_hours, next_funding_ts and oi_api_ts. Requires ‘snapshot’ in extra_freqs.
derivative_tickers#
The final received derivative-ticker observation for each UTC minute. Nullable columns: funding_ts / funding_rate / predicted_funding_rate, open_interest, last_price / index_price / mark_price. minute_ts is the source minute start; the index is the source receive time. Requires ‘ticker’ in extra_freqs.
trade_flow#
Completed one-minute trade aggregates. Columns: base_volume / quote_volume, taker_buy_base_volume / taker_sell_base_volume, taker_buy_quote_volume / taker_sell_quote_volume and trade_count. The index is minute_close_time, and a row becomes visible only at that close boundary. Requires ‘trade_flow’ in extra_freqs.
Properties#
| ctx.now | current simulation timestamp at bar close |
| ctx.universe | instrument tuple |
| ctx.frequency | run frequency |
| ctx.params | custom parameters passed at submission |
| ctx.state | durable finite-JSON state, max 256 KiB |