Appearance
Rolls Measure
Family: Microstructure
What it computes
Emits RollsMeasureTick ticks carrying auto_cov_dp, spread_pct, spread_dollars, price_anchor off trade tape.
Available on the live, historical, and replay drives.
Methodology
Roll (1984) implicit spread s = 2·sqrt(−cov(Δp_t, Δp_{t-1})).
See the methodology overview for the citation index.
Inputs
Trade tape.
Key outputs
Auto_cov_dp, spread_pct, spread_dollars, price_anchor. The full field set is in the tick table below.
Output schema (RollsMeasureTick)
The field / type / description table below is regenerated from the RollsMeasureTick 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 |
|---|---|---|
symbol | Arc<str> | Underlying symbol (interned). |
date | i32 | Trading-session date (YYYYMMDD) at emission time. |
ms_of_day | i32 | Milliseconds since midnight ET at emission time. |
auto_cov_dp | f64 | Lag-1 sample autocovariance of trade-price changes over the rolling window: cov(Δp_t, Δp_{t-1}). NaN with fewer than three admitted prints (kernel undefined). |
spread_pct | f64 | Implied effective spread as a fraction of the rolling-window mean trade price: s / p_bar. NaN under the documented degenerate-window guards (auto_cov_dp ≥ 0 or fewer than three prints). |
spread_dollars | f64 | Implied effective spread in dollars per share: s = 2 · sqrt(−auto_cov_dp). NaN under the documented degenerate-window guards. The desk reads this as the dollar-per-share implied effective round-trip cost. |
price_anchor | f64 | Rolling-window mean trade price — the price anchor used to convert spread_dollars to spread_pct. Always finite past the first admitted print. |
n_prints | i32 | Count of admitted trade prints currently inside the rolling window — Roll's N parameter. Values below 3 flag the cold-start regime where the spread estimate stays NaN. |
Configuration (RollsMeasureParams)
Regenerated from the RollsMeasureParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Stocks only — the analytic silently ignores option / index trades at the on_tick entry point. |
conditions | ConditionPolicy | Trade-condition admission policy applied to every print. |
venues | ExchangeFilter | Exchange / venue admission policy. |
window_prints | i32 | Rolling-window length in admitted trade prints. Defaults to [DEFAULT_WINDOW_PRINTS] (100). |
min_emit_interval_ms | i32 | Minimum interval between consecutive emissions per symbol, in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (1_000). |
Example
Python
python
import kairos_thetadata as kt
client = kt.Client.connect(kt.Credentials.from_env())
def on_event(row):
print(row)
sub = client.live().rolls_measure(["QQQ"]).on_event(on_event)
sub.wait(timeout_seconds=60.0)TypeScript
typescript
import { Client, Credentials } from "kairos-thetadata";
const client = await Client.connect(Credentials.fromEnv());
await client
.live()
.rollsMeasure(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, RollsMeasureRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.rolls_measure(["QQQ"])
.on_event(|row: &RollsMeasureRow| println!("spread_dollars={}", row.spread_dollars))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }