# A prognosis oriented microscopic stock market model

## I Introduction

In the last years a number of microscopic models for price fluctuations have been developed by physicists  and economists . The purpose of these models is, in our view, not to make specific predictions about the future developments of the stock market (for instance with the intention to make a fortune) but to reproduce the universal statistical properties of liquid markets.

Some of these properties are an exponentially truncated Levy-distribution for the price differences on short time scales (significantly less than one month) and a linear autocorrelation function of the prices which decays to zero within a few minutes .

We present a new microscopic model with interacting investors in the spirit of  that speculate on price changes that are produced by themselves. The main features of the model are individual forecasts (or prognoses) for the stock price in the future, a very simple trading strategy to gain profit, limited orders for buying and selling stocks  and various versions of interaction among the investors during the stage of forecasting the future price of a stock.

The paper is organized as follows: In section 2 we define our model, in section 3 we present the results of numerical simulations of this model including specific examples of the price fluctuations using different interactions among the investors, the autocorrelation function of the price differences and most importantly their distribution, which turn out to be (exponentially) truncated Levy distributions. Section 4 summarizes our findings and provides an outlook for further refinements of the model.

## II The model

The system consists of one single stock with actual price $`K(t)`$ and $`N`$ investors labeled by an index $`i=1,\mathrm{},N`$. In the most simplified version of the model the investors have identical features and are described at each time step by three variables:

* The personal prognosis of investor $`i`$ at time $`t`$ about the price of the stock at time $`t+1`$.
* The cash capital (real variable) of investor $`i`$ at time $`t`$.
* The number of shares (integer variable) of investor $`i`$ at time $`t`$.

The system at time $`t=0`$ is initialized with some appropriately generated initial values for $`P_i(t=0)`$, $`C_i(t=0)`$ and $`S_i(t=0)`$, plus a particular price for the stock.

The dynamics of the system evolves in discrete time steps $`t=1,2,3,\mathrm{}`$ and is defined as follows. Suppose time step $`t`$ has been finished, i.e. the variables $`K(t)`$, $`P_i(t)`$, $`C_i(t)`$ and $`S_i(t)`$ are known. Then the following consecutive procedures are executed.

Make Prognosis   
Each investor sets up a new personal prognosis via

$$P_i(t+1)=(xP_i(t)+(1x)K(t))e^{r_i},$$
(1)   
where $`x[0,1]`$ is a model dependent weighting factor (for the investor’s old prognosis and the price of the stock) and $`r_i`$ are independent identically distributed random variables of mean zero and variance $`\sigma `$ that mimic a (supposedly) stochastic component in the individual prognosis (external influence, greed, fear, sentiments $`\mathrm{}`$, see also ).

Make Orders   
Each investor gives his limit order on the basis of his old and his new prognosis:   
$`P_i(t+1)P_i(t)>0`$:   
investor $`i`$ puts a buy-order limited by $`P_i(t)`$, which means that he wants to transform all cash $`C_i(t)`$ into $`\mathrm{int}[C_i(t)/P_i(t)]`$ shares if $`K(t+1)P_i(t)`$.   
$`P_i(t+1)P_i(t)<0`$:   
investor $`i`$ puts a sell-order limited by $`P_i(t)`$, which means that he wants to transform all stocks into $`S_i(t)K(t+1)`$ cash if $`K(t+1)P_i(t)`$.   
Now let $`i_1,i_2,\mathrm{},i_{N_A}`$ be the investors that have put a sell-order and their limits are $`P_{i_1}(t)P_{i_2}(t)\mathrm{}P_{i_{N_A}}(t)`$, and let $`j_1,j_2,\mathrm{},j_{N_B}`$ be the investors that have put a buy-order and their limits are $`P_{j_1}(t)P_{j_2}(t)\mathrm{}P_{j_{N_B}}(t)`$.

Calculate new price   
Define the supply and demand functions $`A(K)`$ and $`B(K)`$, respectively, via

$`A(K)`$ $`=`$ $`{\displaystyle \underset{a=1}{\overset{N_A}{}}}S_{i_a}\theta (KP_{i_a}(t))`$ (2)   
$`B(K)`$ $`=`$ $`{\displaystyle \underset{b=1}{\overset{N_A}{}}}\mathrm{\Delta }S_{j_b}[1\theta (KP_{j_b}(t))]`$ (3)   
with $`\mathrm{\Delta }S_{j_b}=\mathrm{int}[C_{j_b}(t)/P_{j_b}(t)]`$ the number of shares demanded by investor $`j_b`$, and $`\theta (x)=1`$ for $`x0`$ and $`\theta (x)=0`$ for $`x<0`$. Then the total turnover at price $`K`$ would be

$$Z(K)=\mathrm{min}\{A(K),B(K)\}$$
(4)   
and the new price is determined is such a way that $`Z(K)`$ is maximized. Since $`Z(K)`$ is a piece-wise constant function it is maximal in a whole interval, say $`K[P_{i_{\mathrm{max}}},P_{j_{\mathrm{max}}}]`$ for some $`i_{\mathrm{max}}\{i_1,\mathrm{},i_{N_A}\}`$ and $`j_{\mathrm{max}}\{j_1,\mathrm{},i_{N_B}\}`$. Then we define the new price to be the weighted mean

$$K(t+1)=\frac{P_{i_{\mathrm{max}}}A(P_{i_{\mathrm{max}}})+P_{j_{\mathrm{max}}}B(P_{j_{\mathrm{max}}})}{A(P_{i_{\mathrm{max}}})+B(P_{j_{\mathrm{max}}})}.$$
(5)   
Note that the weight by the total supply and demand takes care of the price being slightly higher (lower) than the arithmetic mean $`(P_{i_{\mathrm{max}}}+P_{j_{\mathrm{max}}})/2`$ if the supply is smaller (larger) than the demand.

Execute orders   
Finally the sell-orders of the investors $`i_1,\mathrm{},i_{\mathrm{max}}`$ and the buy-orders of the investors $`j_1,\mathrm{},j_{\mathrm{max}}`$ are executed at the new price $`K(t+1)`$, i.e. the buyers $`j_1,\mathrm{},j_{\mathrm{max}}`$ update

$`S_{j_b}(t+1)`$ $`=`$ $`S_{j_b}(t)+\mathrm{int}[C_{j_b}(t)/P_{j_b}(t)]`$ (6)   
$`C_{j_b}(t+1)`$ $`=`$ $`C_{j_b}(t)K(t+1)(S_{j_b}(t+1)S_{j_b}(t))`$ (7)   
and the investors $`i_1,\mathrm{},i_{\mathrm{max}}`$ sell all their shares at price $`K(t+1)`$:

$`S_{i_a}(t+1)`$ $`=`$ $`0`$ (8)   
$`C_{i_a}(t+1)`$ $`=`$ $`C_{i_a}(t)+S_{i_a}(t)K(t+1)`$ (9)   
If $`A(P_{i_{\mathrm{max}}})<B(P_{j_{\mathrm{max}}})`$ then investor $`j_{\mathrm{max}}`$ cannot buy $`\mathrm{int}[C_{j_{\mathrm{max}}(t)}/P_{j_{\mathrm{max}}}(t)]`$ but only the remaining shares, whereas in the case $`A(P_{i_{\mathrm{max}}})>B(P_{j_{\mathrm{max}}})`$ investor $`i_{\mathrm{max}}`$ cannot sell all his shares. The orders of the investors $`i_{\mathrm{max}+1},\mathrm{},i_{N_A}`$ and $`j_{\mathrm{max}+1},\mathrm{},j_{N_B}`$ cannot be executed due to their limits.

The execution of orders completes one round, measurements of observables can be made and then the next time step will be processed.

A huge variety of interaction among the investors can be modeled, here we restrict ourselves to three different versions taking place at the level of the individual prognosis genesis:

* Each investor $`i`$ knows the prognoses $`P_{i_1}(t),\mathrm{},P_{i_m}(t)`$ of $`m`$ randomly selected (once at the beginning of the simulation) neighbors. When making an order, he modifies his strategy and puts in the case

$$P_i(t+1)[g_i(t)P_i(t)+\underset{n=1}{\overset{m}{}}g_{i_n}(t)P_{i_n}(t)]<(>)0$$
(10)   
a buy (sell) order limited still by his own prognosis $`P_i(t)`$. We choose the weights $`g_i(t)=1/2`$ and $`g_{i_n}(t)=1/2m`$ for $`n=1,\mathrm{},m`$.
* In addition to interaction I<sub>1</sub> investor $`i`$ changes the weights $`g`$ after the calculation of the new price $`K(t+1)`$ according to the success of the prognoses:

$`g_i_{}(t+1)=g_i_{}(t)\mathrm{\Delta }g`$ (11)   
$`g_{i_+}(t+1)=g_{i_+}(t)+\mathrm{\Delta }g`$ (12)   
where fro each investro $`i`$ the index $`i_{}`$ ($`i_+`$) denotes the investor from the set $`\{i,i_1,\mathrm{},i_m\}`$ with the worst (best) prognosis, i.e.:

$`i_{}\{i,i_1,\mathrm{},i_m\}\mathrm{such}\mathrm{that}\mathrm{abs}[P_i_{}(t)K(t+1)]\mathrm{is}\mathrm{maximal}`$ (13)   
$`i_+\{i,i_1,\mathrm{},i_m\}\mathrm{such}\mathrm{that}\mathrm{abs}[P_{i_+}(t)K(t+1)]\mathrm{is}\mathrm{minimal}`$ (14)   
The weight $`g_i`$ is forced to be positive, because an investor should believe in his own prognosis $`P_i(t)`$.
* In addition to interaction I<sub>2</sub> neighbors with weights $`g_i_{}(t+1)<0`$ are replaced by randomly selected new neighbors.

## III Results

In this section we present the results of numerical simulations of the model described above. In what follows we consider a system with 1000 investors and build ensemble averages over 10000 independent samples (i.e. simulations) of the system. We checked that the results we are going to present below do not depend on the system size (the number of traders). When changing the system size, i.e. the number $`N`$ of investors, the statistical properties of the price differences do not change qualitatively. Increasing $`N`$ only decreases the average volatility (variance of the price changes).

For concreteness we have chosen the following parameters: the initial price of the stock is $`K_0=100`$ (arbitrary units, ), Each trader has initially $`C_i(t=0)=50000`$ units of cash and $`S_i(t=0)=500`$ stocks (thus the total capital of each trader is initially 100000 units). The standard deviation of the Gaussian random variable $`z`$ is $`\sigma =0.01`$ (with mean zero). We performed the simulations over 1000 time steps which is roughly 10 time longer than the transient time of the process for these parameters. In other words, we are looking at its stationary properties.

First we should note that in the deterministic case $`\sigma =0`$ no trade would take place , hence the stochastic component in the individual forecasts is essential for any interesting time evolution of the stock market price.

We focus on the time dependence of the price $`K(t)`$, the price change $`\mathrm{\Delta }_T(t)=K_{t+T}K_T`$ in an interval $`T`$, their time dependent autocorrelation

$$C_T(\tau )=\frac{\mathrm{\Delta }_T(t+\tau )\mathrm{\Delta }_T(t)\mathrm{\Delta }_T(t+\tau )\mathrm{\Delta }_T(t)}{(\mathrm{\Delta }_T(t))^2\mathrm{\Delta }_T(t)^2}$$
(15)   
and their probability distribution $`P(\mathrm{\Delta }_T(t))`$. The statistical properties of the price changes produced by our model depend very sensitively on the parameter $`x`$ in equation (1). In particular for the case $`x=1`$ it turns out that the total turnover decays like $`t^{1/2}`$ in the interaction-free case, which implies that after a long enough time no investor will buy or sell anything anymore. However, only an infinitesimal deviation from $`x=1`$ leads to a saturation of the total turnover at some finite value and trading will never cease.

In Fig.1–4 we present the results of the interaction-less case with $`x=1`$ (Fig. 1) and $`x=0`$ and contrast it with the results of the model with interactions $`I_1`$, also for $`x=1`$ (Fig. 3) and $`x=0`$ (Fig. 4).

For $`x=0`$ investor $`i`$ does not look at his old prognosis but only at the actual stock price when making a new prognosis. In this case the distribution of the price can be fitted very well by a Gaussian distribution irrespective of the version of interaction or no interaction. The self similarity exponent $`1/\mu 0.5`$ agrees with the scaling behavior of a Gaussian distribution. The autocorrelation function of the price differences decays alternating to zero within a few time steps.

In the opposite case $`x=1`$ investor $`i`$ makes his new prognosis $`P_i(t+1)`$ based on his own old one and never looks at the current stock price. Now we can show that the distribution of the price differences decays exponentially in its asymptotic, but the self similarity exponent $`1/\mu 0.2`$ is too small to agree with a Levy stable distribution. The autocorrelation function of the price differences decays very quickly, so that there are significant linear anti-correlations only between consecutive differences.

| $`1/\mu `$ | I<sub>0</sub> | I<sub>1</sub> | I<sub>2</sub> | I<sub>3</sub> |
| --- | --- | --- | --- | --- |
| $`x=0`$ | $`0.442`$ | $`0.466`$ | $`0.472`$ | $`0.472`$ |
| $`x=1`$ | $`0.228`$ | $`0.212`$ | $`0.185`$ | $`0.185`$ |

The selfsimilarity exponent has been determined via the scaling relation $`P(\mathrm{\Delta }_T=0)T^{1/\mu }`$ and a linear fit to the data of $`P(\mathrm{\Delta }_T=0)`$ versus $`T`$ in a log-log plot. These least square fits yield the relative errors for our estimates of the self similarity exponent $`1/\mu `$ in the table above, which lay between $`0.1\%`$ and $`0.3\%`$.

## IV Summary and outlook

We presented a new microscopic model for liquid markets that produces an exponentially truncated Levy-distribution with a self similarity exponent $`1/\mu 0.2`$ for the price differences on short time scales. Studying the distribution on longer time scales we find that it converges to a Gaussian distribution. The autocorrelation function of the price changes decays to zero within a few time steps. The statistical properties of our prognosis oriented model depend very sensitively on the rules how the investors make their prognoses.

There are many possible variations of our model that could be studied. It is plausible that a heterogeneous system of traders leads to stronger price fluctuations and thus a smaller value for the self similarity exponent $`\mu `$ (which appears to be $`1/\mu 0.7`$ for real stock price fluctuations ). The starting wealth could be distributed with a potential law (comparable with the cluster size in the Cont-Bouchaud model). Or the investors could have different rules for making prognoses and following trading strategies. Another possible variation is to implement a threshold in the simple strategy in order to simulate risk aversion (the value of the threshold could depend on the actual volatility).

Unfortunately, forecasts for real stock markets cannot be made with our model, because it is a stochastic model. We see possible applications for this model in the pricing and the risk measurement of complex financial derivatives.

Acknowledgment We thank D. Stauffer for helpful discussions. H. R.’s work was supported by the Deutsche Forschungsgemeinschaft (DFG).