# Hawkes Order-Arrival Model

`D11-F04-A05` · Market Microstructure → Order-Book Dynamics · archetype `record-transform` · difficulty 5/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/market-microstructure/order-book-dynamics/hawkes-order-arrival-model/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { hawkesOrderArrival } from "fintech-algorithms/market-microstructure/order-book-dynamics/hawkes-order-arrival-model";
```

## Signature

```ts
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 | Required | Notes |
| --- | --- | --- | --- |
| `eventTimesSeconds` | `number[]` | yes | Arrival times in seconds, ascending. |
| `baselineIntensity` | `number` | yes | Background arrival rate absent any excitation. · min: 0 |
| `excitationJump` | `number` | yes | Intensity added by each arrival. Above the decay rate the process is explosive and has no stationary distribution. · min: 0 |
| `decayRate` | `number` | yes | Rate at which excitation fades. · min: 0 |
| `evaluationTimeSeconds` | `number` | yes | Time at which the intensity is evaluated. · min: 0 |
| `horizonSeconds` | `number` | yes | 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

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

`eventTimesSeconds`:

```json
[0.2, 0.9, 1.4, 2.7]
```

`baselineIntensity`:

```json
0.5
```

`excitationJump`:

```json
0.8
```

`decayRate`:

```json
1.6
```

`evaluationTimeSeconds`:

```json
3
```

`horizonSeconds`:

```json
3.5
```

### Call

```ts
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, …

```json
{
  "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

`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.

## Verification and provenance

Tier: **verified** (via D).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/market-microstructure/order-book-dynamics/hawkes-order-arrival-model/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/market-microstructure/order-book-dynamics/hawkes-order-arrival-model/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/market-microstructure/llms.txt
