Skip to content

OI Changes

Family: Flow surveillance

What it computes

Emits OiChangesTick ticks carrying contracts_used, net_oi_change, accumulation, unwind, rows[(expiration, right, strike, oi_today, oi_prev, oi_change, oi_change_pct)] off chain snapshot + today + prior-session OI.

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

Per-contract day-over-day open-interest delta oi_today - oi_prev — Kolanovic (2014) / SqueezeMetrics (2017) accumulation vs unwind ladder.

See the methodology overview for the citation index.

Inputs

Chain snapshot + today + prior-session OI.

Key outputs

Contracts_used, net_oi_change, accumulation, unwind, rows[(expiration, right, strike, oi_today, oi_prev, oi_change, oi_change_pct)]. The full field set is in the tick table below.

Output schema (OiChangesTick)

The field / type / description table below is regenerated from the OiChangesTick 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.
contracts_usedi32Per-contract row count contributing to the ladder.
net_oi_changei64Net signed OI change across the chain Σ oi_change.
accumulationi64Sum of positive OI changes (accumulation).
unwindi64Sum of `
rowsVec<OiChangeRow>Per-contract delta rows, sorted by (expiration, strike, right) ascending.

Configuration (OiChangesParams)

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

FieldTypeDescription
contractsSecurityFilterUnderlying symbols the subscription tracks.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
oi_cacheArc<OpenInterestCache>Engine-wide option open-interest cache (current session). The empty default is a placeholder — the analytic's kernel reads today's OI off the cache; the cache slot is retained so the DefaultSpec hook can fail closed with the documented cache-dependency error.
min_abs_deltai64Minimum absolute OI delta `

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

Rust

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

use kairos::{Client, OiChangesRow};

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

let sub = client
    .live()
    .oi_changes(["SPX"])
    .on_event(|row: &OiChangesRow| println!("net_oi_change={} accumulation={}", row.net_oi_change, row.accumulation))?;

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

Proprietary. All rights reserved.