Skip to content

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.

FieldTypeDescription
symbolArc<str>Underlying symbol.
datei32Trading-session date (YYYYMMDD).
ts_msi32Milliseconds since midnight at emission time.
current_volume_sessionu64Cumulative session volume so far (shares).
baseline_meanf64Rolling-window mean of prior daily volumes. NaN while warming is true.
baseline_stddevf64Rolling-window sample standard deviation of prior daily volumes. NaN while warming is true.
rvol_ratiof64current_volume_session / baseline_mean. NaN while warming.
zscoref64(current_volume_session − baseline_mean) / baseline_stddev. NaN while warming or when stddev == 0.
warmingbooltrue while the rolling baseline has fewer than two observations.

Configuration (RelativeVolumeParams)

Regenerated from the RelativeVolumeParams Rust source — see the note above.

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stock-only.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
baseline_daysusizeTrailing-window baseline length in trading sessions.
min_emit_interval_msi32Minimum interval between per-symbol emissions (milliseconds).
daily_closeArc<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(())
# }

Proprietary. All rights reserved.