Appearance
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.
| Field | Type | Description |
|---|---|---|
contract | Contract | Resolved underlying contract metadata. Subscribers identify the underlying by (symbol, …) on this field; the wire-level contract id is engine-internal. |
date | i32 | Trading-session date (YYYYMMDD). |
ms_of_day | i32 | Milliseconds-of-day at emission time. |
spot | f64 | Underlying spot used to bracket the OTM call-OI band. |
call_oi_otm | i64 | Total open interest summed across every near-the-money OTM call strike (spot < K < spot × otm_upper_pct). |
call_oi_to_float_ratio | f64 | (call_oi_otm × 100) / shares_outstanding. f64::NAN when shares_outstanding is unset (default 0.0). |
short_interest_ratio | f64 | short_interest / shares_outstanding. f64::NAN when either fundamentals input is unset. |
composite_score | f64 | call_oi_to_float_ratio × (1 + short_interest_ratio) × 100. f64::NAN when either fundamentals input is unset. |
setup_flag | bool | composite_score > setup_threshold. Always false when composite_score is NaN. |
Configuration (GammaSqueezeRiskParams)
Regenerated from the GammaSqueezeRiskParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Typically a [SecurityFilter::Symbols] entry naming the underlying roots. |
oi_cache | Arc<OpenInterestCache> | Engine-wide option open-interest cache. Build at Client::connect and clone the resulting Arc into the spec. |
spot_cache | SpotPriceCache | Shared underlying-spot cache, populated by the engine from stock NBBO quotes. |
shares_outstanding | f64 | Free-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_interest | f64 | Short interest in shares. 0.0 (default) marks the input as unset. Same NaN-on-missing contract as shares_outstanding. |
otm_lower_pct | f64 | Lower 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_pct | f64 | Upper OTM bound. Calls with strike above spot × otm_upper_pct are excluded. Default 1.20 — the 20%-above-spot tail. |
setup_threshold | f64 | Composite-score threshold for setup_flag. Default 10.0. |
min_emit_interval_ms | i64 | Minimum interval between emissions per symbol, in milliseconds. Defaults to 1_000 (one snapshot per second). |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / 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(())
# }