Appearance
Forward Variance
Family: Volatility
What it computes
Emits ForwardVarianceTick ticks carrying near_variance, far_variance, forward_variance, forward_volatility off chain snapshot (multi-expiration).
Available on the live and replay drives. The historical drive fails closed with KAIROS_ERR_HISTORICAL_UNWIRED until the relevant cache is hydrated externally.
Methodology
Demeterfi-Derman-Kamal-Zou (1999) VIX-style forward variance swap rate (T2*σ²(T2) - T1*σ²(T1)) / (T2-T1) over Carr-Madan strip integrals.
See the methodology overview for the citation index.
Inputs
Chain snapshot (multi-expiration).
Key outputs
Near_variance, far_variance, forward_variance, forward_volatility. The full field set is in the tick table below.
Output schema (ForwardVarianceTick)
The field / type / description table below is regenerated from the ForwardVarianceTick 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 at emission time. |
near_expiration | i32 | Near expiration YYYYMMDD that anchored σ²(T₁). |
far_expiration | i32 | Far expiration YYYYMMDD that anchored σ²(T₂). |
near_variance | f64 | σ²(T₁) recovered from the near strip. |
far_variance | f64 | σ²(T₂) recovered from the far strip. |
forward_variance | f64 | Forward variance (T₂ · σ²(T₂) − T₁ · σ²(T₁)) / (T₂ − T₁) — the institutional term-premium reading. |
forward_volatility | f64 | Annualised forward volatility √(forward_variance). NaN when the forward variance is negative (chain inconsistency). |
near_tenor_years | f64 | T₁ in calendar years. |
far_tenor_years | f64 | T₂ in calendar years. |
Configuration (ForwardVarianceParams)
Regenerated from the ForwardVarianceParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Underlying symbols the subscription tracks. |
conditions | ConditionPolicy | Trade-condition admission policy. Retained for surface consistency. |
venues | ExchangeFilter | Exchange / venue admission policy. Retained for surface consistency. |
daily_close | Arc<DailyCloseCache> | Boot-time hydrated daily-close history. The empty default is a placeholder — the analytic's kernel consumes a chain snapshot rather than the daily-close history, but the cache slot is retained so the DefaultSpec hook can fail closed with the same documented cache-dependency error the other vol analytics surface. |
min_strikes_per_expiration | i32 | Minimum number of admitted strikes per expiration for the strip integration to publish a real-valued variance. Defaults to [DEFAULT_MIN_STRIKES_PER_EXP] (5). |
near_expiration | i32 | Near expiration target YYYYMMDD. 0 selects the front expiration on the supplied chain snapshot. |
far_expiration | i32 | Far expiration target YYYYMMDD. 0 selects the second- nearest expiration after near_expiration. |
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().forward_variance(["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()
.forwardVariance(["SPX"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, ForwardVarianceRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.forward_variance(["SPX"])
.on_event(|row: &ForwardVarianceRow| println!("forward_variance={} forward_volatility={}", row.forward_variance, row.forward_volatility))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }