Appearance
Calendar Spread Edge
Family: Volatility
What it computes
Emits CalendarSpreadEdgeTick ticks carrying spread_mid, theoretical_value, edge off option NBBO (near / far legs).
Available on the live, historical, and replay drives.
Methodology
Natenberg (2015) §18 closed-form V_theo ≈ K · σ · sqrt(Δτ) / sqrt(2π).
See the methodology overview for the citation index.
Inputs
Option NBBO (near / far legs).
Key outputs
Spread_mid, theoretical_value, edge. The full field set is in the tick table below.
Output schema (CalendarSpreadEdgeTick)
The field / type / description table below is regenerated from the CalendarSpreadEdgeTick 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. |
near_expiration | i32 | Near-expiration date (YYYYMMDD). |
far_expiration | i32 | Far-expiration date (YYYYMMDD). |
right | u8 | Option right — 'C' or 'P'. |
strike | f64 | Strike in dollars (the strike both legs share). |
near_mid | f64 | Near-leg NBBO mid at emission time. |
far_mid | f64 | Far-leg NBBO mid at emission time. |
spread_mid | f64 | Observed calendar-spread mid far_mid − near_mid. Always finite past the both-legs-seeded guard. |
theoretical_value | f64 | Natenberg (2015) closed-form theoretical calendar value at the strike under the ATM-IV anchor. NaN under the documented degenerate-input guards. |
edge | f64 | Implied edge spread_mid − theoretical_value. Positive flags the calendar is rich; negative flags cheap. NaN when either leg is not seeded or the theoretical input is undefined. |
Configuration (CalendarSpreadEdgeParams)
Regenerated from the CalendarSpreadEdgeParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. The analytic admits OPRA option quotes only; equity / index trades are silently ignored at the on_tick entry point. |
atm_vol_pct | f64 | At-the-money implied volatility anchor, as a percent (NOT as a per-unit fraction). Defaults to [DEFAULT_ATM_VOL_PCT] (20.0). The Natenberg (2015) closed form consumes σ = atm_vol_pct / 100 internally. Subscribers tracking a time-varying ATM vol should mint a fresh subscription with the updated spec when the surface shifts (the v0.1.0 surface does not expose an in-place spec mutator). |
min_emit_interval_ms | i32 | Minimum interval between consecutive emissions per (symbol, right, strike) cell, 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().calendar_spread_edge(["SPX"]).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()
.calendarSpreadEdge(["SPX"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, CalendarSpreadEdgeRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.calendar_spread_edge(["SPX"])
.on_event(|row: &CalendarSpreadEdgeRow| {
println!("near_mid={} far_mid={}", row.near_mid, row.far_mid)
})?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }