Skip to content

About

A high-frequency market microstructure engine applying Econophysics, statistical mechanics, and Maximum Likelihood Estimation (MLE) to extract predictive alpha from limit order book data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Kinetic Order Book: High-Frequency Microstructure & Econophysics

Executive Summary

This repository bridges high-throughput data engineering with advanced Econophysics to model the hidden dynamics of financial market microstructure. By treating market participants as interacting particles within a fluid system, this engine reconstructs the limit order book (LOB) to extract predictive alpha and mathematically model liquidity consumption.

Theoretical Framework

  • Order Flow Imbalance (OFI): Maps the net directional pressure exerted by aggressive market orders against resting limit orders. By tracking volume fluxes at the Bid and Ask boundaries, the model isolates structural imbalances that empirically precede short-term price drift.
  • Hawkes Process Modeling: Quantifies market "FOMO" by framing order executions as self-exciting point processes. It measures how a single aggressive liquidity-taking event temporarily spikes the probability of subsequent algorithmic chain reactions.
  • Dynamic State Calibration: Utilizes Maximum Likelihood Estimation (MLE) via SciPy's SLSQP algorithm to computationally fit the Hawkes parameters (baseline noise, excitation, and exponential decay), strictly bounding the branching ratio to ensure mathematical stationarity.

Data Architecture & Licensing

The pipeline is designed to process Level-2 tick data. The demonstrations in this repository utilize Google (GOOG) order book data sourced from LOBSTER.

Note: Due to LOBSTER's academic licensing restrictions, the raw sample_data.csv is not included in this repository. To replicate this environment, you must download a sample dataset directly from LOBSTER and place it in the root directory.

Pipeline Execution & Reproduction

To replicate this research environment, you must initialize a cloud database to act as the high-frequency data sink.

  1. Environment Setup: Create a free project at Supabase. Create a .env file in your root directory containing your specific SUPABASE_URL and SUPABASE_ANON_KEY. Ensure .env is listed in your .gitignore.
  2. High-Frequency Ingestion: Execute node ingest.mjs to stream the asynchronous LOBSTER events into the cloud database via a backpressure-aware Node.js pipeline.
  3. State Reconstruction: Run python research/lob_reconstruction.py to recursively rebuild the Bid-Ask spread mechanics and calculate cumulative OFI pressure.
  4. MLE Optimization: Execute python research/hawkes_mle.py to computationally solve for the continuous-time physical constants governing the asset's microstructure.

Visual Analytics & Model Output

1. Dynamic State Reconstruction

The foundational engine reconstructs the continuous-time Bid-Ask spread mechanics from microsecond-level order book events. LOB Dynamics

2. Order Flow Imbalance (OFI)

Demonstrating the 0.45 Pearson correlation between cumulative net directional pressure and underlying mid-price drift. OFI Dynamics

3. Hawkes Process (MLE Calibration)

The dynamically calibrated structural FOMO model, constrained via SLSQP to maintain mathematical stationarity. Hawkes Calibration

About

A high-frequency market microstructure engine applying Econophysics, statistical mechanics, and Maximum Likelihood Estimation (MLE) to extract predictive alpha from limit order book data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages