Appearance
Vol Risk Premium
Family: Volatility
What it computes
Emits VolRiskPremiumTick ticks carrying vol_risk_premium, variance_risk_premium, implied_vol, realized_vol, n_intraday_bars off stock trade tape.
Available on the live, historical, and replay drives.
Methodology
Bollerslev / Tauchen / Zhou (2009) per-symbol streaming spread vrp = implied_vol - realized_vol; realized vol via Parkinson (1980) high-low estimator over per-bar (H, L) off the stock trade tape.
See the methodology overview for the citation index.
Inputs
Stock trade tape.
Key outputs
Vol_risk_premium, variance_risk_premium, implied_vol, realized_vol, n_intraday_bars. The full field set is in the tick table below.
Output schema (VolRiskPremiumTick)
The field / type / description table below is regenerated from the VolRiskPremiumTick 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. |
implied_vol | f64 | Implied-vol reference carried on the spec (annualised decimal). |
realized_vol | f64 | Parkinson-estimated realized vol over the rolling window (annualised decimal). NaN with an empty FIFO. |
variance_risk_premium | f64 | Variance-risk premium IV^2 - RV^2 per Bollerslev / Tauchen / Zhou (2009). NaN with an empty FIFO. |
vol_risk_premium | f64 | Volatility-risk premium IV - RV — the headline streaming spread. NaN with an empty FIFO. |
n_intraday_bars | i32 | Count of sealed bars currently inside the rolling window. |
Configuration (VolRiskPremiumParams)
Regenerated from the VolRiskPremiumParams 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. |
conditions | ConditionPolicy | Trade-condition admission policy applied to every print. |
venues | ExchangeFilter | Exchange / venue admission policy. |
bar_interval_ms | i32 | Per-bar cadence in milliseconds. Defaults to [DEFAULT_BAR_INTERVAL_MS] (300_000 ms / 5 min). |
window_bars | i32 | Rolling-window length in bars. Defaults to [DEFAULT_WINDOW_BARS] (78). |
min_emit_interval_ms | i32 | Minimum interval between consecutive emissions per symbol, in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (60_000 ms). Set to 0 to publish on every sealed bar. |
implied_vol_reference | f64 | Implied-volatility reference (annualised decimal). The subscriber populates this from their preferred IV surface — the desk's own ATM IV reading, the CBOE VIX print, or any internal vol-curve source. Defaults to [DEFAULT_IMPLIED_VOL_REFERENCE] (0.0). |
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().vol_risk_premium(["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()
.volRiskPremium(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, VolRiskPremiumRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.vol_risk_premium(["QQQ"])
.on_event(|row: &VolRiskPremiumRow| println!("implied_vol={} realized_vol={}", row.implied_vol, row.realized_vol))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }