This repository contains the research paper and MATLAB code developed for investigating market crash phenomena using adaptations of the Ising model. The project applies statistical physics concepts to financial markets, simulating market sentiment dynamics, magnetization behavior under varying external conditions, and reproducing historical market crash characteristics.
-
isingModelForMarketCrash.ipynb
The notebook used for running the monte carlo simulations and generating analysis graphs. -
MagnetizationVSExternalField.m
MATLAB script that simulates and plots the magnetization as a function of an external magnetic field for various fixed temperature values. This file demonstrates how the market’s “magnetization” (analogous to investor sentiment) responds to external influences. -
MagnetizationVSTempretureForExternalField.m
MATLAB script that simulates and plots the magnetization as a function of temperature for different external magnetic field values. This code helps illustrate the phase transition-like behavior in the model when the market is subjected to varying external factors.
Financial markets are complex systems where the collective interactions among market participants can lead to emergent phenomena such as market crashes. Inspired by the Ising model—originally used in statistical physics to study ferromagnetism—this research explores how local interactions among agents (traders) may lead to abrupt transitions, akin to phase transitions in physical systems. The repository includes MATLAB code to simulate these dynamics, generate key plots, and support the findings presented in the research paper.
-
MATLAB R2018a or later (or equivalent Octave version)
The scripts have been developed and tested in MATLAB. Ensure that your MATLAB installation supports basic plotting functions and random number generation. -
Basic MATLAB toolboxes
No additional toolboxes are required. The scripts rely on core MATLAB functions for simulation and visualization.
-
Download/Clone the Repository
Clone this repository to your local machine using:git clone https://github.com/yourusername/ising-model-market-crash.git
-
Open MATLAB
Navigate to the repository folder in MATLAB. -
Run the Scripts
- To generate the Magnetization vs External Field plot, open and run
MagnetizationVSExternalField.m
. - To generate the Magnetization vs Temperature plot, open and run
MagnetizationVSTempretureForExternalField.m
.
Each script will produce a figure window with the corresponding simulation results. You can adjust parameters within the scripts if needed.
- To generate the Magnetization vs External Field plot, open and run
This script simulates a one-dimensional Ising model with a variable external magnetic field. The parameters include:
numSpins
: The number of spins (agents) in the simulation.J
: Interaction strength between neighboring spins.numIterations
: The number of Monte Carlo steps to equilibrate the system.fields
: A vector defining the range of external magnetic field values.temperatures
: A vector of different temperature values used to observe system behavior under different thermal fluctuations.
The script uses the Metropolis algorithm to determine spin flips, calculates average magnetization, and plots magnetization versus external field for each temperature.
(See MagnetizationVSExternalField.m for full details.)
This script focuses on the effect of temperature on the magnetization of the Ising model in the presence of fixed external fields. Key parameters include:
numSpins
: The number of spins in the lattice.J
: The interaction strength.fields
: An array of selected external magnetic field values.temperatures
: A range of temperatures over which the simulation is performed.
Similarly, the Monte Carlo simulation is run for each temperature and field combination, with the magnetization computed and plotted to highlight how thermal fluctuations impact the collective behavior.
(See MagnetizationVSTempretureForExternalField.m for full details.)
The file isingModelForMarketCrash (1).pdf contains the comprehensive report on the application of the Ising model to market crash phenomena. It includes:
- Introduction: Background and motivation for using the Ising model in financial markets.
- Methodology: Detailed explanation of the simulation techniques and model adaptations.
- Results: Discussion of simulation outputs, including plots generated by the MATLAB scripts.
- Discussion & Conclusion: Analysis of the findings and implications for understanding market crashes.
For additional context and further reading, please consult the following references which have inspired parts of this work:
- Sornette, D. (2003). Why Stock Markets Crash: Critical Events in Complex Financial Systems.
- Bouchaud, J.-P. & Potters, M. (2000). Theory of Financial Risk and Derivative Pricing: From Statistical Physics to Risk Management.
(Additional citations are provided within the research paper.)
This project is supported by interdisciplinary research efforts combining insights from physics and finance. Special thanks to collaborators and mentors for their guidance in bridging these fields.