This project implements a Univariate Hawkes Process to model the arrival times of high-frequency trades (tick data). Unlike Poisson processes, which assume event independence, Hawkes processes capture the "self-exciting" nature of financial markets where a large trade increases the probability of subsequent trades.
This tool is designed to estimate the Branching Ratio (
Key Features:
-
Recursive MLE: Custom
$O(N)$ Log-Likelihood implementation (vs. naive $O(N^2)$). - Ogata's Thinning: Simulation engine for generating synthetic "flash crash" scenarios.
- Criticality Detection: Automated calculation of market stability metrics.
The conditional intensity function
Where:
-
$\mu$ : Background intensity (exogenous events, e.g., news). -
$\alpha$ : Excitation parameter (immediate impact of a trade). -
$\beta$ : Decay rate (how fast the market "forgets" the trade).
The Branching Ratio (
- If
$n < 1$ : Sub-critical (Stable). - If
$n \ge 1$ : Super-critical (Unstable / Flash Crash Prone).
- src/model.py: Core Hawkes logic, including the recursive log-likelihood function.
- src/data_gen.py: Synthetic tick data generator using Ogata's Thinning Algorithm.
- src/analytics.py: Visualization tools for intensity curves and criticality reporting.
Educational Use Only. This software is for research and educational purposes. It is not intended to be used as a standalone trading system or financial advice. The "Criticality" metrics derived here are theoretical constructs and may not predict all market anomalies.