An Ising Model Approach to Financial Markets - Market Crashes as Phase Transitions (Warwick Mathematical Finance Magazine Submission)
This project investigates financial market dynamics through the framework of statistical mechanics, using the Ising model as a minimal agent-based system.
By modelling traders as interacting spins on a lattice, the project explores how local interactions can give rise to emergent macroscopic behaviour, including:
- Large-scale coordination (market trends)
- Abrupt regime shifts (crash-like behaviour)
- Heavy-tailed return distributions
The central aim is to assess whether key stylised facts of financial markets can be reproduced near criticality.
We consider a 2D Ising model on a square lattice with periodic boundary conditions:
-
Spins:
$s_i \in {-1, +1}$ - Hamiltonian:
- Dynamics:
- Metropolis-Hastings updates (standard Ising)
- Heat-bath dynamics with Bornholdt-type feedback
| Physics Quantity | Financial Analogy |
|---|---|
| Spin |
Trader decision (buy/sell) |
| Magnetisation |
Aggregate market sentiment |
| Temperature |
Market uncertainty |
| Coupling |
Interaction strength between agents |
| Phase transition | Market instability / crashes |
To introduce feedback effects, we include a global term in the effective field:
This term penalises alignment with the global state when the market is over-extended, generating:
- Intermittent switching
- Increased volatility
- More realistic return dynamics
We define a toy return series derived from the change in magnetisation:
This enables analysis of return distributions, volatility dynamics, and autocorrelation structures.
-
Near the critical temperature (
$T_c$ ):- Large fluctuations in magnetisation.
- Fat-tailed return distributions (non-Gaussian).
-
Bornholdt dynamics:
- Increased intermittency.
- Richer volatility structure.
-
Limitations:
- Limited long-memory effects.
- Weak volatility clustering compared to real-world high-frequency data.
ising-market-model/
│
├── notebooks/ # Exploratory analysis and experiments
│
├── src/
│ ├── ising.py # Core Ising model and dynamics
│ ├── analysis.py # Statistical analysis of simulation output
│ ├── master.py # Experiment orchestration (parameter sweeps)
│ └── plotting.py # Visualisation tools
│
├── figures/ # Generated plots for analysis and paper
├── paper/ # Research article (PDF + LaTeX source)
│
├── requirements.txt
└── README.md
---
Clone the repository:
git clone https://github.com/yourusername/ising-market-model.git
cd ising-market-modelInstall dependencies:
pip install -r requirements.txtfrom src.master import IsingExperiment
exp = IsingExperiment(
size=50,
temperatures=[1.5, 2.0, 2.269, 2.5],
alphas=[1.0, 2.0, 4.0],
update_rule="bornholdt",
seed=42,
)
results = exp.run_grid(
n_equil=5000,
n_steps=10000,
sample_freq=10
)from src.plotting import IsingPlotter
plotter = IsingPlotter(results)
plotter.plot_magnetisation_vs_T()
plotter.plot_susceptibility()
# Plot specific dynamics
plotter.plot_time_series(T=2.269, alpha=2.0)
plotter.plot_returns(T=2.269, alpha=2.0)
plotter.plot_acf(T=2.269, alpha=2.0)| Step | Module | Description |
|---|---|---|
| 1 | ising.py |
Generates magnetisation and energy time series |
| 2 | analysis.py |
Computes returns, volatility, autocorrelation, and thermodynamic observables (Binder cumulant, heat capacity) |
| 3 | master.py |
Runs parameter sweeps across temperature |
| 4 | plotting.py |
Produces publication-quality figures |
- Research Paper to be uploaded
- Time-varying temperature (market regimes)
- Heterogeneous agent models
- Calibration to real market data (e.g. S&P 500)
- Information-theoretic measures (entropy, KL divergence)
This project is licensed under the MIT License.
- Statistical mechanics and Ising model literature
- Econophysics research on financial markets
- Python scientific computing ecosystem