Appearance
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.
| 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 at emission time. |
call_volume | u64 | Call-side trade volume inside the rolling window (contracts). |
put_volume | u64 | Put-side trade volume inside the rolling window (contracts). |
pcr_volume | f64 | put_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_imbalance | f64 | (call_volume - put_volume) / (call_volume + put_volume). In [-1, +1]; +1 = pure call flow, -1 = pure put flow. |
prints_in_window | i32 | Print count contributing to the rolling-window ratio. |
Configuration (PcVolumeRatioParams)
Regenerated from the PcVolumeRatioParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Options only — stock / index trades are silently ignored. |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / venue admission policy. |
window_ms | i32 | Rolling-window horizon in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (60_000 ms). |
min_emit_interval_ms | i32 | Minimum 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(())
# }