Skip to content

leonsbt/Agent-Based-Model-Calibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agent-Based Model Calibration on Financial Time Series

Python Status

πŸ“ Abstract

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.

πŸ”¬ Key Methodologies

1. Structural Modeling (Extended Chiarella Model)

Implementation of a discrete-time dynamical system driven by switching heuristics: $$p_{t+1} - p_t = \kappa_1 (v_t - p_t) + \kappa_3 (v_t - p_t)^3 + \beta \tanh(\gamma m_t) + \epsilon_{t+1}$$

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.

2. High-Performance Calibration Engine

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 Joblib to leverage multi-core architecture.

3. Statistical Validation

  • 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$).

πŸ“‚ Project Architecture

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors