Skip to content

Huang Stoll Lambda

Family: Microstructure

What it computes

Emits HuangStollLambdaTick ticks carrying permanent_lambda, realized_half_spread, adverse_selection_share, n_observations off trade + quote tape.

Available on the live, historical, and replay drives.

Methodology

Huang / Stoll (1997) two-way decomposition — permanent (information-driven) price-impact slope λ + realized half-spread S/2 via rolling-window OLS; adverse-selection share λ / (λ + S/2) per the canonical Bloomberg TCA reading.

See the methodology overview for the citation index.

Inputs

Trade + quote tape.

Key outputs

Permanent_lambda, realized_half_spread, adverse_selection_share, n_observations. The full field set is in the tick table below.

Output schema (HuangStollLambdaTick)

The field / type / description table below is regenerated from the HuangStollLambdaTick 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).
ms_of_dayi32Milliseconds since midnight at emission time.
permanent_lambdaf64Huang / Stoll (1997) permanent (information-driven) price- impact slope λ = Σ(Q · Δm) / Σ Q² — dollars of mid-quote return per signed share. NaN on a degenerate window.
realized_half_spreadf64Huang / Stoll (1997) realized half-spread S/2 = Σ(ΔQ · (Δp − Δm)) / Σ ΔQ² — dollars of transient round-trip cost the market maker captures. NaN on a degenerate window.
adverse_selection_sharef64Adverse-selection share λ / (λ + S/2)[0, 1] — the institutional gauge of how much of the round-trip cost is paid to informed flow. NaN on a degenerate window.
n_observationsi32Sample count inside the trailing window.

Configuration (HuangStollLambdaParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stocks only — the analytic silently ignores option / index trades at the on_tick entry point.
conditionsConditionPolicyTrade-condition admission policy applied to every print.
venuesExchangeFilterExchange / venue admission policy.
window_msi32Rolling-window length in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (60_000 ms).
min_emit_interval_msi32Minimum interval between consecutive emissions per symbol, in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (1_000 ms).

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().huang_stoll_lambda(["QQQ"]).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()
  .huangStollLambda(["QQQ"])
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

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

use kairos::{Client, HuangStollLambdaRow};

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

let sub = client
    .live()
    .huang_stoll_lambda(["QQQ"])
    .on_event(|row: &HuangStollLambdaRow| println!("permanent_lambda={} adverse_selection_share={}", row.permanent_lambda, row.adverse_selection_share))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }

Proprietary. All rights reserved.