This repository implements and calibrates a Heterogeneous Agent Model (HAM) based on the framework proposed by Brock & Hommes (1998) and extended by Majewski et al. (2020).
The project explores the emergence of stylized facts in financial markets (volatility clustering, fat tails) through the interaction of "Fundamentalist" and "Chartist" agents. A robust calibration engine using the Iterative Generalized Method of Moments (GMM) is developed to estimate structural parameters against Bitcoin (BTC/USD) historical data.
Keywords: Quantitative Finance, Agent-Based Modeling (ABM), GMM Calibration, High-Performance Computing, Stochastic Dynamics.
Implementation of a discrete-time dynamical system driven by switching heuristics:
Where:
-
Fundamentalists trade based on mean-reversion to a fundamental value
$v_t$ . -
Chartists trade based on a momentum signal
$m_t$ (exponential moving average). - Switching Mechanism: Agents update their beliefs based on past profitability.
To handle the computational cost of simulating stochastic trajectories during the optimization loop, the simulation engine is optimized using Just-In-Time (JIT) compilation:
- Numba Integration: Achieving ~100x speedup compared to standard Python loops for the core Monte Carlo simulations.
- Parallel Computing: Grid search and statistical validation are parallelized using
Joblibto leverage multi-core architecture.
-
Iterative GMM: Estimation of parameters using an adaptive weighting matrix
$W$ (inverse of moment covariance) to minimize the distance between simulated and empirical moments. -
Sloppiness Analysis: Investigation of parameter identifiability and sensitivity analysis (RMSE/STD on 100+ runs) to distinguish robust parameters (
$\kappa_1$ ) from "sloppy" ones ($\gamma$ ).
The project is designed as a standalone research notebook for reproducibility and ease of review.
.
βββ Bitcoin_ABM_Calibration.ipynb # Complete analysis (Model, GMM, Validation, Prediction)
βββ requirements.txt # List of dependencies
βββ README.md # Project documentation