Appearance
Relative Volume
Family: Flow surveillance
What it computes
Emits RelativeVolumeTick ticks carrying current_volume_session, baseline_mean / stddev, rvol_ratio, zscore off daily-close cache.
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
Bloomberg VOLA per-root current-session volume vs trailing-N baseline.
See the methodology overview for the citation index.
Inputs
Daily-close cache.
Key outputs
Current_volume_session, baseline_mean / stddev, rvol_ratio, zscore. The full field set is in the tick table below.
Output schema (RelativeVolumeTick)
The field / type / description table below is regenerated from the RelativeVolumeTick 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. |
date | i32 | Trading-session date (YYYYMMDD). |
ts_ms | i32 | Milliseconds since midnight at emission time. |
current_volume_session | u64 | Cumulative session volume so far (shares). |
baseline_mean | f64 | Rolling-window mean of prior daily volumes. NaN while warming is true. |
baseline_stddev | f64 | Rolling-window sample standard deviation of prior daily volumes. NaN while warming is true. |
rvol_ratio | f64 | current_volume_session / baseline_mean. NaN while warming. |
zscore | f64 | (current_volume_session − baseline_mean) / baseline_stddev. NaN while warming or when stddev == 0. |
warming | bool | true while the rolling baseline has fewer than two observations. |
Configuration (RelativeVolumeParams)
Regenerated from the RelativeVolumeParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Stock-only. |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / venue admission policy. |
baseline_days | usize | Trailing-window baseline length in trading sessions. |
min_emit_interval_ms | i32 | Minimum interval between per-symbol emissions (milliseconds). |
daily_close | Arc<DailyCloseCache> | Boot-time hydrated daily-close + volume history. |
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().relative_volume(["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()
.relativeVolume(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, RelativeVolumeRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.relative_volume(["QQQ"])
.on_event(|row: &RelativeVolumeRow| println!("current_volume_session={} baseline_mean={}", row.current_volume_session, row.baseline_mean))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }