Appearance
OHLCVC
What it computes
Open / High / Low / Close / Volume / Condition bars on a configurable timeframe (Tick / 1s / 5s / 30s / 1m / 5m / 15m / 1h / 1d). Each bar also carries a condition mask describing whether the bar contains regular RTH prints, late prints, or extended-hours prints — material for execution analytics that filter by venue and condition.
Methodology
The OPRA / UTP condition tables Kairos consumes are sourced from the upstream binary encoding layer and re-exported via crate::wire::conditions. The option side follows the OPRA Pillar Options Trade Conditions specification; the equity side follows UTP Trade Data Feed §3.14.
Inputs
TradeTick(option or stock).- Per-spec engine trade-condition policy for admission.
- Per-spec engine exchange-filter policy for venue admission.
- Per-spec
Timeframe.
Output schema (OhlcvcBar)
The field / type / description table below is regenerated from the OhlcvcBar Rust source by docs-site/scripts/inject-doc-tables.ts on every npm run docs:build. Do not hand-edit between the sentinels.
| Field | Type | Description |
|---|---|---|
contract | Contract | Resolved contract metadata (symbol, security type, expiration, side, strike). Subscribers identify the security by these fields — the wire-level contract id is engine-internal and is not surfaced here. |
timeframe | Timeframe | Period of the bar. |
bucket_start_ms | i64 | Inclusive lower edge of the bucket interval, in ms_of_day. |
bucket_end_ms | i64 | Exclusive upper edge of the bucket interval, in ms_of_day. |
date | i32 | Trading-session date in YYYYMMDD form, sourced from the upstream feed. |
open | f64 | Opening trade price of the bar. During the security's regular session — 09:30 ET to its per-symbol close (16:00 ET for an equity option, 16:15 ET for a Cboe index class), resolved from the session calendar — this is the first admitted trade whose primary condition has elig.last; volume-only prints (ODDLOT, AVGPRC, …) leave the bar unanchored until a last-eligible trade in the same bar anchors it. In pre-market and after-hours the SIP last-sale gate is dropped and the first qualifying trade anchors open regardless of elig.last. Bars publish only once a price-eligible trade anchors the frame, so open is always finite on emitted bars. |
high | f64 | Highest trade price observed in the bar. Finite on every emitted bar — unanchored bars are not published. |
low | f64 | Lowest trade price observed in the bar. Finite on every emitted bar — unanchored bars are not published. |
close | f64 | Most recent trade price applied to the bar. |
volume | i64 | Total volume aggregated across volume-eligible trades in the bar. |
count | i64 | Total count of admitted trades in the bar. |
vwap | f64 | Volume-weighted average price across volume-eligible trades; NaN while volume is zero. |
first_seq | i32 | Wire sequence of the first admitted trade in the bar. |
last_seq | i32 | Wire sequence of the most recently admitted trade in the bar. |
seq_gap_observed | bool | true if a non-unit gap was observed between consecutive admitted sequence values. |
closed | bool | true once the window has crossed its boundary and will not receive further updates; false for in-progress snapshots emitted under EmitPolicy. |
flags | BarFlags | Bar-level annotations carried over from the trades that contributed. |
Configuration (OhlcvcRequest)
Regenerated from the OhlcvcRequest Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks; evaluated once per (filter_id, contract_id) pair on first observation. |
timeframe | Timeframe | Bar period. |
emit | EmitPolicy | Whether bars emit only on close or on every qualifying trade. |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / venue admission policy. Default [ExchangeFilter::Any] matches the SIP-consolidated tape ThetaData hosted bars are computed against. Use [ExchangeFilter::Only] / [ExchangeFilter::Allow] to build per-venue OHLC series (e.g. Nasdaq-only QQQ bars), or [ExchangeFilter::Reject] to exclude specific venues such as the FINRA TRFs. The same OHLCVC methodology (cancel handling, asterisk-condition demotion, RTH vs extended-hours close rule, out-of-sequence HLC skip, first-trade open anchor) runs on whichever subset of trades the filter admits. |
Operational characteristics
- Per-tick latency. O(1) update; bar boundaries computed by integer bucketing on
ms_of_day. - Allocation discipline. Open-bar state is a single struct on the per-contract cell; no hot-path allocations.
- Replay parity. Deterministic — bucket boundaries are wire-derived.
Example
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, OhlcvcRow};
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.ohlcvc(["QQQ"])
.on_event(|row: &OhlcvcRow| println!("open={} close={} volume={}", row.open, row.close, row.volume))?;
// ... later, to stop delivery ...
sub.unsubscribe();