Skip to content

P/C Volume Ratio

Family: Flow surveillance

What it computes

Emits PcVolumeRatioTick ticks carrying call_volume, put_volume, pcr_volume, signed_imbalance, prints_in_window off option trade tape.

Available on the live, historical, and replay drives.

Methodology

Rolling-window put / call volume ratio over sliding intraday FIFO of admitted option trades — CBOE put / call ratio methodology in session-flow form.

See the methodology overview for the citation index.

Inputs

Option trade tape.

Key outputs

Call_volume, put_volume, pcr_volume, signed_imbalance, prints_in_window. The full field set is in the tick table below.

Output schema (PcVolumeRatioTick)

The field / type / description table below is regenerated from the PcVolumeRatioTick 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 at emission time.
call_volumeu64Call-side trade volume inside the rolling window (contracts).
put_volumeu64Put-side trade volume inside the rolling window (contracts).
pcr_volumef64put_volume / call_volume. Always finite: the ratio is undefined while no call volume sits inside the window, and undefined states suppress the emission — rows publish only when call_volume > 0.
signed_imbalancef64(call_volume - put_volume) / (call_volume + put_volume). In [-1, +1]; +1 = pure call flow, -1 = pure put flow.
prints_in_windowi32Print count contributing to the rolling-window ratio.

Configuration (PcVolumeRatioParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Options only — stock / index trades are silently ignored.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
window_msi32Rolling-window horizon in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (60_000 ms).
min_emit_interval_msi32Minimum interval between per-symbol emissions in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (1_000 ms). Set to 0 to publish on every admitted print.

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().pc_volume_ratio(["SPX"]).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()
  .pcVolumeRatio(["SPX"])
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

rust
// Cargo.toml:
//   kairos = "0.1"

use kairos::{Client, PcVolumeRatioRow};

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;

let sub = client
    .live()
    .pc_volume_ratio(["SPX"])
    .on_event(|row: &PcVolumeRatioRow| println!("pcr_volume={} call_volume={}", row.pcr_volume, row.call_volume))?;

// ... later, to stop delivery ...
sub.unsubscribe();
# Ok(())
# }

Proprietary. All rights reserved.