Hawkes Order-Arrival Model
Install and import
npm install fintech-algorithmsimport { hawkesOrderArrival } from "fintech-algorithms/market-microstructure/order-book-dynamics/hawkes-order-arrival-model";Signature
hawkesOrderArrival(eventTimesSeconds, baselineIntensity, excitationJump, decayRate, evaluationTimeSeconds, horizonSeconds)A self-exciting point process: each arrival raises the probability of the next. It captures order clustering that a Poisson model cannot, which is why order flow looks bursty rather than smooth.
Parameters
| Name | Type | Notes |
|---|---|---|
eventTimesSeconds | number[] | Arrival times in seconds, ascending. |
baselineIntensity | number | Background arrival rate absent any excitation. min: 0 |
excitationJump | number | Intensity added by each arrival. Above the decay rate the process is explosive and has no stationary distribution. min: 0 |
decayRate | number | Rate at which excitation fades. min: 0 |
evaluationTimeSeconds | number | Time at which the intensity is evaluated. min: 0 |
horizonSeconds | number | Forecast horizon for expected arrivals. min: 0 |
Returns
{ intensity, expected_arrivals, branching_ratio, stationary, … }
Intensity and expected arrivals, plus the branching ratio — at or above 1 the process is non-stationary and the forecast is meaningless.
Errors
- When event times are not ascending, or decayRate is zero — throws
Complexity: time O(n),
space O(1).
Worked example
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input
[0.2, 0.9, 1.4, 2.7]0.50.81.633.5Call
hawkesOrderArrival(eventTimesSeconds, baselineIntensity, excitationJump, decayRate, evaluationTimeSeconds, horizonSeconds)Returns
object with 15 fields: model, event_count, baseline_intensity, excitation_jump, decay_rate, branching_ratio, stationary, expected_cluster_multiplier, …
{
"model": "univariate-exponential-hawkes",
"event_count": 4,
"baseline_intensity": 0.5,
"excitation_jump": 0.8,
"decay_rate": 1.6,
"branching_ratio": 0.5,
"stationary": true,
"expected_cluster_multiplier": 2,
"evaluation_time_seconds": 3,
"intensity_at_evaluation": 1.0937254434790773,
"event_intensities": [0.5, 0.7610238356984316, 0.9767487409980575, 0.6595044911371601],
"horizon_seconds": 3.5,
"compensator": 3.5832637259446924,
"log_likelihood": -4.9892938375210205
}Showing 14 of 15 fields.
Other exports
This module also exports
orderBookSlope, depthWeightedMidprice, microprice, orderBookResiliency, calculate. Every module additionally exports run as an alias of its
primary function, and a meta object carrying its catalog id, domain, family,
shape and article URL.
Diagrams
How it works
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References
- Hawkes (1971) — Alan G. Hawkes
- NYSE Integrated Feed — NYSE
- Hawkes model for price and trades high-frequency dynamics — Emmanuel Bacry and Jean-François Muzy
- Publication and data boundary