Class HawkesIntensity
λ(t) = μ + S(t), S(t) = Σ over past events of α·e^(−β(t−tᵢ))where μ is the baseline arrival rate, α the excitation each event adds, and β the decay.
S updates in O(1) per event — decay what is
there, add α — which is what makes Hawkes streaming-friendly while
richer clustering models are not.
Stability is enforced, not assumed: the branching ratio
α/β is the expected number of children each event spawns; at
≥ 1 the process is explosive (each event begets more than one, and the
intensity diverges), so the constructor rejects it. Read
burstScore(long) as the regime signal: 0 = baseline flow, 1 = the
self-excited component equals the baseline (activity running 2×), and
it decays back with the configured half-life when the burst ends.
Uses: pre-positioning for activity bursts (a burst means queues
consume faster — QueueModel horizons shorten), conflation
pressure forecasting, and as a dimensionless ensemble input. Feed every
arrival of the event type you care about (trades, quotes, or your own
fills) via onEvent(long); timestamps must be non-decreasing (a
backwards timestamp is ignored — feed-merge jitter must not inject
negative decay). Zero allocation per event, single writer, one
instance per symbol per event type.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseline 2 events/s, excitation 0.1/s per event, 2s half-life (branching ~0.29).HawkesIntensity(double baselineRatePerSec, double excitation, long decayHalfLifeNanos) -
Method Summary
Modifier and TypeMethodDescriptiondoubleburstScore(long nowNanos) The dimensionless burst regime: self-excited intensity over the baseline, clamped to [0, 1] at "activity running 2× baseline". 0 in steady flow; decays back with the configured half-life.longevents()doubleintensity(long nowNanos) The current intensity λ(now) in events per second.voidonEvent(long timestampNanos) One event arrival.
-
Constructor Details
-
HawkesIntensity
public HawkesIntensity(double baselineRatePerSec, double excitation, long decayHalfLifeNanos) - Parameters:
baselineRatePerSec- μ — arrival rate with no excitation, e.g. 2.0excitation- α — intensity each event adds (per second), e.g. 0.1decayHalfLifeNanos- how fast excitation fades, e.g. 2s. Stability requires branching ratio α/β < 1 where β = ln2/halfLife (per second): at a 2s half-life, β ≈ 0.35/s, so α must stay below ~0.35 — rejected otherwise.
-
HawkesIntensity
public HawkesIntensity()Baseline 2 events/s, excitation 0.1/s per event, 2s half-life (branching ~0.29).
-
-
Method Details
-
onEvent
public void onEvent(long timestampNanos) One event arrival. Timestamps must be non-decreasing; an out-of-order timestamp is dropped (negative decay would GROW past excitation instead of fading it). -
intensity
public double intensity(long nowNanos) The current intensity λ(now) in events per second. -
burstScore
public double burstScore(long nowNanos) The dimensionless burst regime: self-excited intensity over the baseline, clamped to [0, 1] at "activity running 2× baseline". 0 in steady flow; decays back with the configured half-life. -
events
public long events()
-