Skip to content

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.

FieldTypeDescription
symbolArc<str>Underlying symbol (interned).
datei32Trading-session date (YYYYMMDD) at emission time.
ms_of_dayi32Milliseconds since midnight ET at emission time.
rv_todayf64In-progress realized variance for the active session RV_d,today_so_far. Finite past the first sealed bar.
rv_daily_lagf64Daily trailing-mean RV regressor RV_d,t−1 (yesterday's sealed daily RV).
rv_weekly_lagf64Weekly trailing-mean RV regressor (1 / 5) · Σ RV_d,t−i.
rv_monthly_lagf64Monthly trailing-mean RV regressor (1 / 22) · Σ RV_d,t−i.
forecast_variancef64HAR-RV one-step-ahead variance forecast RV̂_d,t+1.
forecast_annualized_volf64HAR-RV one-step-ahead annualised volatility forecast sqrt(252 · RV̂_d,t+1).
sessions_observedi32Count 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.

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stocks only.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
bar_interval_msi32Per-bar cadence in milliseconds.
beta_interceptf64HAR regression intercept β₀. Defaults to [DEFAULT_BETA_INTERCEPT].
beta_dailyf64HAR regression daily loading β_d. Defaults to [DEFAULT_BETA_DAILY].
beta_weeklyf64HAR regression weekly loading β_w. Defaults to [DEFAULT_BETA_WEEKLY].
beta_monthlyf64HAR regression monthly loading β_m. Defaults to [DEFAULT_BETA_MONTHLY].
min_emit_interval_msi32Minimum 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(())
# }

Proprietary. All rights reserved.