The original paper of the SFI-ASM has been reproduced by myself as project for my Bachelor thesis for the degree of B.A. Philosophy & Economics at the University of Bayreuth under the supervision of Dr. Paolo Galeazzi.
The reference to the paper is:
Arthur, W. Brian and Holland, John H. and LeBaron, Blake D. and Palmer, Richard G. and Tayler, Paul, Asset Pricing Under Endogenous Expectations in an Artificial Stock Market (Dec 12, 1996). Available at SSRN: https://ssrn.com/abstract=2252 or http://dx.doi.org/10.2139/ssrn.2252
The SFI-ASM is an agent-based artifical stock market model in which agent's co-create a market for a risky asset by trading it. The model is based on the assumption that agents are inductively rational and therefore do not have information about the expectations of others. In this sense the model is heterogeneous. They form expectations about the future price of the asset based on past prices. The model is able to reproduce stylized facts of real-world financial markets, such as fat tails in the distribution of returns, volatility clustering and long-term memory in the volatility of returns.
The model is implemented in Python 3.11.0. The main file is run.py
. The model is run by executing this file with the parameters specified in model_params.py
. One ap.Model
object gets initilized as ArtificialStockMarket
and contains the global artificial market specific procedures. Within this ArtificialStockMarket
, ap.Agent
objects get initialized as MarketStatistician
and contain the agent specific procedures. The ArtificialStockMarket
object contains a list of MarketStatistician
objects.
The ArtificialStockMarket
object contains the following procedures:
setup()
: sets up the model by initializing the agents and the marketstep()
: executes one step of the model, i.e. one time perioddocument()
: documents the model by saving the data of the agents and the market for the current time periodupdate()
: updates the model by updating the agents and the market for the current time period
The MarketStatistician
object contains the following procedures:
setup()
: sets up the agent by initializing the agent's variablesstep()
: executes one step of the agent, i.e. one time perioddocument()
: documents the agent by saving the agent's variables for the current time periodupdate()
: updates the agent by updating the agent's variables for the current time periodend()
: returns specific agent's variables for the last time period
The model parameters are specified in model_params.py
. The main parameters are:
N
: number of agents initially endowned with one risky assetsteps
: number of time periodsaverageDividend
: average dividend for the AR(1) process of the risky assetexperimentSplit
: binary with 0 for no split and 1 for split of the experiment into multiple batches
The model output is saved in the results
folder either in batches or as one directory depending on the experimentSplit
parameter.
The model can be reproduced by reproducing the conda env from the req.yml
and executing run.py
which takes the parameters specified in model_params.py
. One ap.Model
object gets initilized as ArtificialStockMarket
and contains the global artificial market specific procedures. Within this ArtificialStockMarket
, ap.Agent
objects get initialized as MarketStatistician
and contain the agent specific procedures.