# Hawkes nanosecond-tie public reproducer

Article: https://vxi.me/posts/hawkes-itch-nanosecond-ties-likelihood/

## Contents and provenance

- `tie_114_toy.py`: Python standard-library example with 114 **synthetic** coincident events. No market data.
- `aapl-execution-batch-histogram.json`: 42 **aggregated** batch-size frequency bins from the official 2019-07-30 Nasdaq historical TotalView-ITCH 5.0 sample (AAPL, RTH 09:30-16:00 America/New_York). Includes E/C execution messages, both C Printable=Y and N. Owner attested permission to publish the derived aggregate. **No original market event rows, individual order IDs, exact timestamps, or order books are included.**
- `tie_histogram_sensitivity.py`: computes 27 *hypothetical* conditional upper-bound scenarios for execution-type self-excitation only, not the actual three-type Hawkes likelihood or fitted market parameters.
- `test_tie_histogram_sensitivity.py`: 13 public Python stdlib tests.
- `reference-results.json`: nine mu=5 scenario values, top-1/3/10 checks, and synthetic toy reference outputs.
- `SHA256SUMS.txt`: byte hashes of the six files above (the manifest does not hash itself).

The 99/99 research-slice synthetic tests cited in the article were run earlier on a separate private experiment. They are **not** this public 13-test suite, are not part of this bundle, and are not asserted as a fresh CI run.

## Run (Python 3, stdlib only)

```sh
python3 tie_114_toy.py
python3 -m unittest -v test_tie_histogram_sensitivity.py
python3 tie_histogram_sensitivity.py --input aapl-execution-batch-histogram.json --output scenario-results-recomputed.json
sha256sum -c SHA256SUMS.txt
```

On macOS, use `shasum -a 256 -c SHA256SUMS.txt`. The recomputed output is not part of the checksummed source bundle.

## Expected checks

- 114 synthetic events: pre-batch event term 183.475922; naive row-ordered event term 396.770155; artificial excess 213.294233; one-second compensator 48.237046; full pre-batch LL 135.238876 nats.
- Historical histogram: 49,172 execution records; 29,379 unique timestamps; 10,287 tied timestamps; 30,080 records in tied batches.
- `Delta(m; alpha,tau,mu) = sum_i log1p(alpha*i/(tau*mu))`; `sum_m count(m) * Delta(m)`. For *assumed* mu=5, alpha=0.3, tau=1, the conditional bound is 3472.788504... nats. The top 1/3/10 contributions are 321.536601, 665.623025, 1123.568963 nats.
- The correct score uses a single pre-batch `lambda(t-)` before updating the full multiplicity. Shuffle invariance alone is insufficient when the batch has only identical event types. Include an independent numeric reference and the compensator.

## Limitations, attribution, license scope

Historical sample: https://emi.nasdaq.com/ITCH/Nasdaq%20ITCH/
ITCH 5.0 specification: https://nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTVITCHSpecification.pdf

The aggregate cannot recover intraday time or order identity of batches of sizes 114/131/187, nor prove market Hawkes fitting, out-of-sample predictions, or superiority over Poisson/NHPP. The conditional single-type bound does **not** bound full three-type cross-excitation. Nasdaq is the historical source; these independent Python illustrations are not Nasdaq software and are not endorsed by Nasdaq.

Publication permission for the derived aggregate was attested by the owner, not independently inspected as a license document. This artifact does not grant downstream redistribution rights to other users.
