# Order book model with herd behavior

This is the final post in our continuing series on the order book models. Though we do not entirely neglect this topic. It is quite likely that in the near future we will come back to discuss more of the order book models.

So this time we will finally talk about an order book model we (Aleksejus Kononovicius and Julius Ruseckas) have decided to propose. This will be only a brief introduction into the model as it will recycle couple of ideas and concepts we have discussed earlier. More details on the model are available in [1].

So, our order book model involves elements from the agent-based herding model, about which we often write about here on Physics of Risk, [2]. We have extended our earlier approach [3] by defining how different types of agents implement their strategies in order book setting. This implementation heavily relies on the core ideas of the empirical high-frequency trader's behavior model [4, 5] we have discussed recently.

## The model

We will define our model in terms of event rates. We will have five possible events:

- an agent switches his trading strategy from chartist to fundamentalist,
- an agent switches his trading strategy from fundamentalist to chartist,
- sign of market mood flips,
- an agent using chartist trading strategy considers submitting market order,
- an agent using fundamentalist trading strategy consider submitting marker order.

Essential feature of our usual approach to agent-based herding modeling is that transition rates between two states are proportional to the number of agents in the opposite state. Here we have also used the same shape of transition rates: \begin{equation} \lambda_{cf}\left(t\right)=\frac{\lambda_{e}}{\tau\left(N_{c}\left(t\right)\right)}N_{c}\left(t\right)\left[\varepsilon_{cf}+\left\{ N-N_{c}\left(t\right)\right\} \right], \end{equation} and \begin{equation} \lambda_{fc}\left(t\right)=\frac{\lambda_{e}}{\tau\left(N_{c}\left(t\right)\right)}\left[N-N_{c}\left(t\right)\right]\left[\varepsilon_{fc}+N_{c}\left(t\right)\right]. \end{equation} In the above \( \lambda_{ij} \) is the transition rate from state \( i \) to state \( j \), \( \lambda_{e} \) is the base event rate, while \( \tau(\dots) \) plays the same role as earlier [3]. As usual \( N \) stands for total number of agents, while \( N_c \) for number of agents using chartist trading strategy, while \( \varepsilon_{ij} \) are responsible for the idiosyncratic switching rate between the trading strategies.

We can't do full model with out splitting chartists into two groups (optimists and pessimists) [6], but we can simplify this matter a bit by introducing mean market mood, \( \xi \). If \( \xi \) is positive, then more chartists feel optimistic. Here we can consider a very simple model for \( \xi \): mood is only able to change its sign with rate: \begin{equation} \lambda_{M}\left(t\right)=\frac{\lambda_{e}}{\tau\left(N_{c}\left(t\right)\right)}\lambda_{m}, \end{equation} where \( \lambda_m \) is the base rate for the mood swings. The probability that chartist will submit market bid (buy) order is dependent on \( \xi \) as follows: \begin{equation} p_{\text{bid}}\left(t\right)=\frac{1+\xi\left(t\right)}{2}. \end{equation}

Trading rate for chartist traders takes a very simple form: \begin{equation} \lambda_{tC}(t)= \frac{\lambda_e}{\tau(N_c(t))} \lambda_{tc} N_c(t) . \end{equation} While for fundamentalist traders it is a bit more complex: \begin{equation} \lambda_{tF}\left(t\right)=\frac{\lambda_{e}}{\tau\left(N_{c}\left(t\right)\right)}\lambda_{tf}\left[N-N_{c}\left(t\right)\right]\left|\ln\left(\frac{P\left(t\right)}{P_{f}}\right)\right|, \end{equation} because fundamentalists' activity is conditioned on the deviations of price from the fundamental price. In both rates above \( \lambda_{ti} \) stands for trading activity of a single agent using trading strategy \( i \), while \( P \) stands for price and \( P_f \) for fundamental price.

All these transition rates are updated after each event.

Note that we have not described how order book is filled with limit orders. This mechanism is partly lifted from the HFT order book model [4, 5]. Namely, we assume that chartists are liquidity providers, who submit limit orders to the both sides of the order book. The spread between their limit orders is determined in the same manner as in [4, 5], but their valuation (mid point between the limit orders) is always assumed to be equal to the current market price. Namely, here we have simplified the HFT order book model by assuming that orders are adjusted instantaneously. Fundamentalists in our model do not submit limit orders at all, they only exploit their knowledge with market orders.

## Interactive applets

To understand the model and its dynamics better you should study the interactive applets below.

The first applet shows us how the structure of the order book evolves as the time goes on. Note that the profiles of the both sides remain more or less the same in this model and only the price movements are rather easily noticed. The shapes of the profiles change only if chartist agent switches away to fundamentalist trading strategy (then his limit orders are canceled) or if fundamentalist becomes chartist (then new limit orders are submitted). These changes are slower than trading rate, hence they are harder to be noticed.

The second applet is a traditional Physics of Risk applet for most financial market models. Here you can see how price and return time series look like as well as explore the two main statistical properties of absolute return time series - probability density function (PDF) and spectral density. Note that return PDF for default parameters has power-law form, while PSD looks fractured. These more-or-less reproduce the exact empirical shapes of respective empirical statistical properties.

**Acknowledgment.** This post is based on research which was carried out as a part of the postdoctoral fellowship ''Physical modeling of order-book and opinion dynamics'' (09.3.3-LMT-K-712-02-0026) project. The fellowship is funded by the European Social Fund under the No 09.3.3-LMT-K-712 ''Development of Competences of Scientists, other Researchers and Students through Practical Research Activities'' measure.

## References

- A. Kononovicius, J. Ruseckas. Order book model with herding behavior exhibiting long-range memory. Physica A 525: 171-191. doi: 10.1016/j.physa.2019.03.059. arXiv: 1809.02772 [q-fin.ST].
- A. P. Kirman. Ants, rationality and recruitment. Quarterly Journal of Economics 108: 137-156 (1993).
- A. Kononovicius, V. Gontis. Agent based reasoning for the non-linear stochastic models of long-range memory. Physica A 391: 1309-1314 (2012). doi: 10.1016/j.physa.2011.08.061. arXiv: 1106.2685 [q-fin.ST].
- K. Kanazawa, T. Sueshige, H. Takayasu, M. Takayasu. Derivation of the Boltzmann Equation for the Financial Brownian Motion. Physical Review Letters 120: 138301 (2018). doi: 10.1103/PhysRevLett.120.138301. arXiv: 1703.06739 [q-fin.TR].
- K. Kanazawa, T. Sueshige, H. Takayasu, M. Takayasu. Kinetic Theory for Finance Brownian Motion from Microscopic Dynamics. arXiv: 1802.05993 [q-fin.TR].
- A. Kononovicius, V. Gontis. Three state herding model of the financial markets. EPL 101: 28001 (2013). doi: 10.1209/0295-5075/101/28001. arXiv: 1210.1838 [q-fin.ST].