Appearance
Hawkes Intensity
Family: Microstructure
What it computes
Emits HawkesIntensityTick ticks carrying lambda_now, α, branching_ratio, is_stable off trade arrival times.
Available on the live, historical, and replay drives.
Methodology
Hawkes (1971) self-exciting intensity via the rate-invariant inter-arrival CV² branching proxy; Bacry-Mastromatteo-Muzy (2015) Fano regression is the designated upgrade.
See the methodology overview for the citation index.
Inputs
Trade arrival times.
Key outputs
Lambda_now, α, branching_ratio, is_stable. The full field set is in the tick table below.
Output schema (HawkesIntensityTick)
The field / type / description table below is regenerated from the HawkesIntensityTick 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). Stock-only analytic — the symbol is the full user-facing identity. |
date | i32 | Trading-session date (YYYYMMDD). |
ms_of_day | i32 | Milliseconds since midnight at emission time. |
lambda_current | f64 | Conditional intensity at emit time, in arrivals per second λ(t_emit) = μ + α · Σ exp(−β · (t_emit − tᵢ)). NaN under the documented degenerate-window guard. |
mu_baseline | f64 | Baseline arrival-rate estimate μ̂ = n / window_seconds in arrivals per second. |
alpha_excitation | f64 | Excitation parameter α̂ recovered from the rolling-window inter-arrival CV² surplus, scaled by the decay β. NaN with fewer than three samples. |
branching_ratio | f64 | Branching ratio α̂ / β — stationarity diagnostic per Bacry-Mastromatteo-Muzy (2015). Values approaching one indicate near-explosive self-excitation; values at or above one render the process non-stationary. |
trades_in_window | i32 | Number of admitted trade arrivals currently inside the window. |
is_stable | bool | true when the recovered α̂ / β < 1 — the Bacry-Mastromatteo-Muzy stationarity bound. false flags a non-stationary regime under which lambda_current should be consumed with a Poisson-fallback caveat. |
Configuration (HawkesIntensityParams)
Regenerated from the HawkesIntensityParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. The Hawkes estimator runs off the stock trade tape — the filter must resolve to stock contracts. |
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). |
decay_per_second | f64 | Hawkes decay parameter β in per-second units. Defaults to [DEFAULT_DECAY_PER_SECOND] (1.0). Fixed rather than fit per emit per the methodology note above. |
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().hawkes_intensity(["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()
.hawkesIntensity(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, HawkesIntensityRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.hawkes_intensity(["QQQ"])
.on_event(|row: &HawkesIntensityRow| println!("lambda_current={} branching_ratio={}", row.lambda_current, row.branching_ratio))?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }