The Impact of Sequential versus Parallel Clearing Mechanisms in Agent-Based Simulations of Artificial Limit Order Book Exchanges

Matej Steinbacher, Mitja Steinbacher, Matjaž Steinbacher · 2025

Read The Impact of Sequential versus Parallel Clearing Mechanisms in Agent-Based Simulations of Artificial Limit Order Book Exchanges by Matej Steinbacher, Mitja Steinbacher, Matjaž Steinbacher (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2509-01683.txt.

Introduction

Matej Steinbacher, Mitja Steinbacher, and Matjaz Steinbacher test how the coding of a fake stock market can skew its prices. Their market uses software agents that trade many assets under set budget rules. They compare clearing trades one book at a time with clearing all books at once. Clearing is the step that matches buys and sells and moves cash.

Handling books in order gives early assets first claim on each trader's cash within a step. That edge bends demand and price paths for each asset in a steady, clear way. Broad price levels still track big factors such as cash supply. The lesson is that market model builders must check clearing code with care, or risk fake results.

Catalog record

CREATORMatej Steinbacher, Mitja Steinbacher, Matjaž Steinbacher
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE27 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2509-01683

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

The Impact of Sequential versus Parallel Clearing Mechanisms in Agent-Based Simulations of Artificial Limit Order Book Exchanges Matej Steinbacher, Mitja Steinbacher, Matjaž Steinbacher Abstract This study examines the impact of different computing implementations of clearing mechanisms on multi-asset price dynamics within an artificial stock market framework. We show that sequential processing of order books introduces a systematic and significant bias by affecting the allocation of traders’ capital within a single time step. This occurs because applying budget constraints sequentially grants assets processed earlier preferential access to funds, distorting individual asset demand and consequently their price trajectories. The findings highlight that while the overall price level is primarily driven by macro factors like the money-to-stock ratio, the market’s microstructural clearing mechanism plays a critical role in the allocation of value among individual assets. This underscores the necessity for careful consideration and validation of clearing mechanisms in artificial markets to accurately model complex financial behaviors. Keywords: Artificial Stock Market, Trading, Agent-Based Model, Limit Order Book, Multithreading, Parallel Programming 1 Introduction Computational simulation has become an indispensable tool within economics and finance, providing a critical methodology for investigating complex, dynamic systems populated by interacting agents [ 3 ] , [ 7 ] , [ 9 ] , [ 13 ] , [ 12 ] , [ 2 ] . Its value lies in enabling the analysis of phenomena—ranging from agent-based models of financial markets and macroeconomic dynamics to the estimation of complex econometric structures—that are often intractable through analytical methods or direct empirical observation alone. However, ensuring the validity and reliability of simulation-based research hinges critically on the computational model’s ability to faithfully represent the theoretical system under study. A fundamental challenge emerges in mapping the inherent simultaneity of many economic and financial processes onto computational frameworks that default to sequential execution. While the application of parallel computing in this domain is commonly driven by the pursuit of increased computational speed and the capacity to handle ever-larger models – a focus primarily on efficiency – there exists an equally, if not more, critical dimension concerning the impact of execution strategy on the correctness and structural validity of the simulation results, see, for instance, [ 2 ] . Economic and financial interactions, such as simultaneous trading decisions across multiple assets within a defined period, the concurrent assimilation of information by diverse agents, or the coordinated allocation of finite resources under constraints, are conceptually designed as contemporaneous events. Direct translation of these processes into strictly sequential algorithms can introduce computational artifacts that fundamentally distort the simulated dynamics. Consider the case of agent-based simulations involving multiple traders interacting across several asset markets, particularly under binding resource constraints like limited trading budgets. A common sequential implementation might process these markets or assets one after another. As illustrated by simulations of this nature, such sequential processing can impose artificial order dependencies that lead to outcomes qualitatively distinct from those where interactions are handled concurrently. For example, sequential processing often results in the arbitrary ordering of asset handling dictating their relative performance and price trajectories, manifesting as a clear separation and ranking of asset prices that is dependent on the processing sequence. This stands in stark contrast to outcomes observed under parallel execution, where the same assets might exhibit much more intertwined dynamics and converge towards similar price levels, reflecting a more accurate representation of agents simultaneously considering multiple investment opportunities within a global budget constraint. We argue argue that, compellingly demonstrated by the divergent outcomes observed in sequential versus parallel simulations of multi-asset trading systems, parallel programming is frequently not merely an optimization technique but a methodological prerequisite for achieving rigorous and unbiased simulation results in economics and finance. By enabling the concurrent execution of conceptually simultaneous processes, parallelization can effectively eliminate the order-dependent biases introduced by sequential processing. Our primary focus is thus not on quantifying computational speedup, but on demonstrating how the failure to adopt appropriate parallelization can introduce fundamental incorrectness into simulation results, leading to misleading insights and potentially flawed theoretical or policy conclusions that are artifacts of the computational method rather than genuine properties of the economic system being modeled. We contend that for a significant class of simulation-based research characterized by simultaneous interactions and constraints, parallel computing is essential for ensuring the structural validity and fidelity of the simulation outcomes. The study proceeds as follows. Section 2 builds a model that is a base for traders’ decision-making. Section 3 shows mathematically that clearing mode affects results. A pseudo-code of the computer algorithm is shown in Section 4 , while simulations are processed and analyzed in Section 5 . Last section concludes. 2 The Model The model is a multi-asset version of the [ 10 , 11 ] . 1 1 1 For a general discussion on limit order book models, see, for instance, [ 8 ] , [ 6 ] , [ 1 ] . Let the discrete-time, discrete-state environment be populated with i\in\{1,2,...,N\} interacting agents, who trade multiple assets S=S_{1},...,S_{J} over a time horizon t\in\{0,1,...,T\} and whose wealth W_{t}^{i}=M_{t}^{i}+\sum_{j=1}^{J}\left(S_{j,t}^{i}P_{j,t}\right),\quad i\in\{1,2,...,N\} in time t is composed of two components: monetary holdings M_{t}^{i}\in\mathbb{R}{\geq 0} and holdings of assets S_{j,t}^{i} with P_{j,t}\in\mathbb{R}^{+} is the market price of the asset j at time t . Since short selling through negative money holdings is not allowed and S_{j,t}^{i}\in\mathbb{Z}^{+} which means that only non-negative integer position in the asset is allowed. Agents in the model trade the stock by maximizing their expected wealth of the form \max_{\{\pi_{t}^{i}\}_{t=0}^{T-1}}\mathbb{E}_{0}\left[\sum_{t=1}^{T}\beta^{t-1}u(W_{t}^{i})\right], (1) where \pi_{t}^{i} represents the trading strategy of agent i at time t ; \beta\in(0,1) is the discount factor, reflecting the time preference of the agent; u:\mathbb{R}\rightarrow\mathbb{R} is a utility function, CRRA in our case, which is strictly increasing, concave, and twice continuously differentiable of the form: u(W)=\frac{W^{1-\gamma}}{1-\gamma} for \gamma\neq 1 and u(W)=\ln(W) for \gamma=1 , where \gamma>0 is the coefficient of relative risk aversion; \mathbb{E}_{0}[\cdot] denotes the expectation operator conditional on the information available at time t=0 and t=1,2,...,T is time domain. It was shown in [ 10 ] that solving the utility function for a myopic, random trader who does not incorporate risk consideration into the trading decision his trading decision-making to \displaystyle\pi_{t} \displaystyle=\begin{cases}B_{t}&P_{t}^{\ast}<E[P_{t+1}],\\ A_{t}&P_{t}^{\ast}>E[P_{t+1}],\\ \text{Nothing}&\text{else}\end{cases} (2) This means that the trader submits an ask order if his private expectation of the price-change is a drop and a bid order if the price is expected to rise. The price expectations are created as E_{t}^{i}[P_{t+1}|P_{t}]=P_{t}\cdot(1+\Delta_{i}), (3) where \Delta_{i}\sim U(-\sigma,\sigma) is independently and identically distributed (i.i.d.) from a uniform distribution U(-\sigma,\sigma) . All orders of an asset j are submitted to the order book O_{j} that works as a collection of all bids B_{j,t}=\{(P^{i}_{b},q^{i}_{b}):P_{b}\in\mathbb{R}^{+},q_{b}\in\mathbb{N},i\in\{1,2,...,N\}\} and asks A_{t}=\{(P^{i}_{a},q^{i}_{a}):P_{a}\in\mathbb{R}^{+},q_{a}\in\mathbb{N},i\in\{1,2,...,N\}\} of the asset j . O_{j} operates as a collector of bids and asks and a matchmaker that matches and settles the best bid and ask orders in a form of a trade. The best bid price is the highest bid price available in the market at time t or P_{t}^{b}=\sup\{P_{b}:(P^{i}_{b},q^{i}_{b})\in B_{t}\} , while the best ask price is the lowest ask price available at time t or P_{t}^{a}=\inf\{P_{a}:(P^{i}_{a},q^{i}_{a})\in A_{t}\} , where \sup denotes the supremum or least upper bound and \inf denotes the infimum that is greatest lower bound. A trade is settled

Read the complete text