Skip to content

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.

FieldTypeDescription
symbolArc<str>Underlying symbol (interned).
datei32Trading-session date (YYYYMMDD) at emission time.
ms_of_dayi32Milliseconds since midnight ET at emission time.
near_expirationi32Near-expiration date (YYYYMMDD).
far_expirationi32Far-expiration date (YYYYMMDD).
rightu8Option right — 'C' or 'P'.
strikef64Strike in dollars (the strike both legs share).
near_midf64Near-leg NBBO mid at emission time.
far_midf64Far-leg NBBO mid at emission time.
spread_midf64Observed calendar-spread mid far_mid − near_mid. Always finite past the both-legs-seeded guard.
theoretical_valuef64Natenberg (2015) closed-form theoretical calendar value at the strike under the ATM-IV anchor. NaN under the documented degenerate-input guards.
edgef64Implied 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.

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. The analytic admits OPRA option quotes only; equity / index trades are silently ignored at the on_tick entry point.
atm_vol_pctf64At-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_msi32Minimum 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(())
# }

Proprietary. All rights reserved.