Skip to content

Gamma Squeeze Risk

Family: Flow surveillance

What it computes

Emits GammaSqueezeRiskTick ticks carrying composite_score, setup_flag off OI + fundamentals (spec).

Available on the live, historical, and replay drives.

Methodology

Call-OI / float × short-interest composite.

See the methodology overview for the citation index.

Inputs

OI + fundamentals (spec).

Key outputs

Composite_score, setup_flag. The full field set is in the tick table below.

Output schema (GammaSqueezeRiskTick)

The field / type / description table below is regenerated from the GammaSqueezeRiskTick Rust source by docs-site/scripts/inject-doc-tables.ts on every npm run docs:build. Do not hand-edit between the sentinels.

FieldTypeDescription
contractContractResolved underlying contract metadata. Subscribers identify the underlying by (symbol, …) on this field; the wire-level contract id is engine-internal.
datei32Trading-session date (YYYYMMDD).
ms_of_dayi32Milliseconds-of-day at emission time.
spotf64Underlying spot used to bracket the OTM call-OI band.
call_oi_otmi64Total open interest summed across every near-the-money OTM call strike (spot < K < spot × otm_upper_pct).
call_oi_to_float_ratiof64(call_oi_otm × 100) / shares_outstanding. f64::NAN when shares_outstanding is unset (default 0.0).
short_interest_ratiof64short_interest / shares_outstanding. f64::NAN when either fundamentals input is unset.
composite_scoref64call_oi_to_float_ratio × (1 + short_interest_ratio) × 100. f64::NAN when either fundamentals input is unset.
setup_flagboolcomposite_score > setup_threshold. Always false when composite_score is NaN.

Configuration (GammaSqueezeRiskParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Typically a [SecurityFilter::Symbols] entry naming the underlying roots.
oi_cacheArc<OpenInterestCache>Engine-wide option open-interest cache. Build at Client::connect and clone the resulting Arc into the spec.
spot_cacheSpotPriceCacheShared underlying-spot cache, populated by the engine from stock NBBO quotes.
shares_outstandingf64Free-float shares outstanding. 0.0 (default) marks the fundamentals input as unset — the analytic emits NaN for the ratios and false for setup_flag. Production deployments hydrate this from their fundamentals plane before subscribing.
short_interestf64Short interest in shares. 0.0 (default) marks the input as unset. Same NaN-on-missing contract as shares_outstanding.
otm_lower_pctf64Lower OTM bound, expressed as a multiplier on spot. Calls with strike at or below spot × otm_lower_pct are excluded from the OI sum (they are ITM under the spot reading). Default 1.0 — strict above-spot inclusion.
otm_upper_pctf64Upper OTM bound. Calls with strike above spot × otm_upper_pct are excluded. Default 1.20 — the 20%-above-spot tail.
setup_thresholdf64Composite-score threshold for setup_flag. Default 10.0.
min_emit_interval_msi64Minimum interval between emissions per symbol, in milliseconds. Defaults to 1_000 (one snapshot per second).
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy applied to stock quotes (the analytic's spot-refresh signal).

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

Rust

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

use kairos::{Client, GammaSqueezeRiskRow};

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

let sub = client
    .live()
    .gamma_squeeze_risk(["SPX"])
    .on_event(|row: &GammaSqueezeRiskRow| println!("composite_score={} setup_flag={}", row.composite_score, row.setup_flag))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }

Proprietary. All rights reserved.