Appearance
Kyles Lambda
Family: Microstructure
What it computes
Emits KylesLambdaTick ticks carrying lambda, r_squared, n_obs off trade + Lee-Ready.
Available on the live, historical, and replay drives.
Methodology
Kyle (1985) OLS price-impact regression.
See the methodology overview for the citation index.
Inputs
Trade + Lee-Ready.
Key outputs
Lambda, r_squared, n_obs. The full field set is in the tick table below.
Output schema (KylesLambdaTick)
The field / type / description table below is regenerated from the KylesLambdaTick 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 |
|---|---|---|
symbol | Arc<str> | Underlying symbol (interned). |
date | i32 | Trading-session date (YYYYMMDD). |
ms_of_day | i32 | Milliseconds since midnight at emission time. |
lambda | f64 | Kyle (1985) λ — dollars of price impact per signed share. Larger λ = thinner book / higher adverse-selection cost. NaN on a degenerate sample (Σ Q² = 0, or fewer than two distinct observations). |
r_squared | f64 | No-intercept coefficient of determination 1 − Σ(ΔPᵢ − λ × Qᵢ)² / Σ(ΔPᵢ²). NaN on zero ΔP variance. |
n_observations | i32 | Sample count inside the trailing window. |
mean_signed_volume | f64 | Mean signed volume (Σ Qᵢ) / n across the window. The Kyle no-intercept estimator assumes this is approximately zero in equilibrium — surfacing it lets desks audit the assumption. |
mean_dp | f64 | Mean trade-by-trade price change (Σ ΔPᵢ) / n across the window. |
Configuration (KylesLambdaParams)
Regenerated from the KylesLambdaParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. The Kyle estimator runs off the stock trade tape with the NBBO providing the Lee-Ready signing context. |
conditions | ConditionPolicy | Trade-condition admission policy applied to every print. |
venues | ExchangeFilter | Exchange / venue admission policy. |
window_ms | i32 | Rolling-window length in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (60_000 ms). |
min_emit_interval_ms | i32 | Minimum 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().kyles_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()
.kylesLambda(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, KylesLambdaRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.kyles_lambda(["QQQ"])
.on_event(|row: &KylesLambdaRow| println!("lambda={} r_squared={}", row.lambda, row.r_squared))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }