Appearance
HAR RV
Family: Volatility
What it computes
Emits HarRvTick ticks carrying rv_today, rv_daily_lag, rv_weekly_lag, rv_monthly_lag, forecast_variance, forecast_annualized_vol, sessions_observed off stock trade tape (5m bars).
Available on the live, historical, and replay drives.
Methodology
Corsi (2009) Heterogeneous Autoregressive realized-volatility forecast RV̂_{t+1} = β₀ + β_d · RV_{d,t} + β_w · RV_{w,t} + β_m · RV_{m,t} over the trailing 1 / 5 / 22-session horizons.
See the methodology overview for the citation index.
Inputs
Stock trade tape (5m bars).
Key outputs
Rv_today, rv_daily_lag, rv_weekly_lag, rv_monthly_lag, forecast_variance, forecast_annualized_vol, sessions_observed. The full field set is in the tick table below.
Output schema (HarRvTick)
The field / type / description table below is regenerated from the HarRvTick 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. |
rv_today | f64 | In-progress realized variance for the active session RV_d,today_so_far. Finite past the first sealed bar. |
rv_daily_lag | f64 | Daily trailing-mean RV regressor RV_d,t−1 (yesterday's sealed daily RV). |
rv_weekly_lag | f64 | Weekly trailing-mean RV regressor (1 / 5) · Σ RV_d,t−i. |
rv_monthly_lag | f64 | Monthly trailing-mean RV regressor (1 / 22) · Σ RV_d,t−i. |
forecast_variance | f64 | HAR-RV one-step-ahead variance forecast RV̂_d,t+1. |
forecast_annualized_vol | f64 | HAR-RV one-step-ahead annualised volatility forecast sqrt(252 · RV̂_d,t+1). |
sessions_observed | i32 | Count of sealed daily RV buckets currently inside the 22-session ladder. Rows publish only once the ladder is full, so every emitted row carries sessions_observed == 22 and all regressors defined. |
Configuration (HarRvParams)
Regenerated from the HarRvParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Stocks only. |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / venue admission policy. |
bar_interval_ms | i32 | Per-bar cadence in milliseconds. |
beta_intercept | f64 | HAR regression intercept β₀. Defaults to [DEFAULT_BETA_INTERCEPT]. |
beta_daily | f64 | HAR regression daily loading β_d. Defaults to [DEFAULT_BETA_DAILY]. |
beta_weekly | f64 | HAR regression weekly loading β_w. Defaults to [DEFAULT_BETA_WEEKLY]. |
beta_monthly | f64 | HAR regression monthly loading β_m. Defaults to [DEFAULT_BETA_MONTHLY]. |
min_emit_interval_ms | i32 | Minimum interval between consecutive emissions per symbol, in milliseconds. Set to 0 to publish on every sealed bar. |
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().har_rv(["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()
.harRv(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, HarRvRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.har_rv(["QQQ"])
.on_event(|row: &HarRvRow| println!("forecast_annualized_vol={} rv_today={}", row.forecast_annualized_vol, row.rv_today))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }