Skip to content

Mcclellan Oscillator

Family: Flow surveillance

What it computes

Emits McclellanOscillatorTick ticks carrying advances, declines, ad_spread, ema_short, ema_long, oscillator off subscribed-universe option trades.

Available on the live, historical, and replay drives.

Methodology

McClellan (1969) universe-wide dual 19 / 39-period EMA of the advances − declines spread; NYSE breadth-momentum oscillator.

See the methodology overview for the citation index.

Inputs

Subscribed-universe option trades.

Key outputs

Advances, declines, ad_spread, ema_short, ema_long, oscillator. The full field set is in the tick table below.

Output schema (McclellanOscillatorTick)

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

FieldTypeDescription
datei32Trading-session date (YYYYMMDD).
ts_msi32Milliseconds since midnight at emission time.
advancesu32Count of symbols whose session balance is currently > 0.
declinesu32Count of symbols whose session balance is currently < 0.
ad_spreadf64Raw advances − declines spread fed into the dual EMA.
ema_shortf64EMA_19 of the ad_spread series.
ema_longf64EMA_39 of the ad_spread series.
oscillatorf64McClellan oscillator: ema_short − ema_long.

Configuration (McclellanOscillatorParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. The institutional idiom is to subscribe by underlying symbol — the engine fans out across the chain and the oscillator aggregates by symbol.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
min_emit_interval_msi32Minimum interval between universe emissions (milliseconds).

Example

Python

python
import kairos_thetadata as kt

client = kt.Client.connect(kt.Credentials.from_env())

def on_emission(tick):
    print(tick)

sub = client.live().mcclellan_oscillator([]).for_index("SPX").on_event(on_emission)
sub.wait(timeout_seconds=60.0)

TypeScript

typescript
import { Client, Credentials } from "kairos-thetadata";

const client = await Client.connect(Credentials.fromEnv());
await client
  .live()
  .mcclellanOscillator([])
  .forIndex("SPX")
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

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

use kairos::{Client, McclellanOscillatorRow};

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

let sub = client
    .live()
    .mcclellan_oscillator(["SPX"])
    .on_event(|row: &McclellanOscillatorRow| println!("ad_spread={} ema_short={}", row.ad_spread, row.ema_short))?;

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

for_index / for_sector are Python / TypeScript SDK conveniences. On the Rust thin client, pass the constituent universe to the analytic accessor (client.live().<analytic>([...])) — the engine drives the same per-symbol fan-out.

Proprietary. All rights reserved.