DocsReferenceData accessor reference
ReferenceReference

Data accessor reference

Three market and calendar accessors, bar, option, and time, return Signals. Four backtest-context accessors, book(), position(), leg(slug), and option.contract(...), return Tables you project a single column from with field access. Which accessor is legal depends on the evaluation context. This is the lookup companion to the data accessors tour: signatures, parameters, and returned columns live here; the conceptual teaching (spines, sampling, alignment) lives there.

Updated Jul 20266 min read

Every option.* read is a 2D bilinear interpolation across the option surface, not a raw per-contract quote.

Accessor model

Every market accessor method returns a Signal: a {timestamp, value} series where value is Float64 and nullable and timestamp is tz-aware America/New_York. Each accessor evaluates on its own spine, the complete set of valid timestamps for that accessor. bar and time run on the equity spine; option runs on the equity-option spine. Both spines run 09:31 through the session close on NYSE trading days: 390 observations on a normal day, 210 on an early-close day. Missing minutes inside the spine are null, never dropped. Two Signals at different cadences combine on the union spine with backward as-of fill; see the execution model.

Every method accepts three optional keyword arguments:

Argument
Type
Effect
sampling
sampling(...)
Select point-in-time rows at a coarser cadence. Mutually exclusive with bucketing.
bucketing
bucketing(...)
Aggregate a window at a coarser cadence. Mutually exclusive with sampling.
symbol
string
Override the context symbol for this one call (case-insensitive). Does not mutate the context.

The symbol override accepts any launch ticker, enabling cross-symbol expressions like bar.close() / bar.close(symbol="QQQ"). All launch tickers carry bar.* and option.* coverage. See data coverage for the symbol list and per-symbol history depth.

option.* values are computed marks interpolated from the surface; bar.* returns the recorded bar; missing minutes inside the spine are null, never dropped.

bar.* (equity bars)

One-minute OHLCV for the underlying, on the equity spine. Each timestamp is the bar close; the bar window is [t − 1 min, t]. The 9:31 bar covers 9:30–9:31; the 16:00 bar covers 15:59–16:00 (13:00 on an early-close day).

Method
Returns
bar.open()
Bar open price. This is the spot S used in the IV and greeks pipeline.
bar.high()
Highest traded price within the bar.
bar.low()
Lowest traded price within the bar.
bar.close()
Closing (last) price of the bar.
bar.volume()
Total share volume traded during the bar.

Parameters. symbol (override, case-insensitive), split_adjusted (bool, default true), dividend_adjusted (bool, default true), sampling, bucketing. No positional arguments.

// Daily closing price, sampled at each session close
bar.close(sampling=sampling(period="day", time="close"))

bar.* prices are split- and dividend-adjusted by default. Every bar method takes split_adjusted and dividend_adjusted (bool, both default true); set either to false for raw, as-printed prices. See stock price adjustments.

Notes. vwap is intentionally not exposed; it is null on zero-volume bars. Use bar.close() as a price proxy. bar.* reads are split- and dividend-adjusted by default; setting the split_adjusted and dividend_adjusted switches (both default true) to false returns raw, as-printed prices.

option.* (option surface)

Implied volatility and the five greeks off the interpolated option surface, on the equity-option spine. Every method fetches a continuous surface value at the requested dte and either delta or moneyness.

Method
Returns
option.iv(...)
Implied volatility.
option.delta(...)
Delta.
option.gamma(...)
Gamma.
option.theta(...)
Theta, per calendar day.
option.vega(...)
Vega, per 1.00 change in IV (one vol point).
option.rho(...)
Rho, per 1.00 change in the risk-free rate.
option.contract(...)
A ContractTable of the single real contract nearest the target (see below).

Shared selection parameters (all option.* methods):

Parameter
Type
Default
Description
dte
Int
required, first positional
Target calendar days to expiration.
type
"call" | "put"
"call"
Option right.
delta
Float
0.5 (call) / -0.5 (put)
Target delta. Mutually exclusive with moneyness.
moneyness
Float
none
Target log-moneyness ln(K/forward), centered on the implied forward; 0 is at-the-money-forward. Mutually exclusive with delta.
symbol
string
context symbol
Per-call symbol override (case-insensitive).
sampling
sampling(...)
none
Point-in-time sampling. Mutually exclusive with bucketing.
bucketing
bucketing(...)
none
Window aggregation. Mutually exclusive with sampling.

option.iv adds two parameters:

Parameter
Type
Default
Description
iv_type
"bid" | "mid" | "ask"
"mid"
Which IV quote to return.
use_ex_earn_iv
Bool
false
When true, returns the earnings-adjusted IV. null only for symbols with no earnings calendar (SPY and broad-market ETFs); for contracts expiring before the next earnings date, or when the decomposition fails to converge, it returns the regular IV rather than null.
// 30-DTE 16-delta put mid IV, sampled to daily close
option.iv(dte=30, type="put", delta=-0.16, sampling=sampling(period="day", time="close"))

Every option.* value is a 2D bilinear interpolation across DTE and the chosen delta or moneyness dimension. When the surface is too sparse to interpolate, when no arbitrage-free IV can be recovered, or when a solve fails or falls outside plausibility bounds, the result is null, never extrapolated. See implied volatility and greeks.

option.contract(...) -> ContractTable

Selects, for each minute on the equity-option spine, the single real option contract whose dte plus exactly one of delta / moneyness / strike most closely matches the targets within thresholds. All arguments after dte are keyword-only.

option.contract(
    dte,                        // required, first positional
    type                = "call",
    delta               = None,
    moneyness           = None,
    strike              = None,
    dte_threshold       = 5,
    delta_threshold     = 0.05,
    moneyness_threshold = 0.05,
    strike_threshold    = 1.0,
    size                = 1,
) -> ContractTable
Parameter
Type
Default
Description
dte
Int
required
Target days to expiration. Non-negative.
type
"call" | "put"
"call"
Option right.
delta
Float
none
Target delta. Exactly one of delta / moneyness / strike is required.
moneyness
Float
none
Target log-moneyness ln(K/forward) (centered on the implied forward).
strike
Float
none
Target strike.
dte_threshold
Int
5
Maximum |dte_actual − dte| in days.
delta_threshold
Float
0.05
Maximum |delta_actual − delta|.
moneyness_threshold
Float
0.05
Maximum |moneyness_actual − moneyness|.
strike_threshold
Float
1.0
Maximum |strike_actual − strike|.
size
Int
1
Signed per-lot quantity. Non-zero; negative is short. Scales the scaled_* columns.

Selection is by threshold-normalized weighted-sum distance to the targets. Ties break on ascending expiration, then strike, then right. If no contract satisfies all thresholds at a minute, every column is null for that minute.

Project a single column with field access: option.contract(dte=30, delta=0.30).mid. The 20 projectable columns:

Column
Description
strike
Strike price of the selected contract.
dte
Actual days to expiration (may differ from the target by up to dte_threshold).
delta
Delta at this minute.
gamma
Gamma at this minute.
theta
Theta at this minute.
vega
Vega at this minute.
rho
Rho at this minute.
iv
Mid-price implied volatility at this minute.
mid
Midpoint of best bid and best ask, (bid + ask) / 2.
bid
Best bid price.
ask
Best ask price.
underlying_price
Underlying spot price at this minute.
moneyness
Log-moneyness ln(K/forward) (centered on the implied forward) at this minute.
multiplier
Contract multiplier (100 for US equity options).
size
Signed per-lot quantity (negative for short).
scaled_delta
delta × size.
scaled_gamma
gamma × size.
scaled_theta
theta × size.
scaled_vega
vega × size.
scaled_rho
rho × size.
// 30-DTE 30-delta call: per-minute mid premium
option.contract(dte=30, delta=0.30).mid

In a backtest, option.contract(...) is the contract selection slot; delta, moneyness, strike, and size may be cross-leg expressions, while dte and the thresholds must be constants.

leg(slug) -> LegTable

Addresses one held leg of the position under evaluation by its strategy slug, a non-empty string literal: leg("short_put"). Greeks and quotes come from the held contract's marks. The slug tracks the role, not the contract, so a window over leg("short_put").delta continues across a replace_leg roll. A declared-but-not-held slug yields an all-null row.

LegTable carries the 20 ContractTable columns above plus 13 entry-snapshot columns, captured at position open and preserved across rolls:

Column
Description
entry_strike
strike captured at entry.
entry_dte
dte captured at entry.
entry_delta
delta captured at entry.
entry_gamma
gamma captured at entry.
entry_theta
theta captured at entry.
entry_vega
vega captured at entry.
entry_rho
rho captured at entry.
entry_iv
iv captured at entry.
entry_mid
mid captured at entry.
entry_bid
bid captured at entry.
entry_ask
ask captured at entry.
entry_underlying_price
underlying_price captured at entry.
entry_moneyness
moneyness captured at entry.
// Adjustment trigger: roll when the short put's delta breaches 0.40
leg("short_put").delta > 0.40

The comparison returns a Float64 1.0/0.0 Signal. The entry_* columns exist only on a live held leg (in an adjustment trigger). In a contract-selection signal, leg(slug) resolves to the run-start candidate, which has no entry snapshot, so referencing an entry_* column there is a compile-time error. See signals inside a backtest.

position() -> PositionTable

Reads the per-minute state of the position under evaluation, aggregated across its legs. Available inside adjustment triggers only, where it evaluates once per open position per minute. Net greeks are sums of the legs' size-scaled greeks times lots; any contributing leg being null makes the aggregate null.

Column
Description
unrealized_pnl
Mark-to-market P&L since entry: cash booked plus current market value of the legs.
realized_pnl
Net cash booked so far (entry premium, roll credits, partial-close proceeds).
initial_margin
Initial-margin requirement attributed to this position.
maintenance_margin
Maintenance-margin requirement attributed to this position.
market_value
Current market value of the position's legs.
net_delta
Sum over legs of scaled_delta × lots.
net_gamma
Sum over legs of scaled_gamma × lots.
net_theta
Sum over legs of scaled_theta × lots.
net_vega
Sum over legs of scaled_vega × lots.
net_rho
Sum over legs of scaled_rho × lots.
lots
Position size in lots.
leg_count
Number of legs currently held.
dte
Days to the nearest leg expiration (minimum over held legs).
entry_net_delta
net_delta from each leg's delta captured at entry.
entry_net_gamma
net_gamma from each leg's gamma captured at entry.
entry_net_theta
net_theta from each leg's theta captured at entry.
entry_net_vega
net_vega from each leg's vega captured at entry.
entry_net_rho
net_rho from each leg's rho captured at entry.
// Adjustment trigger: 15-observation mean net delta runs long
rolling_mean(position().net_delta, 15) > 0.50
Warning

rolling_mean(position().net_delta, 15) averages the last 15 observations. On the 1-minute spine that is 15 minutes. Sample or bucket to daily first if you want 15 trading days.

book() -> BookTable

Reads the per-minute whole-account state during a backtest. Available in entry signals, exit signals, and adjustment triggers. It evaluates once per minute for the whole run regardless of how many positions are open. Values are dollars except the two noted.

Column
Description
cash
Cash balance.
nlv
Net liquidation value: cash plus the market value of all open positions.
initial_margin
Total initial-margin requirement across open positions.
maintenance_margin
Total maintenance-margin requirement across open positions.
excess_liquidity
NLV minus the total maintenance-margin requirement.
margin_utilization_pct
Maintenance margin as a percent of NLV. null when NLV is non-positive; can exceed 100 in margin distress.
unrealized_pnl
Mark-to-market P&L across all open positions.
realized_pnl
Cumulative realized P&L of closed trades.
position_count
Number of currently open positions.
// Entry or adjustment: fire when excess liquidity drops below a floor
book().excess_liquidity < 5000

time.* (calendar signals)

Deterministic NYSE calendar functions on the equity spine. No data query. Because they depend only on the public NYSE schedule, forward-looking reads (past=False) are permitted here; this is distinct from the no-lookahead rule that governs market data.

Calendar attributes (no positional arguments; optional sampling, bucketing, symbol):

Method
Value
time.day_of_week()
1–7 (ISO: 1 = Monday, 7 = Sunday).
time.day_of_month()
1–31.
time.day_of_year()
1–366.
time.week_of_month()
1–5 (Monday-anchored).
time.month()
1–12.
time.quarter()
1–4.
time.hour()
0–23 Eastern; the equity spine gives 9–16.
time.minute()
0–59.
time.minute_of_day()
Minutes since midnight Eastern (571 at 9:31).
time.is_week_end()
1 on the last NYSE trading day of the ISO week, else 0.
time.is_month_end()
1 on the last NYSE trading day of the calendar month, else 0.

Windowed functions:

Method
Returns
time.trading_days(calendar_days, past)
NYSE trading days inside a window of calendar_days calendar days. Constant within a session.
time.trading_minutes(calendar_days, past)
NYSE trading minutes in a window relative to the current bar; the current bar is always counted.
time.calendar_days(trading_days, past)
Calendar days spanned by trading_days trading days (the inverse of trading_days).
time.session_fraction(past)
Fraction of the current session elapsed (past=True, default) or remaining, in [0, 1].

past=False looks forward, past=True looks backward. session_fraction uses total_bars = 390 on a normal day, 210 on an early-close day.

// End-of-month flag for rebalancing logic
time.is_month_end()

Note. time.quarter() returns the calendar quarter (1–4) as a value. It is unrelated to period="quarter" in a sampling or bucketing config.

Accessor availability by context

The market and calendar accessors (bar, option, time) are available everywhere. The backtest-state accessors are gated by the evaluation context:

Context
book()
position()
leg(slug)
Entry signal
yes
no
no
Exit signal
yes
no
no
Adjustment trigger
yes
yes
yes (live held leg, entry_* columns present)
Contract selection
no
no
yes (run-start candidate, no entry_* columns)
Standalone signal
no
no
no

In contract selection, leg(slug) resolves to another leg's run-start candidate, which places one leg relative to another:

// Contract selection: long put 5 strikes below the short put
option.contract(dte=30, type="put", strike=leg("short_put").strike - 5)

Referencing an entry_* column in contract selection is a compile-time error (the candidate has no entry snapshot). Using any accessor outside its context raises an availability error.

Sampling & bucketing configuration

Both config builders shape every accessor read. They are mutually exclusive on one call: sampling selects a point-in-time row, bucketing aggregates a window.

sampling(*, period, multiplier=1, offset, time, times, days, weeks, months)

Parameter
Values
Notes
period
minute, hour, day, week, month, quarter
Cadence.
multiplier
Int, default 1
Composes the period (period="quarter", multiplier=4 is annual).
time
"open", "close", "HH:MM"
Sample time for period="day". period="day" without time defaults to time="close"; this is the only remaining default cascade.
times
list
Explicit sample times (calendar mode).
days, weeks, months
lists
Day-of-week, week-of-month, month filters.
offset
string
Clock offset for intraday grids.

bucketing(*, period, agg="last", multiplier=1, offset, partial=true)

Parameter
Values
Notes
period
minute, hour, day, week, month, quarter
Window size.
agg
first, last, max, min, mean, sum
Window aggregate. Default last.
multiplier
Int, default 1
Composes the period.
partial
Bool, default true
Whether to keep a bucket whose source window is not fully filled.
offset
string
Clock offset for intraday grids.

Note. Some listings of the bucketing signature omit quarter, but quarter is a valid bucketing period today, matching sampling.

What is not exposed

The engine computes the following upstream, but no accessor reads them today. Each is named so you do not reach for an accessor that does not exist. Do not invent a name for any of these.

  • Vanna and all second-order greeks.
  • The implied forward, carry, borrow, and the risk-free rate. The rate surfaces only inside option.rho, never as its own series (see implied forward, carry and rates).
  • Dealer exposure, GEX and VEX (see dealer exposure: GEX and VEX).
  • The dividend-escrowed spot, the informational dividend yield, and the ex-dividend date (see dividends).
  • The earnings metrics: implied move, event vol, ambient vol, and the next earnings date (see earnings volatility and implied move).
  • The IV quality and provenance flags (iv_status, spread_pct, is_one_sided, is_parity_recovered, spot_staleness_minutes, iv_model, is_floored_t).

For the full availability status, see Platform status.

Was this page helpful?