MarS: a Financial Market Simulation Engine Powered by Generative Foundation Model
Authors: Junjie Li
Yang Liu
Weiqing Liu
Shikai Fang
Lewen Wang
Chang Xu
Jiang Bian
Venue: ICLR 2025 Poster (2025)
Keywords: Financial Market Simulation
Generative Foundation Model
Large Market Model (LMM)
Controllable Simulation
Interactive Simulation
Market Impact
Reinforcement Learning
Forecasting
Market Manipulation Detection
Order-Level Data
Primary area: foundation or frontier models, including LLMs

Abstract: Generative models aim to simulate realistic effects of various actions across different contexts, from text generation to visual effects. Despite significant efforts to build real-world simulators, the application of generative models to virtual worlds, like financial markets, remains under-explored. In financial markets, generative models can simulate complex market effects of participants with various behaviors, enabling interaction under different market conditions, and training strategies without financial risk. This simulation relies on the finest structured data in financial market like orders thus building the finest realistic simulation. We propose Large Market Model (LMM), an order-level generative foundation model, for financial market simulation, akin to language modeling in the digital world. Our financial Market Simulation engine (MarS), powered by LMM, addresses the domain-specific need for realistic, interactive and controllable order generation. Key observations include LMM's strong scalability across data size and model complexity, and MarS's robust and practicable realism in controlled generation with market impact. We showcase MarS as a forecast tool, detection system, analysis platform, and agent training environment, thus demonstrating MarS's ``paradigm shift'' potential for a variety of financial applications. We release the code of MarS at https://github.com/microsoft/MarS/.

Published as a conference paper at ICLR 2025
MARS: A FINANCIAL MARKET SIMULATION ENGINE POWERED BY GENERATIVE FOUNDATION MODEL
Junjie Li, Yang Liu, Weiqing Liu! Shikai Fang, Lewen Wang, Chang Xu & Jiang Bian Microsoft Research Asia
, (junli, yang? i iu2, we giiiing ng. liu, fangsh iaai, lewen. wang, chanx, jiang. bi an @mi croso com
ABSTRACT
Generative models aim to simulate realistic effects of various actions across dif- ferent contexts, from text generation to visual effects. Despite significant efforts to build real-world simulators, the application of generative models to virtual worlds, like financial markets, remains under-explored. In financial markets, generative models can simulate complex market effects of participants with various behav- iors, enabling interaction under different market conditions, and training strate- gies without financial risk. This simulation relies the finest structured data in financial market like orders thus building the finest realistic simulation. We pro- pose Large Market Model (LMM), an order-level generative foundation model, for financial market simulation, akin to language modeling in the digital world. Our financial Market Simulation engine (MarS), powered by LMM, addresses the domain-specifi need for realistic, interactive and controllable order generation. Key observations include LMM's strong scalability across data size and model complexity, and MarS's robust and practicable realism in controlled generation with market impact. We showcase MarS as a forecast tool, detection system, analysis platform, and agent training environment, thus demonstrating MarS's s "paradigm shift" potential for a variety of financial applications. We release the code of MarS at ht /ttpt/ggttut/tt//// com wwt.m//mcccooottooooooooooo.ottt /MrSS
INTRODUCTION
The primary aim of generative models is to simulate realistic effects of various actions across differ- ent contexts, such as text generation (Achiam et al. (023) and visual effects (Brooks et al. 2024)
Real-world simulators enable human interaction with diverse scenes and objects (Mialon et al. 2023). allow robots to learn from simulated experiences without physical risk (Du al. 2023)
and generate vast amounts of realistic data for training other machine intelligence (Li ct al.
2023
While research on real-world simulators is extensive (Zhu al. 2024 Yang et al. plication of generative models for virtual world simulation remains under-explored. The financial market exemplifies such a virtual world where each action, from trade execution strategy deploy- ment, can have ripple effects across complex network of market participants. The ability to model and predict these effects in real time is crucial for traders, analysts, and regulators alike. Yet, cur- rent market simulation models largely focused on statistical or agent-based approaches lack the resolution, interactivity, and realism needed to reflect the full complexity of order-level behaviors.
2024). the ap-
To address these gaps, it is crucial to integrate the vast amounts of structured financial data, such as Limit Order Book (LOB) (Gould et al.) 2013), that are essential for capturing market microstruc- tures. We therefore propose the Large Market Model (LMM), generative foundation model specif- ically designed for order-level financial market simulation. LMM builds on the successes of genera- tive models in other domains but uniquely adapts them to the financial context, where the generation of orders, order batches, and LOBs plays a critical role in understanding market dynamics. By leveraging structured market data, LMM scales effectively with increasing data and model size, as we will demonstrate through scaling law evaluation, revealing its potential for handling large-scale
"Equal Contribution Corresponding Author

---

Published as a conference paper at ICLR 2025
financial markets. LMM's design ensures that it can generate high-resolution market simulations, capturing both fine-grained individual order actions and broader market trends.
Powered by LMM, introduce MarS, financial Market Simulation engine, unlocking po- tential in financial market forecasting, risk detection, strategy analysis. MarS is designed to ensure realism, producing simulated market trajectories that robust enough for practical financial tasks such as predictive modeling, risk management, and agent training. is capable of providing con- trolled generation, blending users' interactively injected orders into the generation of realistic market behaviors, assessing the market impact of these actions. This feature ensures that MarS delivers not only high-fidelity simulations but also controllable environments where financial strategies can be safely tested and evaluated.
Among the broad adoption of AI techniques in finance Zhang et al.) 2024 Liu et al.) 2023b; Kim et al., 2019; Hou et al. 2021), MarS is the first to fully leverage the core elements of financial markets, making a powerful tool for wide range of downstream applications. We posit that MarS has the potential to bring paradigm shifts to a wide range of tasks related to the financial market. In this work, we demonstrate its transformative potential in four specific use cases:
1. Forecast Tool:
MarS generates subsequent orders based recent orders and LOB, sim- ulating future market trajectories. This enables precise forecasting by analyzing multiple simulated trajectories.
2. Detection System:
By generating multiple future market trajectories, MarS identifies po- tential risks not apparent from current observations. For example, a sudden drop in trajec- tory variance could indicate impending significant event, providing early warnings and enhancing risk management.
3. Analysis Platform: MarS answers a wide range of "what if" questions by providing a re- alistic simulation environment. For instance, it evaluates the market impact of large orders by comparing existing market impact formulas to simulated results, identifying potential improvements and gaining deeper insights into market dynamics.
4. Agent Training Environment:
The realistic and responsive nature of MarS makes it ideal for training reinforcement learning agents. This is demonstrated with an order execution scenario, showcasing MarS's 'ss potential for developing and refining trading strategies with- out real-world financial risks.
The main contributions of this paper are as follows:
We introduce the Large Market Model (LMM), generative foundation model designed specifically for financial market simulations, and demonstrate its scalability across data size and model complexity. This establishes new direction for domain-specific foundation models in finance.
We develop MarS, a high-fidelity financial market simulation engine powered by LMM, capable of generating realistic market scenarios and modeling the intricate impacts of order- level dynamics. This unlocks new possibilities for applying generative models in financial markets.
We demonstrate the versatility of MarS through four key downstream applications: precise market forecasting, risk detection, market impact analysis, and agent training for trading strategies. These applications highlight the significant potential of MarS for transforming financial industry practices.
MARS DESIGN
To create truly realistic simulation system, MarS must excel in three key dimensions: high- resolution, controllability, and interactivity.
High-resolution refers to the ability of MarS to faithfully replicate the intricate dynamics of financial markets. This is why we leverage trading orders and order batches as the foundational elements of the simulation system, since they encapsulate the investment behaviors of market participants. These fine- ane-grained data points are essential for accurately reproducing historical market trajectories, ensuring that the simulation reflects real market conditions and behaviors with precision.
2

---

Published as a conference paper at ICLR 2025
Mars
Generated Order Representing Market Participants
Simulated Clearing House
User Injected Orders
Current Market Envrronmen Data
Vague Description
Target Scenado
Training
Z
Order-level
Larga
Simulated Trajectorie
Companent
Applications
Prompt
Control
Interface
Ordar batch Model
O
Interact
i1
Ensemble Model
Analysis
Figure I: High-Levvel Overview of MarS. MarS is powered by generative foundation model (LMM) trained on order-level historical financial market data. During real-time simulation, L.MM dynam- ically generates order series in response to various conditions, including user-injected interactive orders, vague target scenario descriptions, and current/recent market data. These generated order se- ries, combined with user interactive orders, are matched in a simulated clearing house in real-time, producing fine-grained simulated market trajectories. The flexibility of LMM's order generation enables MarS support various downstream applications, such as forecasting, detection systems, analysis platforms, and agent training environments.
Controllability offers users the flexibility to simulate a wide range of market scenarios and circum- stances. Under the scenarios of assessing market trends, monitoring potential risks, optimizing trading strategies, MarS provides the tools needed to explore any possible market condition. This capability particularly valuable for stress testing and strategy optimization, where diverse and even rare extreme cases must be modeled accurately.
Interactivity is crucial for enabling real-time user interaction with the simulated market. By allowing users to inject their own orders into the system, it enable them to evaluate market impacts, includ- ing both first-order and second-order effects. This feature vital for analyzing trading strategies, managing systemic risks, and developing regulatory policies in controlled, risk-free environment.
2.1 LARGE MARKET MODEL FOR FINANCIAL MARKET SIMULATION
Problem Formulation. To address the need for high-resolution, controllable, and interactive simu- lations, we propose the Large Market Model (LMM), a generative foundation model specifically de- signed for order-level financial market simulation. The problem is formulated eration task, where the generation of trading orders is conditioned on historical data, user-injected orders, and market matching rules. LMM incorporates key features of the market microstructure such as Limit Order Books (LOB), enabling it to capture both individual trading behaviors and systemic market dynamics.
conditional gen-
Tokenization of Order and Order-Batch. LMM models the generation of trading orders as conditional generation process, leveraging sequential modeling techniques predict the evolution of market states over time. This is achieved through novel representation learning approach tai- lored for the financial industry's structured data, particularly the order flows two distinct scales: individual orders and aggregated order-batches. The Order Model, using causal transformer, to- kenizes historical order sequences and Limit Order Book (LOOB information to ensure the realistic generation of individual trading orders. The tokenization procedure for the ith order as follows:
Emb: emb(order:) linear proj (p0ppll emb( [T. emb(T.0 [...., price).
3

---

Published as a conference paper at ICLR 2025
where order, denotes index indicating its position in the tuple (type, price, volume, interval), with type being one of ["Ask", "Bid", "Cancel"], LO LOB represents the 10-level volumes for asks and bids in the LOB, and LOB is the mid-price of the LOB, expressed as the number of price tick changes since market opening.
In parallel, the Order-Batch Model converts the order batches into image-like format, and em- ploys VQ-VAE to represent and generate aggregated trading behaviors over discrete time intervals. In practice, convert order-batch into RGB image format. We refer to such images as "order images", demonstrated in Fig.
Order Batch
Bid
Ask
Cancel
Volume Stot
ID Type Price Volume
Type Piice
Type Price Volume
Mid
Volume
Min
minute,
Price Stot
Price
Price Slot
Figure 2: The order image converter transforms order data into a visual representation. Each order has three attributes: type (Bid, Ask, Cancel), price slot (relative the mid-price), and volume slot (binned volume). 'he pixel values in the image represent the number of orders with the same attributes, with higher pixel values indicating more orders. More details can be found in C.3
These components combine in ensemble framework, where LMM uses auto-regressive mod- eling to build a foundational generative model. This framework integrates micro-level behaviors with macro-level market trends. LMM captures complex dependencies within historical data and temporal patterns through nigh-dimensional embeddings, providing robust market dynamics repre- sentation. For further details on the tokenization strategy and the architectural design of Order and Order-Batee Models, we refer the reader to Appendix and
2.1.1 CONDITIONAL TRADING ORDER GENERATION
In LMM, the generation of trading orders is modeled as a conditional generation process that adapts to real-time market dynamics. An order clip is sequence of trading orders (Zo..... In), generated based on the following four key conditions: DES TEXT: A general description of the desired market scenario (e.g.. "price bump" or "volatility crush"), ensuring controllability. Inter- active Orders: (#4+1..... .i+t) user-injected orders after the i-th generated order. If O, there are no interactive orders between 2; and 1;+1- Starting Sequence:
Im-1) are the initial orders, often using recent real orders to forecast subsequent ones, enabling realistic simu- lations. MTCH R: Matching rules for trading orders, defining the feasible space for each order and reflecting the specific financial market's characteristics.
The conditional generation process: p(za45+1l (DES TEXT, (i;-1..... #(ts), (Zo..... Fmm. MTCH R}) ensures that generated orders are realistic and aligned with both the user-defined scenario and the underlying market structure. They can be adjusted for various MarS scenarios, with different applications showcased in Sec. [ We provide summary of the input conditions and configurations for various applications, along with the detailed introduction of MTCH_ and TEXT in Appendix
2.1.2 FRAMEWORK DESIGN OF LARGE MARKET MODEL
The LMM integrates two complementary approaches: Order Sequence Modeling and Order-Batch Sequence Modeling, combined into an ensemble model to address financial market complexities. Order Sequence Modeling. We use a causal transformer to encode each order and its preceding Limit Order Book (LOB) information as single token. This method captures the sequential nature of orders, ensuring realistic order sequences that reflect market dynamics. Order-Batch Sequence Modeling. To model structured patterns of dynamic market behavior over time intervals, apply an regr-regressive transformer to order-batch sequences. Orders within a time step are grouped into batches, converted into a structured representation of market behavior for this time step, and modeled to maintain coherence and continuity. Ensemble Model. Combining order sequence and order- batch modeling, the ensemble model balances fine-grained control of individual orders with broader
4

---

Published as a conference paper at ICLR 2025
market dynamics. This integration ensures detailed and contextually accurate market simulations. Fine-grained Signal Generation Interface. We introduce an interface that maps vague descriptions to fine- -eeeegeaded control signals using LLM-basee historical market record retrieval. This guides the ensemble model, ensuring simulations follow realistic market patterns and user-defined scenarios.
The bottom-left of Fig. shows the framework of the Large Market Model. The detailed design of its four parts can be found in Appendix
2.1.3 SCALING LAW IN LARGE MARKET MODEL
LMM's scalability is key perspective assess its effectiveness in handling increasingly large-scale financial markets. our four-part foundation model design, we employ an auto-regressive trans- former for order-batch sequences and causal transformer for order sequences. These components utilize standard pre-train pre-training techniques commonly applied foundation models, including those used in language modeling (Kaplan et al. 2020) and vision modeling (Zhai al., 2022).
To assess the scalability of the LMM, we evaluated its performance across varying data scales and model sizes. The scaling curves are shown in Fig. B Our findings indicate that the size of the data and the model increases, LMM's performance improves significantly, consistent with the scaling laws observed in other foundation models. This suggests that the potential of LMM be further unlocked by leveraging larger datasets and more extensive computational resources.
While the current implementation only taps into a fraction of the available order-level financial market data due to resource constraints, the vast amount of data accessible within financial markets holds tremendous promise for future enhancements. MarS, in this context, serves as the tool to unearth this "gold mine" of data, indicating substantial opportunities for more comprehensive and powerful market simulations.
Nozu
5.25
valitation
Validction
4.75
Made
137
130M
300N
10a
19th
10a
10
Number Training
Number Training Tokens
(a) Order Model
(b) Dyrder-Batch Model
Figure 3:
Scaling curves of Order Model Order-Bate Batch Model. (a) Order Model: Trained on billion
tokens, with model sizes ranging from 2 million to 1.02 billion parameters. (b) Drder-Batch Model: Trained on 10 billion tokens, with model sizes ranging from 150 million 3 billion parameters. The results demonstrate enhanced performance with increased data and model sizes.
2.2 MARS - ORDER GENERATION COMBINED WITH SIMULATED CLEARING HOUSE
Powered by LMM, the MarS engine is designed generate highly realistic market trajectories that are robust enough for practical financial tasks such as predictive modeling, risk management, and agent training.
At the core of MarS is the simulated clearing house, which matches both generated and interactive orders in real-time, providing extensive information (e.g., LOB) for subsequent order generation. For each generated order z4, the clearing house processes it against any j interactive orders (j 2 0) injected by the user. The results of this matching process, including the recent LOB, are then used to generate the next order Z4+j-1. creating a continuous and dynamic simulation.
MarS excels at providing controlled generation, blending users' interactively injected orders into the generation of realistic market behaviors. Users can inject their own orders into the system and observe how these actions impact market dynamics in real-time. This capability allows users to simulate various trading strategies, assess market impacts, and evaluate the performance of their strategics under different conditions. The blending process is carefully managed in MarS by adher- ing two guiding principles.
5

---

Published as a conference paper at ICLR 2025
"Shaping the Future Based Realized Realities." At each time step, the arder-batch model generates the next order-batch based on recent orders and corresponding matching results from the simulated clearing house. These information conclude the immediate mar- ket impact of users' injected orders and determines the generated market behaviors in the next order-batch.
"Electing the Best from Every Possible Future." Multiple predicted order-batches are generated at each time step and the best match to the fine- fine-grained control signal is selected, ensuring the simulation remains realistic while allowing for user control.
The order-level transformer, trained on historical orders, naturally learns immediate market impact for subsequent order generation. Concurrently, the ensemble model influences order generation, aligning with the generated next order-batch. Fig. 4 illustrates the generation process, balancing injected orders' market impact and control signals to form a realistic simulation.
Existing Orders
Generated Orders including User Submitted Orders
MarS Generation
Including User Submitted Orders
minute,
minuto,.
Order Model
E
Order Batch Model
Logits
Predicted
Werih
Channels
Filter
Condition
Ensemble Model
Refined Logits
minute,,.
Control
Signalls
Refined Logits
Figure 4: The process of MarS generation employs two-level order generation mechanism. At the order-batch level, following the two guiding principles in Sec. Sec. the Order-Batch Model processes existing orders from minute; and generates N possible distributions for minute:+1- Through filter process based on control signals, the target distribution (*) is selected and serves as a condition for the Ensemble Model (E), At the order level. the Order Model (O) generates immediate responses for recent and user-submitted orders, while the Ensemble Model refines these generations conditioned on the target distribution. The generated orders in minute++1 are fed back the Order-Batch Model (OB) for minute:42 prediction, creating dynamic feedback loop that balances market impact and controlled generation.
EXPERIMENTS
This section evaluates the capabilities of MarS in providing realistic, interactive, and controllable simulations. Note that throughout our experiments, the term "replay" refers replaying real his- torical market data within MarS to validate the simulation against real-world events.
3.1 REALISTIC SIMULATIONS
To assess the realism of MarS's s market simulations, we compare simulated data against key stylized facts derived from historical market data (Sherkar & Sen 2023). These stylized facts serve robust benchmarks, ensuring market simulations accurately reflect real-world market behaviors [Vyetrenko) al.) 2020 Coletta et al. 2022 Stillman al. 2023). Fig. 5 presents several prevalent stylized facts. MarS successfully replicates these stylized facts, demonstrating its capability to produce highly realistic market simulations suitable for practical applications. Besides these three stylized facts, we provide a detailed evaluation other eleven stylized facts Appendix[Jand a quantitative analysis in Appendix

---

Published as a conference paper at ICLR 2025
Log Simulation
Auto-Carrelation Log Return
Aute-Correlation Velabilty
Source Min
Auto Correlation
0.3
Replay Simulation
Auto- Mit-Coorelation
Replay
Probability
Min
Simulation
0.20
0.1
0.15
0.10
-0.004-0.002 0.000
0.004
Log Return
Lag (Minutes)
Lag (Minutes)
(a) Aggregational Gaussianity
(b) Absence Autocorrelations
(c) Volatility Clustering
Figure 5: Illustration of Stylized Facts in MarS. (a) Aggregational Gaussianity: as the interval increases from 1 to minutes, the distribution of log returns becomes more similar to normal distribution.
(h) Absence of
Autocorrlations: the auto-correlation of log returns rapidly decreases with increasing intervals. (c) Volatility
Clustering: high volatility auto-correlation observed over periods.
3.2 INTERACTIVE SIMULATIONS
Understanding market impacts, i.e., changes in financial markets caused by trading activity, is cru- cial. MarS simulates these impacts by generating orders from detailed order-level data. Fig. 66 illustrates MarS interacting with trading agent executing TWAP (Time-Weighted Average Price) strategy, which caused observable changes in the subsequent price trajectory. The gap between the two curves represents the synthetic market impact generated by the agents trading actions. A detailed exploration of market impact can be found in Sec 4.3
We validated these simulations by collecting market impacts from agents with various configura- tions, confirming that the synthetic data adheres to the Square-Root-Lan as depicted in Fig. 6bb The Square-RottLLaw A
Q/V is widely used model for market impact (Moro et al. 2009
Lillo et al. 2003 Almgren et al. 2005), where is the price change, a volatility, Q is trading volume, and V is the total market volume. These results illustrate that MarS effectively model the impact of trading strategies on market prices, providing valuable insights for market par- ticipants and aiding in the development of more robust trading strategies. Additional details and results about the TWAP agent and market impact can be found in Appendix and
Duy
0.010
Mid Peice
Cancol
Marketlmand
15-P0.9
PO.5
0.006
44.6
0.002
0.23
0.47
who
09:35
09:40
09:45
09:50
09:55
10:00
0.00000.00050.000
0tt.0000000.00100000000.00
Synthetic market interaction
(b) Cquare-RRot-Lie Validation
(c) Effects control signals
Figure 6: Results interactive and controllable simulations in MarS.
3.3 CONTROLLABLE SIMULATIONS
We demonstrate the controllability of MarS by replicating historical events. Specifically, MarS allows two types of control signals: (replay curve, prompt]. For control with replay curve, we simulate a price change between 0.3% and 0.5% over 5 minutes. With control enabled, an order batch is generated using minute-level guiding signals from the replay curve, integrated with the order model within an ensemble model produce trading orders. Fig. 6c depicts the correlation between simulated and replay price trajectories. The introduction of control signals significantly enhances the correlation scores (0.23 >> 0.47), showcasing MarS's effectiveness in generating controllable market simulations. Fig. 6c shows the balance between control and interaction. Configurations with control but no interaction achieve the highest correlation scores, while introducing interaction reduces control precision (0.47 0.33). This inherent balance allows for more realistic interactions in diverse applications. For control with prompt, MarS allows users to use natural language to describe specific historical scenarios, then utilizes Large Language Models(LLMs) generation through the fine-grained signal generation interface. The detailed results are provided in Appendix E
guide the

---

Published as a conference paper at ICLR 2025
4 APPLICATIONS
In 2 and [ we demonstrated the formulation of diverse financial tasks as a conditional trad- ing order generation problem. Our experiments showed that MarS is Realistic, Controllable, and Interactive, establishing as a robust financial market simulator. This section explores potential downstream applications of MarS, further validating its foundational role in financial market sim- ulation. We present practical financial tasks to illustrate: a) MarS's capability to solve financial problems independently, and b) its utility simulation platform for other tasks. For a), we show- case Forecast and Detection tasks, and for b), we provide examples of "What if" Analysis, and Reinforcement Learning Environment.
Here, we highlight that, analogous to text generation vs. language modeling (Achiam et al., 2023 Abdin al., 22024] Dubey et al., 2024), and video generation vs. physical world decision making (Liu et al. 2024| Yang et al. 2024]] 2023a), we have constructed a unified task interface through conditional trading order generation for diverse financial downstream tasks with MarS. This inter- face can transfer complex and diverse financial information into specific tasks. We compare current methodologies with the new paradigm introduced by MarS to illustrate the "paradigm shift" across various types of financial tasks, as shown in Table Detailed introductions are provided in the subsequent sections.
Applications
Current Methods
MarS
Forecasting
sequence extrapolation
conditional generation
Detection
Diff (marketnoww markelpast) online experiments, empirical formula finite data, fake P(sc41|$6,0 0z)
Diff (markeenoooo simu-marketnow) offline data-driven pipeline infinite data, real P(s (s,, oz)
"What if" Analysis
RL Environment
Table 1:
Summary of how MarS reshapes mainstream financial applications. Diff(-:) represents the difference between two market states for anomaly detection. P(st+1 [s, az) denotes the state transition given the current state and action. Without an interactive environment, most existing financial RL works cannot model the realistic impact of market state caused by agent actions. Further details of the RL-Environment in S.c4..4
4.1 FORECASTING
Forecasting crucial many financial applications, with market trend forecasting being a prime example. This task demands models that accurately capture and reflect market dynamics. Tradition- ally, direct forecasting models are used. In this section, we assess the effectiveness of our market simulation in predicting trends.
Following Ntakaris et al. (2018), we define the price change from & to + h minute as: = m.) my) /mo, where my is the mid-price at time t, is the number of orders be- tween & and + l minutes, and m; is the mid-price after the ith order event. The price change is categorized into three classesup, down, and flatbased on the value of 1, ensuring similar probabili- ties for each class over the training period. We compare our model with DeepI.OB by IZhang et al.) (2019), well-known baseline. Fig. 7 ilaittusssss that LMM-based simulations significantly outper- form DeepLOB, highlighting its superior market dynamics understanding. Additionally, the 1.02 barlmen- model outperforms the 0.22 billion-pane parammeer model, indicating that improved validation loss in scaling curve (Fig. correlates with enhanced forecasting performance.
is noteworthy that all forecasting targets can be calculated using simulated trajectories from MarS, whereas traditional direct forecasting models require separate training for each target. This under- scores the significant advantage of simulation-ban based forecasting by MarS. For more discussion about the comparison between DeepI.BB and MarS/LMMM, please refer to Appendix [.
4.2 DETECTION
Detecting the changing state of market is crucial in financial tasks, especially in the regulation of market abuse, e.g., insider trading (Meulbroek) 1992) and market manipulation (Putninš) 2012). We demonstrate how MarS could bring a new simulation-basee paradigm to detection tasks by moni- toring the similarity between simulated and real market patterns. Using real market manipulation cases from C we evaluate the similarity of spread distributions through Distribution Similar-
http::/wwet wwwp. .ov
8

---

Published as a conference paper at ICLR 2025
Despi08
Fuff Inntt Rote: 0.353
Predicion Accuracy
0.65
Model (6.228) MedeeMod (3.028)
Price Advantage
0.60
0.55
Funtmment Rate: 0.951
0.50
2000
6000
8000
Number of Minutes
Step
(a) Trend Prediction Accuracy
(b) Performance of the trading agent
Figure 7: Results of forecasting and RL-agent training tasks. For forecasting task, MarS executes 128 simula- tions at each initial time point, and aggregate outcomes to determine the final predicted class. The ground truth is obtained from historical replay. For RL-agent training, the x-axis represents the number of update batches, and the y-axis the price advantage over our best-configured TWAP agent (L.1-P0.9), in basis points (BP).
ity which serves as key indicator of market liquidity. While MarS maintains high distribution similarity (> 0.87) in normal periods, its simulation realism drops significantly during manipulation periods, particularly showing a heavier tail and a peak around 6 = 1000 (Fig. 8). These anomalies can be viewed as signals likely corresponding to market manipulation, where manipulators sig- nificantly impact liquidity. This suggests a promising direction for automated anomaly detection, though comprehensive evaluation combining multiple metries is necessary for robust conclusions. Detailed analysis and experimental settings are provided in Appendix G
Distribution Similarity: 0.870
Distribution Similarity: 0.835
Distribution Similarity. 0.873
0.25
Source
0.20
Source
Source
0.20
Replay
Replay
Replay
Probabiitt
Simulation
Probabiitty
0.15
Simulation on
Probiabiiity
Simulation
0.15
0.10
0.05
0.00
0.00
0.00
250
500
750
1000
500
1000
200
400
600
800
Vallue
Value
(a) Pre Pre-manipulation
(b) Manipulation period
(c) Post-manipulation
Figure 8: Spread distribution in different periods of market manipulation. The distribution similarity hetween replay and simulation drops during the manipulation period (b), where heavier tail and a noticeable peak around 8 = 1000 emerge, in contrast to the pre-manipulation (a) and post-manipulation (c) periods.
4.3 "WHAT IF ANALYSIS ON MARKET IMPACT
One of the most important "What if" topics in finance is to analyze market impact, the change in asset prices caused by trading activity. Due to complex mechanisms, most existing research in this area relies heavily on strong assumptions and empirical formulas (Zarinelli et al. 2015 Almgren jet al. 2005; Gatheral 2010 Gatheral et al. 2012 2011). and is limited to costly and risky online experiments. In this section, take market impact an example, showing how MarS can act as a reliable and powerful platform and contribute to "what if" analysis. As we have validated the reliability of synthetic market impact in S.cB.2, we step to a more ambitious goal: leverage the synthetic data to build data-driven pipeline to discover new laws to explain market impact and its long-term dynamics. Due to the limited space, details of experiment settings, clarification, and more results in this section are provided in Appendix K
influ- encing market impact, we first employed symbolic regression (de Silva et al. 2020), using classic volume and price factors before trading as the base dictionary. By applying genetic algorithms, we sought to identify the most informative factors on synthetic market impact. The preliminary results were reviewed and refined by domain experts, leading to the discovery of three new factors that partially explain market impact: {resiliency, LOB pressure, LOB depth). We show the relationship between market impact and factor resiliency in Fig. 9a
New factors beyond Square-Root-Laws To uncover new factors beyond Square-Roote
The long-term market impact, also known price im- pact trajectory, typically manifests as gradually decaying sequence of price fluctuations after a trade. Traditional research relies on empirical formulas to model this dynamics (Gatheral et al.
Dynamics of Long-TTem Market Impact:

---

Published as a conference paper at ICLR 2025
agent type
L1-P0.1
market impact
L5-PO.1
L1-PO.9
L5 PO.9
3
-3
+0.07
0.02
0.09
167
40.95
mid poke
agent roplay
Agent relbut
LG0 daatn
Los aventure
nestend
(a) New factor: Resiliency
(b) Interaction weights of learned ODE
Figure 9: Analysis new market impact factor and long-term market impact.
2011 Donier et al. 2015a Bacry et al. 2015), but could struggle to capture the full complexity of wealdworld scenarios. To address this, we leverage generated market impact to develop more accu- rate, data-driven approach. Our method models the decay dynamics using an ordinary differential equation (ODE), which integrates both potential influencing factors and decay functions:
(t) sum W o (X & Edeeay (t))) = Σ dt
m
Fudocay
Eddcaa (t)
(2)
where (() is the long-term market impact, X Rm is the factor group, such as volume, price, etc., and pdocay(1) (t): - T includes possible decay functions, e.g., [1/t,-..: 1 1/v X and polceay (t) can be customized based on domain knowledge. & is the outer product, o is the Hadamard product, X pulecay() (t) is a matrix with size -=xm, representing interactions among factors and decay patterns, and W E R=*m is the learnable interaction weight. Fig. [ig.9b/shows the learned weights W, demonstrating the importance interaction pairs of two decay functions and seven factors, which can help to deepen our understanding of the long-term market impact.
4.4 REINFORCEMENT LEARNING ENVIRONMENT
The MarS environment, being both realistic and interactive, is ideal for training reinforcement learn- ing (RL) agents. This environment accurately reflects an agent's impact, provides realistic rewards, and facilitates training robust agents for the financial market. In this experiment, we aim to train trading agent from scratch using MarS. The trading agent's ' goal to purchase large volume within 5 minutes, optimizing both fulfillment rate and price advantage.
The trading agent's state includes features such as remaining time, remaining volume, LOB imbal- ance, and the period's s stage (passive or aggressive). The agent's actions are based on configurable TWAP strategy and the reward function defined as follows:
Reward a FulfillmentRate + PriceAdvantage,
(3)
where when FulfillmentRate 0.95 and decreases to 0 FulfillmentRate approaches 1. Detailed settings of agent training can be found Appendix
Fig. 7b shows the training performance of the trading agent. The agent's performance improves from -6 BP to 2"6 BP during training. The observed fluctuations between 2'6 BP are attributed to the agent exploring various strategies between high and low fulfillment rates, resulting in corresponding variations in price advantage based on the current reward setting. This demonstration highlights that MarS is capable of training trading agents from scratch by leveraging its realistic and interactive simulation capabilities.
RELATED WORK
We give detailed and comprehensive discussion of generative foundation models Appendix
related work on financial market simulation and
6 CONCLUSION
We introduce MarS, an order-level, fine-grained realistic financial market simulation engine, pow- ered by the generative foundation model, LMM. Our evaluation of LMM's scaling law demonstrates the potential for continuous improvement in future financial world models. We identify three essen- tial characteristics of impactful market simulation: realism, controllability, and interactivity. We present four representative tasks developed using MarS, underscoring its potential to catalyze a paradigm shift across various financial applications.
10

---

Published as a conference paper at ICLR 2025
ACKNOWLEDGEMENTS
We would like to thank our colleagues Xiao Yang and Xu Yang for contributing to our early proto- type and their invaluable feedback and suggestions during our regular discussions. We also express our sincere gratitude to Chengqi Dong for his meticulous analysis and exploration on market impact data, which have significantly enhanced our understanding of market impact studies.
DISCLAIMER
Users of the market simulation engine and the code should prepare their own agents which may be included trained models built with users own data, independently assess and test the risks of the model specify use scenario, ensure the responsible use of AI technology, including but limited to developing and integrating risk mitigation measures, and comply with all applicable laws and regulations. The market simulation engine does not provide financial opinions, nor is it designed to replace the role of qualified financial professionals in formulating, assessing, and approving finance products. The outputs of the market simulation engine do not reflect the opinions of Microsoft.

---

Published as a conference paper at ICLR 2025
REFERENCES
Marah Abdin, Sam Ade Jacobs, Ammar Ahmad Awan, Jyoti Aneja, Ahmed Awadallah, Hany Awadalla, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Harkirat Behl, et al. Phi-3 technical re- port: A highly capable language model locally on your phone. arXiv preprint arXiv:2404. 14219, 2024.
Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, lige Akkaya, Florencia Leoni Ale- man, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, al. Gpt-4 technical report. arXiv preprint arXiv: 08774, 2023.
John Sffleck-Gravee Carolyn M Callahan, and Ramachandran Ramanan. Detecting abnormal bid- ask spread: a comparison of event study methods. Review of Quantitative Finance and Account- ing, 14:45-65, 65, 2000.
Robert Almgren, Chee Thum, Emmanuel Hauptmann, and Hong Li. Direct estimation of equity market impact. risk, 2005.
Selim Amrouni, Aymeric Moulin, Jared Vann, Svitlana Vyetrenko, Tucker Balch, and Manuela Veloso. Abides-gym gym environments for multi-agent discrete event simulation and applica- tion to financial markets. In Proceedings of the Second ACM International Conference on Al in Finance, pp. 1-9, 2021.
Emmanuel Bacry, Adrian luga, Matthieu Lasnier, and Charles-Albert Lehalle. Market impacts and the life cycle of investors orders, 2014.
Emmanuel Bacry, Adrian luga, Matthieu Lasnier, and Charles-Albert Lehalle. Market impacts and the life cycle of investors orders. Market Microstructure and Liquidity, 1500000 2015.
Yutong Bai, Xinyang Geng, Karttikeya Mangalam, Amir Bar, Alan L Yuille, Trevor Darrell, Jitendra Malik, and Alexei Efros. Sequential modeling enables scalable learning for large vision models. In P Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp- 22861 -22722, 2024.
Gagan Bhatia, El Moatez Billah Nagoudi, Hasan Cavusoglu, and Muhammad Abdul-Mageed. Fintral: A family of gpt-4 level multimodal financial large language models. arXiv preprint arXiv:2402.10986 2024.
Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportu- nities and risks of foundation models. arXiv preprint arXiv:2 072588 2021.
Tim Brooks, Bill Peebles, Connor Holmes, Will DePue, Yufei Guo, Li Jing, David Schnurr, Joe Taylor, Troy Luhman, Eric Luhman, Clarence Ng. Ricky Wang, and Aditya Ramesh. Video generation models as world simulators. 2024. URL (tttpt::: http:///ppaaaaa///m//am /ttp::tts//pp/ video -ireeo-eerraiionn moserattiiommmmelsssss
wor ld simulators
Tom B Brown. Language models are few-shot learners. arXiv preprint arXiv:2005.14165 2020.
David Byrd, Maria Hybinette. and Tucker Hybinette Balch. Abides: Towards high-fidelity multi- agent market simulation. In Proceedings of the 2020 ACM SIGSIM Conference on Principles of Advanced Discrete Simulation, pp. 11-22, 2020.
Ricky T. Q. Chen. torchdi ffeq!
torchdiffeq. 2018.
URI httpp:://github.comm//tt cher
Carl Chiarella, Giulia lori, and Josep Perelló. The impact of heterogeneous trading rules on the limit order book and order flows. Journal of Economic Dynamics and Control, 33(3):525-537, 2009.
Andrea Coletta, Matteo Prata, Michele Conti, Emanuele Mercanti, Novella Bartolini, Aymeric Moulin, Svitlana Vyetrenko, and Tucker Balch. Towards realistic market simulations: a genera- tive adversarial networks approach. In Proceedings of the Second ACM International Conference Al in Finance, pp. 1-9, 2021.
12

---

Published as a conference paper at ICLR 2025
Andrea Coletta, Aymeric Moulin, Svitlana Vyetrenko, and Tucker Balch. Learning to simulate realistic limit order book markets from data as a world agent. In Proceedings of the third acm international conference ai in finance, pp. 428-436, 2022.
Andrea Coletta, Joseph Jerome, Rahul Savani, and Svitlana Vyetrenko. Conditional generators for limit order book environments: Explainability, challenges, and robustness. In Proceedings of the Fourth ACM International Conference Al in Finance, pp. 27-35, 2023.
Rama Cont. Empirical properties of asset returns: stylized facts and statistical issues. Quantitative finance, 1(2):223, 2001.
Gianbiagio Curato, Jim Gatheral, and Fabrizio Lillo. Optimal execution with non-linear transient market impact. Quantitative Finance, 17(1):41-54, 2017.
Brian M de Silva, Kathleen Champion, Markus Quade, Jean- chu-Chiistoope Loiseau, J Nathan Kutz, and Steven I. Brunton. Pysindy: python package for the sparse identification of nonlinear dynamics from data. arXiv preprint arXiv:2004.080 08424, 2020.
Jonathan Donier, Julius Bonart, lacopo Mastromatteo, and J-P Bouchaud. A fully consistent, mini- mal model for non-linear market impact. Quantitative finance, 15(7):1 109-1121, 2015a.
Jonathan Donier, Julius Bonart, Iacopo Mastromatteo, and Jean-Philipper Bouchaud. A fully consis- tent, minimal model for non-linear market impact, 2015b. URL
abs/
1412.014:
Yilun Du, Sherry Yang. Bo Dai, Hanjun Dai, Ofir Nachum, Josh Tenenbaum, Dale Schuur- mans, and Pieter Abbeel. Learning universal policies via text-guided video generation. In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine (eds.), Advances in Neural Information Processing Systems, volume 36, pp. 9156-9172. Curran Associates, Inc., 2023. URL http:///.......1.00.0002220220.0
wwtp:://in...uuuu........eeeeeae cappaper httpreeeerilleeeeeeeeeeee
File/
.dff
Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang. Angela Fan, al. The llama 3 herd of models. arXiv preprint arXiv:2407.21788, 2024.
Patrick Esser, Robin Rombach, and Bjom Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recogni- fion, pp. 12873-1222 12883, 2021.
Jim Gatheral. No-dynamic-
and market impact. ilaatittativeiinnnee 10(7):749-759, 2010..
Jim Gatheral, Alexander Schied, and Alla Slynko. Exponential resilience and decay of market impact. Econophysics of Order-driven Markets: Proceedingy of Eccnophyy-Kolkata V, pp. 225- 236, 2011.
Jim Gatheral, Alexander Schied, and Alla Slynko. Transient linear price impact and fredholm inte- gral equations. Mathematical Finance: An International Journal of Mathematics, Statistics and Financial Economics, 22(3):445 474, 2012.
Ian Goodfellow, Jean Pouget-Abadie, Mchdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, 63(11):139-1 144, 2020.
Martin Gould, Mason A Porter, Stacy Williams, Mark MeDonald, Daniel J Fenn, and Sam Howison. Limit order books. Quantitative Finance, 13(11):1009-1742, 2013.
Min Hou, Chang Xu, Yang Liu, Weiqing Liu, Jiang Bian, Le Wu, Zhi Li, Enhong Chen, and Tie- Yan Liu. Stock trend prediction with multi multi- tranularratt data: A contrastive learning approach with adaptive fusion. In Proceedings of the 30th ACM International Conference Information & Knowledge Management, pp. 700-709, 2021.
Quzhe Huang. Mingxu Tao, Chen Zhang, Zhenwei An, Cong Jiang, Zhibin Chen, Zirui Wu, and Yansong Feng. Lawyer llama technical report. arXiv preprint arXiv:2305. /5062, 2023.
13

---

Published as a conference paper at ICLR 2025
Hanna Hultin, Henrik Hult, Alexandre Proutiere, Samuel Samama, and Ala Tarighati. A generative model of a limit order book using recurrent neural networks. Quantitative Finance, 23(6):931- 958. 2023.
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.0836/ 2020.
Rachyun Kim, Chan Ho So, Minbyul Jeong, Sanghoon Lee, Jinkyu Kim, and Jaewoo Kang. Hats: hierarchical graph attention network for stock movement prediction. arXiv preprint arXiv: /908. 07999, 2019.
Junyi Li, Xintong Wang, Yaoyang Lin, Arunesh Sinha, and Michael Wellman. Generating realistic stock market order streams. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 727-734, 2020. 2020.
Zhuoyan Li, Hangxiao Zhu, Zhuoran Lu, and Ming Yin. Synthetic data generation with large lan- guage models for text classification: Potential and limitations. arXiv preprint arXiv:2310007849, 2023.
Fabrizio Lillo, J. Doyne Farmer, and Rosario N. Mantegna. Master curve for price-impact function. Nature, 421 (6919))1122 2003. doi: 10.1038/4 129a. URL htt.:::tt///t.... httt::::/ddoi.roge
Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lec. Visual instruction tuning, 2023a.
Xiao- Xiao-Yang Liu, Guoxuan Wang, Hongyang Yang, and Daochen Zha. Fingpt: Democratizing internet-scale data for financial large language models. arXiv preprint 2077v:230..10485, 2023b.
Yixin Liu, Kai Zhang, Yuan Li, Zhiling Yan, Chujie Gao, Ruoxi Chen, Zhengqing Yuan, Yue Huang, Hanchi Sun, Jianfeng Gao, al. Sora: A review on background, technology, limitations, and opportunitics of large vision models. arXiv preprint arXi:24402.11177, 2024.
I Loshchilov. Decoupled weight decay regularization, arXiv preprint 1711:v1711..500000 2017.
Lisa K Meulbroek. An empirical analysis of illegal insider trading. The Journal of Finance, 47(5): 1661-1699, 1992.
Grégoire Mialon, Roberto Dessi, Maria Lomeli, Christoforos Nalmpantis, Ram Pasunuru, Roberta Raileanu, Baptiste Rozière, Timo Schick, Jane Dwivedi- Yu, Asli Celikyilmaz, et al. Augmented language models: a survey. arXiv preprint arXiv:2302.0r 07842, 2023.
Michael Moor, Oishi Banerjee. Zahra Shakeri Hossein Abad, Harlan M Krumholz, Jure Leskovec, Eric Topol, and Pranav Rajpurkar. Foundation models for generalist medical artificial intelli- gence. Nature, 216(7956):259222 265, 2023.
Esteban Moro, Javier Vicente, Luis Moyano, Austin Gerig, J. Doyne Farmer, Gabriella Vaglica, Fabrizio Lillo, and Rosario N. Mantegna. Market impact and trading profile of hidden orders in stock markets. Physical Review 80(6), December 2009. ISSN 1550-2376. doi: 10.1 thyyseeve80.006102
htllhttp://// //tp:///xx doi org. 110./ 11w11////////......1 80 066102
Ulrich A. Miler, Michel M. Dacorogna, Rakhal D. Dav, Richard Olsen, Olivier V. Pictet, and Jacob E. von Weizscker. Volatilities of different time resolutions analyzing the dynamics of mar- ket components. Journal of Empirical Finance, 4(2):213-239, 1997. ISSN 0927-5398. doi:
URL https: ://w::/wwww... wwwencedirreccee
http://ccoooooaarar.eeea/a////s2 Part 1.
High Frequency Data in Finance,
Peer Nagy, Sascha Frey, Silvia Sapora, Kang Li, Anisoara Calinescu, Stefan Zohren, and Jakob Foerster. Generative ai for end-to-end limit order book modelling: A token-level autoregressive generative model of message flow using deep state space network. In Proceedings of the Fourth ACM International Conference on Al in Finance, pp. 91-99, 2023.
14

---

Published as a conference paper at ICLR 2025
Adamantios Ntakaris, Martin Magris, Juho Kanniainen, Moncef Gabbouj, and Alexandros losi- fidis. Benchmark dataset for midprice forecasting of limit order book data with machine learn- ing methods. Journal of Forecasting, 37(8):852866, August 2018. ISSN 1099-131X. doi:
10. 10.10 URL CRRLhhtp:///de doi www.://oooooorooooooooooo wt...o/.///.0...0............ 1002/for. 2543
Talis J Putninš. Market manipulation: A survey. Journal of economic surveys, 26(5):952-967, 2012.
Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. Zero: Memory optimizations toward training trillion parameter models. In SC20: International Conference for High Perfor- mance Computing, Networking, Storage and Analysis, pp. 1-16. IEEE, 2020.
Syama Sundar Rangapuram, Matthias W Seeger, Jan Gasthaus, Lorenzo Stella, Yuyang Wang, and Tim Januschowski. Deep state space models for time series forecasting. Advances neural information processing systems, 31, 2018.
Ethan Ratliff-Cran Colin M. Van Oort, James Bagrow, Matthew T. K. Koehler, and Brian F. Tivnan. Revisiting stylized facts for modern stock markets. 2023 IEFE International Conference on Big Data (BigData), pp. 1814-1823, 2023, doi: 10.1 10L11000BBBD0055544222233..000
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjm Ommer. High- resolution image synthesis with latent diffusion models, 2021.
Robin Rombach, Andreas Blattmann, Dominík Lorenz, Patrick Esser, and Bjöm Ommer. High- resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF confer- ence on computer vision and pattern recogmition, pp. 10684-10695, 2022.
Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarezyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.0211 2021.
Vaibhav Sherkar and Rituparna Sen. Study of stylized facts in stock market data, 2023. URL
https://arxils wttpiiivrrrg/eo wttgg//b//aae at/////ss//20 00753
Namid Stillman, Rory Baggott, Justin Lyon, Jianfei Zhang, Dingqiu Zhu, Tao Chen, and Perukr- ishnen Vytelingum. Deep calibration of market simulations using neural density estimators and embedding networks, 2023. URL https:://rxxiiiii www.vvosr/bbbb... httg///bb///.a...e///
Richard S. Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, second edition, 2018
Shuntaro Takahashi, Yu Chen, and Kumiko Tanaka-Ishi. Modeling financial time-series with gen- erative adversarial networks. Physica A: Statistical Mechanics and its Applications, 527:121261, 2019a. ISSN 0378-4371. doi: httpee/cw....eeeeeeeeeeeeaaaeaaa 9337797777777111777777777
URL https:
www. www.sciencedii rect www.cccccccc......
Shuntaro Takahashi, Yu Chen, and Kumiko Tanaka-Ishii. Modeling financial time-series with gen- erative adversarial networks, Physica A: Statistical Mechanics and its Applications, 527:121261,
2019b.
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaci, Niko- lay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open founda- tion and fine-tuned chat models. arXiv preprint arXiv:2307.09288 2023.
Svitlana Vyetrenko, David Byrd, Nick Petosa, Mahmoud Mahfouz, Danial Dervovic, Manuela Veloso, and Tucker Balch. Get real: Realism metries for robust limit order book market sim- ulations. In Proceedings of the First ACM International Conference Al in Finance, pp. 1-8, 2020.
Pedram Babaci William Todt, Ramtin Babaci. Fin-llama: Efficient finetuning of quantized 1lms for finance. https: /tt:::/ggtthte com/ Btt///avtttttta ffneessttiiiiiie 1lmma 2023.
Shijie Wu. Ozan Irsoy, Steven Lu, Vadim Dabravolski, Mark Dredze, Sebastian Gehrmann, Prab- hanjan Kambadur, David Rosenberg, and Gideon Mann. Bloomberggpt: A large language model for finance. arXiv preprint 230. 2023.
15

---

Published as a conference paper at ICLR 2025
Qianqian Xie, Weiguang Han, Xiao Zhang, Yanzhao Lai, Min Peng, Alejandro Lopez-Lira, and Jimin Huang. Pixiu: A comprehensive benchmark. instruction dataset and large language model for finance. Advances in Neural Information Processing Systems, 36, 2024a.
Qianqian Xie, Dong Li, Mengxi Xiao, Zihao Jiang, Ruoyu Xiang, Xiao Zhang, Zhengyu Chen, Yueru He, Weiguang Han, Yuzhe Yang, et al. Open-finllms: Open multimodal large language models for financial applications. arXiv preprint arXiv:2408.11878 2024b.
Mengjiao Yang. Yilun Du, Kamyar Ghasemipour, Jonathan Tompson, Dale Schuurmans, and Pieter Abbeel. Learning interactive real-world simulators. arXiv preprint arXiv:2310.06114, 2023a.
Sherry Yang, Jacob Walker, Jack Parker-Holdes Yilun Du, Jake Bruce, Andre Barreto, Pieter Abbeel, and Dale Schuurmans. Video as the new language for real-world decision making. arXiv preprint ar 4rX1v:2402.17139, 2024.
Yi Yang, Yixuan Tang. and Kar Yan Tam. Investlm: A large language model for investment using financial domain instruction tuning. arXiv preprint arXiv:2309. 13064, 2023b.
Elia Zarinelli, Michele Treccani, J Doyne Farmer, and Fabrizio Lillo. Beyond the square root: Evidence for logarithmic dependence of market impact on size and participation rate. Market Microstructuree and Liquidity, 1(02):155000) 2015.
Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. In Proceedings of the IEEF/CVF conference on computer vision and pattern recognition, pp- 12104-122 12113, 2022.
Boyu Zhang. Hongyang Yang, and Xiao Yang Liu. Instruct-fingn fingpt: Financial sentiment analysis by large language models. arXiv preprint arXiv:2306. (tth:2300.2265555 12659,
instruction tuning of 2023.
Wentao Zhang, Yilei Zhao, Shuo Sun, Jie Ying, Yonggang Xie, Zitao Song, Xinrun Wang, and Bo An. Reinforcement learning with maskable stock representation for portfolio management in customizable stock pools. In Proceedings of the ACM on Web Conference 2024, pp. 187-198, 2024.
Xuanyu Zhang and Qing Yang. Xuanyuan 2.0: A large chinese financial chat model with hundreds of billions parameters. In Proceedings of the 32nd ACM international conference on information and knowledge management, pp. 4435 4439, 2023.
Zihao Zhang, Stefan Zohren, and Stephen Roberts. Deeplob: Deep convolutional neural networks for limit order books. IEEE Transactions Signal Processing, 67(11):30013012, June 2019. ISSN 1941-0476. doi: 10.11099hsp200122207766 URL http:///ddk.da.....10.1001...9
TSP 2019 291199.2902500 7260
Zheng Zhu, Xiaofeng Wang, Wangbo Zhao, Chen Min, Nianchen Deng, Min Dou, Yuqi Wang. Botian Shi, Kai Wang, Chi Zhang, et al. Is sora a world simulator? a comprehensive survey on general world models and beyond, arXiv preprint arXiv:2455.03520 2024.
16

---

Published as a conference paper at ICLR 2025
A RELATED WORKS
Financial Market Simulation. Before the recent surge in generative foundation models, researchers in the finance domain had already recognized the immense potential of powerful market simulations. Early approaches often utilized agent-based modeling, particularly multi-agent systems, to simulate order-driven markets (Chiarella et al., 2009 Byrd et al. 2020; Amrouni al. (02T).
With the advancements in deep learning technologies, several works have emerged that adopt the world model paradigm simulate Limit Order Book (LOO) markets (Takahashi et al. 2019b) Li ett al. 2020 Coletta et al., 2221 2022 2023). These studies primarily leveraged Generative Adver- sarial Networks (GANs) (Goodfellow et al. 2020) to model the distribution of LOB time series.
Recently, some generators have begun incorporating market micro-structure data, such as those presented in (Hultin et al. [203] Nagy et al. (023). Among these, et al. (2023) is most related to our work, particularly regarding the order model. They employ an auto-regressive model based on Deep State Space Network (Rangapuram et al. 2018) to generate LOB and message flows. However, their focus is primarily on LOBB modeling. While they demonstrate some realistic stylized facts of the generated sequences, they do not evaluate the model's capability to address downstream financial tasks.
Our work aims to push the boundaries of financial market simulation by introducing an innovative approach that goes beyond generating realistic order flows. We introduce MarS, a pioneering fi- nancial market simulation engine driven by the Large Market Model (LMM). Designed to meet the specific demands of the financial sector, MarS excels modeling the market impact of orders and achieving high levels of controllability and realism. By framing various financial market tasks as conditional trading order generation problems, we demonstrate MarS's transformative potential and practical applications in real-world financial markets.
Foundation Models. Foundation models are trained on broad datasets and can be adapted to a wide range of downstream tasks. The term was popularized by the Stanford Institute (Bommasani et al.) 202T]. The release of GPT-3 (Brown 2020) showcased the powerful benefits of training large auto- regressive language models (LLMs) extensive corpora (Abdin et al. 2024 Achiam et al. 2023 Dubey et al. 2024).
In addition, numerous foundation models have emerged in the fields of computer vision (CV) and multimodal areas (Rombach et al., 2021 Brooks et al. 2024 Liu et al.) 2023a). Recently, real- world simulators and industry-speciff large models have become popular research topics in this field. Real-world simulators aim to achieve real-world simulation through the unified goal of video generation, addressing various tasks in fields such autonomous driving, robotics, and gaming (Liu et al. 20244 Zhu et al.) 2024): Yang et al., 2024) 2023a). However, they primarily focus on simulating the physical world. The order-driven financial market an exemplary virtual world with different operating principles. To the best of our knowledge, we are the first to build financial world simulator.
Ipdustry- large models primarily focus on fields such as biomedicine (Moor et al. 2023) law (Huang et al. 2023), and finance. In the financial domain, most large models are Financial LLMs, which either pre-train LLMs on financial corpora (Wu et al. [023 /Zhang & Yangl 2023) or fine-
tune them (Xie et al., 2024a| Zhang et al.. 2023 William Todt [0233] Yang et al. 2023b) to tackle financial NLP tasks multimodal tasks (Bhatia et al. 2024 Xie al. 2024b), including sentiment analysis, text classification, and question answering.
Beyond text, there is an even larger and more information-rich corpus in the financial world: trading orders. We propose a Large Market Model (LMM), which, for the first time, reveals the scaling law on trading orders. We take the first step toward building generative foundation model as world model for the financial market. We believe that, with MarS as the shovel, the extensive order-level data undoubtedly represent significant gold mine.
17

---

Published as a conference paper at ICLR 2025
B ORDER SEQUENCE MODELING.
B. INTRODUCTION
The order model for financial markets shares similarities with the Language Model (LM) for text in several respects. Both models strive to predict the subsequent event, whether it be token text corpus or trade order in financial markets. Additionally, the datasets for both are typically extensive, facilitating the training of robust models. Furthermore, data in both domains can be generated autoregressively.
Nevertheless, substantial differences also exist between the two fields. Each order in the financial market is associated with a complex set of market dynamics, including the Limit Order Book (LOB), transactions, and potentially market news in natural language. Consequently, each order may be influenced by a broader array of information beyond the order stream itself. is therefore imperative to encode this rich information compactly while preserving the autoregressive generation paradigm. Moreover, the financial market operates on a rule-based order matching system, which processes orders and generates new states, such transactions and the updated LOB, This necessitates an additional order matching step to obtain accurate market states.
Order Model
Order Match Engine
Jiii
Order Decoder
OLD
OID
OID
Causal Transformer
tk3y2
Order/LOB Tokenizer
Type
Price
9321 12110
rlcck
ticlees
tlck.e
Figure 10: The framework of the order model. The model is trained on the order stream and the cor- responding LOB information. It autoregressive, generating the next order based the preceding order and LOB information. The order matching step is employed to produce the new LOB state.
B.2 APPROACH
B.2.1 TOKENIZATION
The objective tokenization to make it compact and efficient for encoding and decoding while retaining the majority of useful information. To this end, opt to encode each order and its antecedent LOB as a single token. The LOB information functions analogously to an image in a text, offering additional context for the order. The tokenization procedure for the 4th order is as
follows:
Fmm. emb(order;) + linear proj(
PxO Byolumes) emb( emb(LOB3 price)
18

---

Published as a conference paper at ICLR 2025
Here, order; denotes an index indicating its position in the tuple (type, price, volume, interval), with type being one of ["Ask", "Bid", "Cancel"]. Both price and volume are discretized into the range [O, 32), and interval into [0, 16). An index within the range [0, 49152) for the (type, price, volume, interval) tuple. L. L. Byolumes represents the 10-level volumes for asks and bids in the LOB, also discretized into [0, 32). The LOB; price is the mid-price of the LOB, expressed as the number of price tick changes since market opening.
uniquely identify position
This formula computes the embedding for the 1th token, which is composite of the order, the linear projection of the LOB volumes, and the embedding of the LOB mid-price.
While the input token includes LOB information, it is impractical and unnecessary to predict the resultant LOB during the decoding process. Instead, the new LOB information can be derived using standard order matching algorithm, based the preceding LOB and the newly generated order. Given this consideration, we only output the order index and conduct an order matching during simulation to obtain the subsequent accurate LOB state, depicted in Fig. TO
B.3 DATA AND MODEL TRAINING
Our dataset encompasses the top 500 liquidity stocks in the Chinese stock market, covering the period from 2017 to 2023 and comprising 16 billion order tokens. Our model architecture is based on LLaMA2 (Touvron et al. 2023). and Adam optimizer (Loshchilov (017) is employed in all experiments. We utilize fp16 precision with DeepSpeed ZERO stage (Rajbhandari et al. (0200) to optimize memory usage. The sequence length is set 1024, with a batch size of 4096, equating to 4 million tokens per optimization step.
The inclusion LOB information in the tokenization process is compared to determine its impact on training performance. The evidence suggests that integrating the LOB information contributes to an enhanced training curve, as shown in Fig.
7.8
Tokenization Method
Order
Validation Loss
7.6
Order + LOB
7.4
7.2
7.0
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
Number of Training Tokens
1e10
Figure II:
Tokenization of the Order Model. A comparative analysis the tokenization process with and without the Limit Order Book (LOB) information. Incorporating precise LOB information leads to an improved training curve.
Furthermore, we examine the effects of varying data and model sizes on training performance. The data suggest that augmenting both data and model sizes correlates with improved outcomes, as shown in Fig. 3a
C ORDER-BATCH SEQUENCE MODELING
C.I INTRODUCTION
In this section, we introduce the order-batch model. Different from the order model, which focuses on individual orders, the order-batch model concentrates on batches of orders to model structured patterns of dynamic market behavior over time intervals. We innovatively organize batches of orders into an RGB image format, which are then discretized into tokens for autoregressive training, aimed generating order-batch sequences.
19

---

Published as a conference paper at ICLR 2025
Figure 12: The intraday distribution of the average number of orders per minute.
As we know, financial markets are comprised of diverse participants, each with a unique set of information and trading frequency. Even in the domain of nrighffrequency trading, there are nuances: some traders pay close attention to each order, while others may focus on signals in fixed time intervals to guide their trading decisions. Through data analysis, we can easily discern the traces by the latter type of high-frequency traders. We counted the number of orders per minute for each stock our dataset introduced in Sec. [B3 to create a chart shown in Fig, [2] From this chart, we can observe the following patterns: T. The intraday order distribution is U-shaped. 2. There a significant increase in order number at the market open in the morning and after the lunch break. 3. There spikes in order numbers nearly every 10 minutes, suggesting a periodic pattern. With the above observations, we find that the distribution of orders within fixed intervals adheres to consistent patterns, and such patterns these structured patterns of dynamic market behavior.
also be captured by the model. So attempt model
Besides, modeling batches of orders facilitates the generation of specific financial scenarios. If generating a specified market scenario through prompts, there will be significant information asym- metry between the brief text of prompts and the thousands of orders such a signal directly onto each order through an order model is clearly intractable. Therefore, we need an order-batch model act as a bridge between the prompt and the order model to facilitate this transition. The order-batch model corresponds to prompts by first generating minute-level order batches, and then decoding them into an order flow in conjunction with the order model.
order flow. Imposing
C.2 APPROACH
As observed in Fig. 12 orders within fixed time intervals vary in numbers, and these variations are significant at different time throughout the day. light of this, learning representations from the sequences after padding is clearly not a sensible approach. To better represent orders of variable numbers, we creatively convert the orders into an RGB image format. This approach allows us not only "visualize" the changes in orders of the image generation field, transforming the problem of order-batch generation into one of image generation. We present the framework of the order-batch model in Fig. 13
a period of time but also to draw on the experience
C.3 ORDER IMAGE CONVERTER
Learning representations directly from order sequences at fixed time intervals is not an effective and practical approach. On the one hand, stocks with different levels of liquidity have significantly different order numbers. On the other hand, for the same stock, the distribution of order numbers throughout the day can be extremely uneven (with a higher concentration during the opening and closing periods, and sparser distribution during the mid-day). Within fixed time intervals (e.g.. level)- we care more about the aggregate characteristics of the order sequence rather than the details of individual orders. Under the assumption that the distribution of orders remains relatively stable over short periods, we can disregard the precise arrival times individual orders and structure the order sequences in cross-sectional view.
20

---

Published as a conference paper at ICLR 2025
Order-batch Model
Fine-tuned Image Decoder
Fine-tuned Image Decoder
tlc
tkt
tit
tk
tke
tk
Autoregressive Transformer
tk
tke
tk
tk
tk
tk
Fine-tuned Image Encoder
Fine-tuned Image Encoder
Order Image Converter
minute,
minute,.1
Figure 13: The framework of order-batch model. We employ a two-stage training approach: in Stage 1, we leverage a fine-tuned image encoder to transform "order images" from minute-level orders into tokens; Stage we train an autoregressive transformer model learn the distribution of the tokens. Order images are decoded from tokens via fine-tuned image decoder.
In practice. we convert one order-batch into an RGB image format. We refer such images as "order images" with shape [C, H, W). we demonstrated in Fig. 2 C denotes the categories of orders, or the channels of an order image. W and represent the width and height of the order image, indicating the number of price and volume slots, respectively. The pixel value V of the order images signifies the count of identical orders. In our work, we set C 3, /l
32, E [0, 100).
The order image converter allows us not only to "depict" the changes in orders over past period but also to leverage experience from image generation. We can utilize a pre-trained visual encoder to obtain order-batch embedding.
C.3.1 STAGE 1: ORDER IMAGE TOKENIZER
After converting the order-batch into an order image, we transform the problem of modelling order- batches into an image generation problem. In this way, we can follow the successful path of Large Vision Models (Bai al., 2024), adopting two-stage approach to generate intraday order-batch sequences. The first stage of the image generation task typically involves using a pre-trained image tokenizer discretize individual images into series of tokens.
Specifically, we leverage VQGAN Esser et al. 2021) to accomplish the conversion of order im- ages into discrete tokens, which learns convolutional model consisting of an encoder and decoder, allowing them to represent images using codes from a learned, discrete codebook. In particular, VQ- GAN incorporates discriminator and perceptual loss ensure high quality during the compression
21

---

Published as a conference paper at ICLR 2025
process. In our implementation, both the encoder and decoder utilized the original structure. Tech- nical Details: We use a pre-trained VQGAN from LDM (Rombach et al., 2022), which was trained on the LAION-400M database (Schuhmann et al. 2021). We adopt the configuration and weights from one of the models in the LDM model zoo, with a down-sampling factor f = 4, vocabulary size 7 8192, and codebook dimension d = 3. This means that an RGB order image of size 32 x 32 with 3 channels is discretized into x 8 = 64 tokens at this stage, each with a dimension of 3. In practice, we find that the off-the-shelf model parameters did not represent order images well, so we fine-tune it using order images to achieve a transition from natural images to order images.
C.3.2 STAGE 2: ORDER-BATCH SEQUENCE MODELLING
After the order image tokenizer converts individual order images into a sequence of discrete tokens, we concatenate these tokens form an order-batch sequence. In Stage 2, we train an autoregressive transformer to learn the distribution of these tokens. It learns not only the distribution of tokens that make up an order image but also the distribution of tokens between order images. Consequently, we can generate intraday order-batch sequences.
Specifically, we employ language model for next token prediction training. Technical Details: We use LLaMA2(Touvron et al., (002) the implementation framework for our autoregressive trans- former. We calculate the cross-entropy loss between prediction logits and labels. Implementation Details: The token length for LLaMA2 is 4096, and concatenate 16 order-batchis to form an order-batch sequence, with a total length of 16 x 64 = 1024, which well below the length limit.
D ENSEMBLE MODEL
D.1 INTRODUCTION
In sections above, we introduced the order model and order batch model, each with its advantages:
Order model: This model generates orders individually and is designed reflect short- term market impacts rapidly. However, it lacks the ability to generate target scenarios over the long run.
Order-batch model: This model generates order channels (We do not distinguish 'order channels' and 'order images' in this paper), representing the macro behavior of the market, and can be used to follow control signals. However, it lacks the ability for interactive market simulation.
In this section, we introduce the ensemble model, which aims to balance interaction and controlla- bility in market simulation.
D.2 APPROACH
The order channels output by the order-batch model contain rich information about macro trends in the financial market. would be advantageous if the order model could utilize this information to generate orders.
We propose using an ensemble model that takes the order logits and order channels as input and generates the next order, as illustrated in Fig. 4
In our experiment, we found challenging to train the ensemble model directly from order channels predicted by the order-batch model. The reason is that the order channels predicted by the order- batch model still exhibit high variance and may not accurately reflect replay order data. Realizing this, during training, we use the order channels directly from replay data, which provides accurate description of the market trend. In this way, our ensemble model learns how to condition on the order channels to generate the next order. During simulation, we use order channels predicted by the order- batch model to generate orders, which provide more flexibility for controllable simulation.
The ensemble model is simple cross-attention model that takes the order logits and real order channels as input and generates the next order. The loss advantage over the order model is used as the training metrie. Fig. shows the training process of the ensemble model. We can see that with
22

---

Published as a conference paper at ICLR 2025
this design, the ensemble model can improve its performance order generation, demonstrating its conditioning on order batch data.
Ensemble Model Training
0.0
Loss Advantage
0.2
-0.4
-0.6
-0.8
Training States
1e7
Figure 14:
Training process of the ensemble model. The x-axis represents the number of training samples, and the y-axis represents the loss advantage over the order model.
E FINE-GRAINED SIGNAL GENERATION INTERFACE
We introduce an interface that maps vague descriptions to fine-grained control signals using LLM- based historical market record retrieval. This guides order batch model, ensuring simulations reflect realistic market patterns and user-defined scenarios. The process involves three main steps:
Example Provision and Code Generation: Provide sample of minute-level return his- tory to GPT-4o mini and prompt to generate code that retrieves historical periods match- ing specified scenarios.
Apply the generated code on the entire dataset to identify more minute- level trajectories for each scenario.
Scenario Filtering:
Use the identified minute-level trajectories to guide the generation of order batches according to principles outlined in Sec. [.2 alongside the ensemble model for scenario generation.
Scenario Generation:
The minute-level return history is stored in a CSV file, formatted as shown in Table 2
date
minute
SZ000001
SZ000002
SZ003043
SZ003816
2023-01-03 2023-01-03
09:31:00
-0.001520
0.001664
-0.005541
0.000000
09:32:00
0.000761
0.000000
-0.004261
0.000000
2023-03-31
14:55:00
0.000797
0.000657
0.000164
0.000000
2023-03-31
14:56:00
0.000000
-0.000656
0.000164
0.000000
Table 2: Format of minute-level return history
We demonstrate market simulations for scenarios including "Sharp Drop", "Sharp Rise", and "Trend Reversal". Below, we detail the process when TEXT DES "Sharp Drop". First, a prompt is provided to GPT-4o mini, which generates code filter typical cases for the "Sharp Drop" scenario. The prompt is shown in Table
The code generated by GPT-4o mini, shown in Fig. 13 scenario and applied to the entire dataset to identify additional cases.
is then used filter the "Sharp Drop"
Once the minute-level return trajectory is retrieved, it is used guide the generation of order batches along with the ensemble model for scenario generation. Detailed descriptions and visualizations of the three scenarios are provided:
23

---

Published as a conference paper at ICLR 2025
import pandas pd import datetime
File_path 'minute_returnn data_aataallllla "aataaall.sst cavv data pd. po.read_cssyf111e__a
data catetime' = pd. to datetime (datal dataa''dtee date' data. index datetime', implace=True) data.drop (columns= date', 'minute'l, inplace=True)
data "minute' )
Apply groupby on each stock code to calculate rolling 25-minute sum rolling_returns = data. mata.groupby. (data. rolling (25) ()) sum (level-0, drop-True)
Filter based on sharp drops within the 25-minute windows (arbitrary
threshoid for "sharp drop")
threshold = -0.05
Example threshold for a sharp drop over 25 minutes
sample_nume nums 30
sharp_arops rolling wwwlling returns tareshold] dropna (how=!
all()
Reset the index retain datetime information sharp_dreee sharp drops. index
Extract 30 samples ensuring unique stock codes and trading dates, with varied start times
result []
soen_dates set
seen_stocks s)
seen_start_tines times = set ()
for - in sharp sharp_drops__ itteroos(sr ():
date rowl datetime' J ()
ttme (rowl I' datetime' pd. Timeeeeellta (minutes=24)) .iime ()
if start_time <= datetime.. timetmeeemmee/... (9, 30) or start_time <= datetime.t time
13, 00) and start_time datetime time (11, 30)
continue
stock_dropp = row. row.drop (labels= d'dattimee' ]
if start_time not in secn_start_times
for stock_code, value stock_ brock_drros.iterte ():
if not pd.isna (value) and date not in seen_dates and stock_com not in seen_stocks:
result.appent (f
DDte' date, Start Time' start time,
End Time' rowl' datetimmm .imee ())
'Stock Code'; : stock_code,
/25-Minute Return': value
}) seen dien_ddtee.aat add (date)
seen seen_stocks stocks. add (stock_conl
geen Seeart_times..e (start_time) if len (result)
sample_nums:
break
if len (result) >= sample_nums:
break
resulte of pd.Datarrame (result)
Figure 15: Generated code to filter out the "Sharp Drop" case
24

---

Published as a conference paper at ICLR 2025
Scenario:
Sharp Drop
Data Description: The input data is in CSV format with the following information.
The first column "date" represents the trading date.
The second column "minute" represents the time.
Each subsequent column corresponds to an instrument, with the value each cell representing the return of the instrument for the given minute compared to the previous minute.
Output Description: Please identify and provide 30 samples where a stock drops sharply within 25-minute window. For each sample, include the following details:
1. Date.
2. Start and end minute of the 25-minute window.
3. Stock code.
4. The return of the 25-minute interval.
Constraints on Output:
Ensure that the 25-minute cases do not contain duplicate stock codes and datetimes. Each sample should be selected from different trading days.
2. Ensure that each 25-minute interval is within the same trading day.
3. You can use groupby (' datttt et (ime)) ) rroll rolling (25) sum () to con- 1-minute-level returns 25-minute-level returns.
4. The begin and end times of the 25-minute interval should be within trading hours, e.g., 9:30 AM 11:30 AM and PM - PM.
Table 3: Prompt used for generating code in the "Sharp Drop" scenario
Sharp Drops: Simulating sharp declines to understand market reactions to negative events, assess risk management strategies, and evaluate market liquidity.
Sharp Rises: Simulating sharp increases to capture market behavior during positive events, allowing traders to test profit-taking strategies and analyze upward trends.
Trend Reversals: Simulating trend reversals to identify signals for entry exit points and understand market reactions to trend shifts.
Fig. 16 displays real stock trends over the first 15 minutes and the stock trends generated by MarS for the last 10 minutes of 25-minute period for these scenarios. Each row represents a scenario with three cases. The x-axis denotes time, and the y-axis indicates price. The blue line shows the replay price trajectory, and the orange line depicts the simulated price trajectory with confidence intervals. The results demonstrate MarS's capability to effectively generate diverse market scenarios, providing valuable insights for market participants.
F CONFIGURATIONS OF INPUT OVER DIFFERENT APPLICATIONS
As we abstract the mechanism of MarS as a conditional generation process in Sec we summarize their input conditions over different applications in Table and provide more detailed clarification.
TEXT is a key component the Conditional Trading Order Generation task, acting as a control mechanism for the "Conditional" aspect. It is designed to describe different market states under which we aim to generate trading orders. Examples of such market states include "sharp price decline" or "high market volatility". By incorporating DES.TEXT, we enable the generation process to adapt to varying market conditions, making the generated trading orders contextually relevant. More details on DES TEXT provided in Sec F
25

---

Published as a conference paper at ICLR 2025
2023-2-22-002281--ccmmma
2023-06-55-002843--ccemmm
2023-55-99-02211--ccemma
repley cantrol
1.000
Price
Price
Price
0.98
0.95
0.950
0.96
09:45
09:50
09:55
10:00
10:05
10:10
13:55
14:00
14:05
14:10
14:15
14:20
13:25
13:30
13:35
13.40
13:45
13:50
0023-03-99-000338 9.secnnrrrii
2023-04-18-002 719 9-scenarioz
2023-04-
1.10
1.15
1.10
1.10
Price
Price
Price
1.05
1.05
1.00
1.00
1.00
10:50
10:55
11:00
11:05
11:10
10:10
10:15
10:20
10:25
10:30
10:35
09:45
09:50
09:55
10:00
10:05
0222-02-06-000055--cemaaao
202300130--005448-<cemlal
202-01110-000522sccmano
1.10
Price
Price
Price
1.05
1.00
1.00
1.00
10:05
10:10
10:15
10:20
10:25
09:45
09:50
09:55
10:00
10:05
10:10
09:50
09:55
10:00
10:05
10:10
10:15
Figure 16: Case study for different scenario generation.
As for MTCH R, it represents comprehensive of order-matching rules, for example, the widely used double auction mechanism. In real-world financial markets, the rules are specified and period- ically adjusted by exchanges. In our simulation, these rules are governed by the Simulated Clearing House. We formulated MTCH_R as a hyperparameter to make the MarS framework adaptable to different markets and conditions. In the proposed paper, we it series of standard settings of the default double auction. Expanding MTCH.R would reveal the full extent of an exchanges trading rules, encompassing many details that we have implemented our code for the Simulated Clearing House.
Moreover, while the double auction mechanism is a common paradigm for the majority of global financial markets, there are variations in trading rules that differ across markets and periods. These include aspects such as price fluctuation limits, circuit breakers, and the distinction between call and continuous auction sessions. Our goal was to encapsulate these variations within the conditional trading order generation framework, ensuring the approach remains broadly applicable and flexible for different market scenarios.
Applications
Input Conditions
Forecasting Detection
Fo Lm
MTCH_R
[
Lm
MTCH
"What if" Analysis
[EXT]
(z0,
Lmm
((141...., 2145) MTCHH
RL Environment
(Io) ..... Tmm)
(#141,.... #445)) MTCH.R
Table 4: The summary of input conditions for order generation of different applications. means the condition is optional and indicates that either of the specified conditions should be chosen.
G DATA AND TECHNICAL DETAILS OF DETECTION
Traditional methods for detecting market abuse are time-comee mane-consuming and challenging, and abnormal market states are often defined and detected based the differences between current and historical
26

---

Published as a conference paper at ICLR 2025
Table 5: Market manipulation samples collected from CSRC.
Instrument
Start time
End time
Case Number
300475
2017-03-07
2017-04-25
[2020]No.9]
002321
2017-04-17
2018-01-30
[2024]No.44
300263
2017-05-17
2017-09-25
[2023]No.36
300658
2019-02-13
2019-05-10
[2023]No.25
300378
2019-03-14
2019-04-15
[2021]No.11]
3001 19
2019-04-01
2019-05-22
[2021]No.1]]]
002718
2020-06-04
2020-07-15
[2022]No.64
300313
2020-08-19
2020-08-24
[2021]No.76
002730
2020-12-15
2021-11-17
[2024]No.23
002713
2022-05-05
2022-05-18
[2024]No.47
market patterns. In this section, we take market manipulation as an example, and demonstrate how MarS could bring a new simulation-bail paradigm detection task.
5 shows the market manipulation samples collected from China Securities Regulatory Com- mission (CSRC). The data encompass total of 10 stocks, which have never been included in datasets used for our model training. For each stock, we gathered samples from an equal number of trading days before and after the manipulation occurred for comparison. There are 522 trading days for each period. For each trading day, conducted simulations every 25 minutes and then calculated a series of stylized facts of the simulated and replay trajectories.
The spread is key indicator of market liquidity, with larger spread indicating poorer market liquidity. At time f, the spread 5 is defined as: 6, = aj be. where a, is the best ask price and b the best bid price. The spread distribution widely used in detection tasks in finance (Affleck- Graves et al. 2000; Vyetrenko et al. 2020).
As evaluated MarS's realism in normal market in Sec. straightforward principle for anomaly detection is that quick drop in simulation realism metrics can serve as an initial indi- cator of potential anomalies. To verify it, we collected several market manipulation cases from C For each stock, we collected replay samples before, during and after the manipulation, and conducted simulations by MarS simultaneously. Through calculating Distribution Similarity?) we evaluate the similarity of spread distributions, which serves key indicator of market liquidity. This metric is used for comparison between replay and simulation.
Fig. 8 shows the varying spread distributions in different periods around manipulation. While MarS generally performs well to simulate the normal market, its performance drops during the manipula- tion, showing heavier tail and peak around 8 1000. These anomalies be viewed as sig- nals likely corresponding to market manipulation, where manipulators significantly impact liquidity, widening the spread. These anomalies, less frequent in normal markets, lead to performance drop in MarS, suggesting a new detection approach by monitoring such similarity drops. Consequently, MarS can help investors avoid anomalies and assist financial institutions in maintaining market sta- bility.
It important note that single anomaly does not conclusively indicate market manipulation. Instead, serves as an initial signal that requires further holistic assessment, combining multiple metrics ensure robust conclusions. The example provided serves as a representative illustration of our approach. Our primary objective in this experiment was to demonstrate the paradigm shift MarS offers in market manipulation detection.
http://ww.ccrr..oo
27

---

Published as a conference paper at ICLR 2025
H CONFIGURABLE TWAP STRATEGY AND TRADING AGENT
H.1 INTRODUCTION OF TWAP STRATEGY
The Time- WeiehWeigtted Average Price (TWAP) algorithm executes large trade volumes while minimiz- ing market impact over a specified time frame. The TWAP strategy divides the total volume to be traded into equal parts that executed at regular intervals. This strategy consists of two dis- tinct phases within each interval: the passive period and the aggressive period. Key configurations include:
Maximum Passive Volume Ratio (PVR): During the passive period, the strategy places orders at the current bid price (bid1) with volume determined by the PVR, aiming to fill orders without significantly altering the market price. A PVR of 0 indicates no passive volume during the passive period.
Aggressive Price (AP): If passive trading does not achieve the expected volume, the strat- egy enters aggressive phase, placing additional orders at more aggressive price (AP) to ensure the desired volume executed. An AP of 0 means no aggressive order during the aggressive period.
By balancing passive and aggressive trading, the TWAP strategy aims to execute large orders effi ciently while controlling market impact.
Taking the buying task as an example, our configurable TWAP strategy is shown as below:
Algorithm Configurable Time-Weighte Weighted Average Price (TWAP) Strategy for Buying.
Input:
Total Volume V. Execution Time T = 5 minutes, Split Interval Át 30 seconds, Maximum Passive Volume Ratio PVR, Rt Aggressive Price AP (askl, ask2, ask5)
Output: Executed Orders
Initialization:
1. Split the total volume V into 10 equal parts. Each part K = V/10 is expected to be executed in At 30 seconds.
For each interval from 1 to 10:
1. Passive Period: (First 25 seconds of each interval)
(a) Cancel all non-bid1 volumes.
(b) Submit passive order with max volume PVR and price bidl.
(c) Wait for 25 seconds.
2. A Aggressive Period: (Last 5 seconds of each interval)
(a) If the current executed volume lags behind the expected volume: Calculate the extra volume E. to be executed.
If the available volume is insufficient, cancel existing passive orders as needed.
Submit an aggressive order with volume E and price AP.
(b) Wait for seconds.
H.2 TRAINING OF TWAP TRADING AGENT WITH RI.
For the trading agent training with RL, we can adjust the maximum passive volume ratio (PVR) from (0, 0.1, .... } and aggressive price (AP) in {0, 1, 2, 3, 4, 5) for TWAP Strategy. We used batch size of 8192 and learning rate of x 10 -5 The trading model was updated using a simple policy gradient algorithm (Sutton & Barto 2018). The performance metric is the price advantage over our best-configured TWAP agent PP.9),,, measured in basis points (BP, 1/10000).
I EVALUATION OF CONT'S 11 STYLIZED FACTS
I.1 SUMMARY
28

---

Published as a conference paper at ICLR 2025
Stylized facts are high-level summaries of empirical characteristies in financial markets, essential for assessing the realism of market simulations. In this section, we evaluate the 11 stylized facts identified by Cont (2001) using historical and simulated order sequences.
To rigorously test these facts, we simulated 11,591 trajectories for the top 500 liquid stocks in the
Chinese market, from March 9, 2023, to July 12, 2023. Table 6 compares the presence of these facts both historical and simulated data. The Historical column indicates observation in real data, while the Simulated column assesses their presence in simulated data. Key findings include:
Nine out the 11 stylized facts are observed in both historical and simulated data. How- ever, Gain/loss asymmetry and Leverage effect are not present, possibly reflecting modern market shifts. Studies such as -Raalff-Crrri Crain et al. 2023) note similar absences in the mod- ern U.S. Dow 30 stocks.
All 11 facts show similar patterns between simulated and historical sequences, showcasing the model's strong capability in generating realistic order sequences.
Note that merely evaluating stylized facts does not fully assess financial market simulation quality. Further evaluations for in-context generation, such as forecasting (Section 4.1) and quantitative analysis of stylized facts (Section]], are crucial.
Fact
Fact Name
Historical
Simulated
Absence of autocorrelations
2
Heavy tails
3
Gain/loss asymmetry
Aggregational Gaussianity
X
X
5
Intermittency
6
Volatility clustering
X
X
7
Conditional heavy tails
X
8
Slow decay of autocorrelation in absolute returns
X
X
9
Leverage effect
10
Volume/volatility correlation
X
Asymmetry timescales
Table 6: Presence of Stylized Facts in Historical and Simulated Order Sequences. All facts are present in both historical and simulated data, except for Gain/loss asymmetry and Leverage effect.
I.2 DEFINITIONS OF STYLIZED FACTS
The 11 stylized facts from Cont (2001) are:
1. Absence of autocorrelations: "(linear) autocorrelations of asset returns are often insignif- icant, except for very small intraday time scales (20 minutes) for which microstructure effects come into play."
2. Heavy tails: "the (unconditional) distribution of returns seems to display power-law or Pareto-like tail, with a tail index which is finite, higher than two and less than five for most data sets studied. In particular this excludes stable laws with infinite variance and the normal distribution. However the precise form of the tails is difficult to determine."
3. Gain/loss asymmetry: "one observes large drawdowns in stock prices and stock index values but not equally large upward movements."
4. Aggregational Gaussianity: "as one increases the time scale over which returns are calculated, their distribution looks more and more like normal distribution. In particular, the shape of the distribution is not the same at different time scales."
5. Intermittency: "returns display, at any time scale, high degree of variability. This quantified by the presence of irregular bursts in time series of wide variety of volatility estimators."
6. Volatility clustering:
"different measures of volatility display positive autocorrelation over several days, which quantifies the fact that high-volatiiity events tend to cluster in time."
29

---

Published as a conference paper at ICLR 2025
7. Conditional heavy tails: "even after correcting returns for volatility clustering (e.g. via GARCH-tppe models), the residual time series still exhibit heavy tails. However, the tails are less heavy than in the unconditional distribution of returns."
8. Slow decay of autocorrelation absolute returns: "the autocorrelation function of ab- solute returns decays slowly function of the time lag, roughly
power law with exponent 3 E [0.2, 0.4]. This is sometimes interpreted as a sign of long-range dependence."
9. Leverage effect: "most measures of volatility of asset are negatively correlated with the
returns of that asset."
10. Volume/volatility correlation: "trading volume is correlated with all measures of volatil-
ity."
11. Asymmetry in time scales: "coarse-graines measures of volatility predict fine-scale volatility better than the other way round."
1.3 EVALUATION OF STYLIZED FACTS
This subsection summarizes the evaluation results for each stylized fact. Initially, each instrument is assessed individually, and the results are then aggregated across all instruments to obtain an average. 95% confidence interval shown for line plots, and quantiles are displayed for the box plot.
Absence of autocorrelations: We computed the autocorrelation of returns using both the last and mean trade prices per minute. Fig. [7a and 17b illustrate that autocorrelations decay quickly after one minute. Using the last trade price shows negative autocorrelation at lag due to the "bid-ask bounce", as noted in Ratliff-Crain et al. (2023). Conversely, the mean trade price shows positive autocorrelation, indicating short- term momentum. For consistency with Ratliff-Crain et al. 2023 we use the last trade price for subsequent evaluations.
Auto-Correlation Returss (Last)
Auto-Correlation Returns (Mean)
0.00
0.20
source
Replay
-0.05
0.15
Simulation
Cofr
CoTr
-0.10
source
0.05
Replay
Simulation
0.00
-0.20
2
3
4
5
8
10
1
3
4
6
8
9
10
lag
lag
(a) Absence of autocorrelations (Last Price) (b) Absence of autocorrelations (Mean Price)
Figure 17: Absence of autocorrelations, (a) Using last trade price. (b) Using mean trade price. Both show rapid decline after minute.
Heavy tails and Aggregational Gaussianity: Kurtosis of returns for various intervals was calcu- lated. Positive kurtosis indicates sharper peaks and heavier tails than normal distribution. Fig. T8a shows that return distributions exhibit heavy tails. Distributions trend towards normality as intervals extend from to 20 minutes, aligning with Aggregational Gaussianity.
Conditional heavy tails: Volatility varies throughout the trading day, peaking at open and close. After normalizing returns by minute-specific volatility and computing kurtosis, Fig. [8b shows that normalized returns still exhibit heavy tails, though less pronounced than unconditional returns in Fig. 18a consistent with Conditional heavy tails.
Gain/loss asymmetry: Positive skewness of returns (Fig.
19a suggests deviation from Cont's
original description.
Volatility clustering and Slow decay of autocorrelation in absolute returns: Autocorrelation of absolute returns for different intervals shows slow decay in Fig. 19b Considering absolute returns volatility Miler et al. (1997), this also illustrates volatility clustering.
Intermittency: Following Ratlif Crain et al. (2023), extreme returns are defined as the 99% quan- tile of absolute returns. The Fano factor, used verify Poisson distribution adherence, exceeded
30

---

Published as a conference paper at ICLR 2025
Kurtosis of Returns
Kurtosis of Returns (Normalized)
source
source
Replay
Replay
kurtosis
Simulation
kurtosis
Simulation
4
2--
2
Period (Minutes)
Period (Minutes)
(a) Heavy tails and Aggregational Gaussianity
(b) Conditional heavy tails
Figure 18: (a) Heavy tails and Aggregational Gaussianity. (b) Conditional heavy tails.
Skewness of Returns
Auto- Correattrelnnn of Absolute Returns
0.5
source
0.15
source
Replay
Replay
Simulation
Simulation
skew
CoTr
0.10
0.3
0.05
0.1
4
8
12
14
16
18
20
4
6
10
12
14
16
18
20
Period (Minutes)
lag
(a) Gain/loss asymmetry
(b) Volatility Clustering
Figure 19: (a) Gain/loss asymmetry: right-skewed distribution. absolute return autocorrelation.
Volatility Clustering: slow decay of
1, indicating higher variability (Fig.
20a
This, along with heavy tails and volatility clustering,
confirms Intermittency.
Leverage effect: Return and lagged volatility correlation is slightly positive (Fig. 20b Cont's description.
contrary to
Fano Factor of "Burst" Returns
Correlation between Return and Lagged Valatility
source
0.04
source
Replay
Replay
Simulation
Simulation
corr
0.02
0.00
12
14
fano factor
lag
(a) Intermittency
(b) Leverage effect
Figure 20: (a) Intermittency: Fano factor exceeds 1, indicating high variability. (b) Leverage effect: slightly positive correlation between return and lagged volatility.
Volume/volatility correlation: Positive correlation between volume and lagged volatility is evident (Fig. 21a).
Asymmetry in timescales:
Following Takahashi al. (2019a), assessed correlation between
fine- and coarse -rasineg volatility across lags from -10 minutes. Fig. 21b shows significant negative asymmetry, consistent with Takahashi et al. 2019a) and Miler et al. 1997..
31

---

Published as a conference paper at ICLR 2025
Correlation between Valume and Lagged Volati
source
0.12
0.4
Replay
0.10
Simulation
Corr
corr
0.08
0.2
0.06
Replay
0.04
Simulation
10
8
-4
-2
8
10
lag
lag
(a) Volume/volatility corrllation
(b) Asymmetry in timescales
Figure 21: (a) Volume/volatiltyy correlation: positive correlation. (b) Asymmetry in timescales: significant
negative asymmetry observed.
QUANTITATIVE ANALYSIS OF STYLIZED FACTS
To ensure experiments are comparable across runs, we quantify the stylized facts with two metries:
Distribution Similarity: We calculate the overlap coefficient between the empirical distri- bution of the stylized fact and the simulated distribution. A higher score indicates higher similarity in the overall distribution.
stylized fact value into three classes based on play data: low, medium, and high, ensuring similar probabilities for each class over the simulation period. We then compare the stylized fact value between simulation and replay and calculate the accuracy of the classification. This metric measures our capability for in-context prediction.
Accuracy (3-Class): We classify
Distribution Similanity: 0.9331
Accuracy(3-claag) 0.5698
0.025
4.9% (304)
0.020
(1266)
(483)
Probabillty
Simulation
0.015
9.8%
144,5%
9.7%
(901)
(605)
0.010
Replay Sim, lation www.uaaaaannanaaa
3.7%
7.1%
22.1%
(441)
(1.778)
0.2
0.4
0.6
0.8
2
Replay
Figure 22: Stylized Fact Analysis: Buy Order Ratio. This metric assesses the proportion of buy to buy+sell orders, capturing market dynamics that may influence the market trend.
We show an example for the Buy Order Ratio Fig. 22 each minute and then compare the distribution of the ratio between simulation and replay data. In summary, we achieve high score for the overall distribution similarity and an acceptable 3-class classification considering the nuances of market dynamics. We list the full quantitative results in Table
we calculate the buy order ratio for
K MARKET IMPACT
We give a detailed introduction and discussion on interactive simulation and market impact analysis.
Market Impact Generation: We generate market impact data using the TWAP strategy with four different configurations: L1-PO.1, L1-P0.9, L5-PO.1, and L5-P0.9. The configuration name LX-PY indicates that the aggressive price (AP) is askX and the maximum passive volume ratio (PVR) is
32

---

Published as a conference paper at ICLR 2025
Name
Distribution Similarity
Accuracy (3-Class)
Volatility
0.872
0.516
Spread
0.970
0.729
Mean Order Volume
0.957
0.776
Aggressive Order Ratio
0.920
0.525
Buy Order Ratio
0.933
0.570
1-Min Return
0.956
0,684
2-Min Return
0.936
0.625
3-Min Return
0.924
0.583
4-Min Return
0,914
0.548
5-Min Return
0.908
0.531
Table 7: Summary of stylized facts. The prediction for to 5-Min Return is aggregated from 128 rollouts for each initial time point.
Y. These agents assigned buy varying volumes over 5 minutes with different instructions and starting times. We explored the market impact generated by these trading agents from 624k simulated trading trajectories.
Further analysis of synthetic market impact: Beyond the verification of the Square-Root-Lawy we apply further analysis on synthetic market impact data. The key findings are summarized as follows:
Agents with more aggressive configurations (L.5-P0.1 1 and L5-P0.9) are expected exhibit a larger market impact and achieve a higher fulfillment rate. Our simulations quantify their differences and confirm these assumptions, as illustrated Fig. 23a
The agents generate both short-term and long-term market impacts in MarS, as shown in
Fig. [33] similar observations studied in previous empirical work (Bacry et 2014] Donier et al. (0155)). We also observe that agents with larger passive volume ratio gen- erate less momentum after trading ends.
1.00
1.0
Fulfilment Rate
0.98
Market Impact
0.8
0.96
agent type
agent_ _ytp
L1-P0.1
0.4
L1-P0.1
0.94
L5-P0.1
LS-P0.1
L1-P0.9
0.2
L1-P0.9
0.92
LS-P0.9
L5-P0.9
0.0
0.0000 0.0005 0.00100.0015 0.0020
10
///o/V
Minute
(a) Fulfillment rate of different agents
(b) Short-term and long-term market impact Figure 23: Further investigation of synthetic market impact
These findings confirm the reliability and convenience of using synthetic data from MarS, allowing for in-depth exploration of market dynamics without the cost, risk, and time constraints associated with real-world experiments.
New factors of Market Impact: The new three factors {resiliency, LOB -reesuuee LOB depth) are defined as below:
resiliency log( trading moment))
(5)
LOB.pressure = (a arant + (1 a1)a) agent LOB jmb jnteust-pr--iin
(6)
LOB depth log( LOB 1a8.aak.uua ask.volumejas mie (1 (9) LOB bid volume tast last pre pre-min)
33

---

Published as a conference paper at ICLR 2025
where:
Eto tp
lae--pre-min
Ftt mid price,
pre ure_trading moment
mid price last-pre-min
Erade trade
tstrade statt agent trans volume,
agent transttranscom trans .sk
trude and strade
agent Jrans trransvolumme, LOB _ask jookkoollmejss--pee Jast-premiie
E Lnd
nart agent trans ttanttaannuuunnaaa volume,
agent trans bid-
(10)
2 -radeeeand trode_ssa jant agent trans volume; + LOB bid volumelovlooeeo volumettat-pp--mii
taxt-pre-min
LOB askk vasume jast-pre cesut--re-min
LOB bid voluuolluee last min
B0B_iibjast-pre-mee
(11)
LOB laakaavskkkmeee last-pre-min ialtteeeeeea
last-pre-inn
and at, B, } are the hyper-parameters with constrain: a E (0, 1). 3 E (0, 7 E (0, 1) for any
t, and Lhor Salast-pre-min- Tit 1. last-pre-min means the last minute before the agent starts to trade. LOB ask volume and LOB bid volume are the ask and bid volumes of LOB. agent trans volume, the transaction volume of the agent at time t. mid price, is the mid-prics mid-price at time t.
The relationship between market impact and factors LOB pressure, and LOB depth is shown in Fig. 24
0.010
agent_type type
agent type
agent_type
L1-P0.1
0.005
L1-P0.1
market, impact
0.008
L5-P0.1
market Limpact
LS-PO.1
L1-P0.9
L1-P0.9
L5 P0.9
L5.90.9
0.003
0.6
12
(a) LOB pressure
(b) LOB_depth
Figure 24: Effects of factors market impact.
We also investigate the correlation between three new factors and the Square-Root-Law factors: sqri(Q/V) and volatility a in Fig. 25 relatively low.
It is clear that the correlation scores of those factors are
1.0
sart(orv)
1.0
0.00
.0.0
0.1
0.4
volati
-0.0
1.0
0.6
resiliency
0.4
0.2
LOB, depth
0.1
0.0
0.1
1.0
-0.2
0.0
LOB pressure
0.4
0.0
-0.1
-0.2
1.0
sartion
volating
reslieecy
LOB, depth
presaure
Figure 25: Correlation matrix of Square-Root-Lavw factors and three new factors.
Dynamics of long-term Market Impact:
For equation 14
used model the long-term
market impact, we set two decay functions:
piecayy (t)
2 and seven factors:
(v & mid-price, aggnticeeeggeteeplllpllee replay, agent rollout, LOB LoB_eepth, LO0 pressuree pes. mid-price is
34

---

Published as a conference paper at ICLR 2025
the mid-price before trading. agent_rollout and agent.replay defined as below:
L ann
Limde start agent
aolnt_ooloou
(12)
total_transaee serpiictttooooouueee _f rollout
Ltraee saar agent trans volume, repnly aaaallrranaaction.ollumm wft.:/tttooooooummooooooooooee refary
trade end
(13)
The training process is based on the synthetic long-term market impact generated by the TWAP agent (L1 PO.1). We use torch-diff Chif (2018) to optimize W, where the objective as the MSE reconstruction loss along with the LI regularization.
After training, we illustrate the auto-correlation of the synthetic market impact decay, the trajectories predicted by the learned ODE, and the base ODE from empirical formulas (Gatheral et al. 2011 Curato et al. 2017) in Fig. 26
1.000
0.975
Auto-Corras Correlattin
0.950
0.925
0.900
0.875
Learned ODE
0.850
Base ODE
0.825
Ground Truth
2
Lag(minutes)
Figure 26: Auto-correlatonn of long-term market impact with learned ODE and base-ODE.
For the base-ODe used as a baseline in Fig. 26 we use the basic form of the Square-Root Process
(Gatheral 2010). which is defined as:
dY dt
Q = -V V Vt
(14)
where is the volatility, Q is the trading volume, and V is the total market volume.
L COMPARISON OF DEEPLOB AND MARS/LMM IN FORECASTING TASKS
Aspect Applicable Tasks Input Features Model
DeepLOB
MarS/LMM
Task specific forecasting. Limit order book (LOB) data. Small, handcrafted, and not scalable Single-step or fixet-lenth.
General forecasting through simulation. High-ffrequeny order-level data. Large-scale foundation model. Multi-step, sequence generation.
Prediction
Table 8: Comparison of Deepl.OB and MarS/LMM in forecasting tasks.
Table compares DeepL.OB MarS/LMM in forecasting tasks, emphasizing their distinct ap- proaches and capabilities. DeepL.OB is designed for specific forecasting tasks, trained on fixed step forecasting, and uses Limit Order Book (LOB) data as input. features relatively small, hand- crafted model for LOB forecasting, which is hard to scale up, and provides single-step predictions for leegttennth forecasting, such as price changes after 100 orders or minute. contrast, MarS is designed for market simulation, capable of performing general forecasting through simulation, and uses fine- anee-grrined order sequence data as input. powered by large foundation models trained on large-scale order sequence data and offers simulation with multi-step generation.
35


Reviews:
[{"review_id": "wCRs0QAOtW", "reviewer": "Reviewer_CjFd", "summary": "This paper makes several contributions: (i) it designs, implements and evaluates Large Market Model (LMM), an order-level generative foundation model, for financial market simulations; (ii) a novel financial Market Simulation engine (MarS), based on LMM, that enables more realistic, domain-specific interactive and controllable order generation. The paper includes evidence of LMM's strong scalability across data size and model complexity, and of MarS's advancements towards more realistic, interactive and controllable order generation with market impact. Various scenarios illustrated the application of MarS for forecasting, detection, analysis, and agent training, thus demonstrating its contributions towards more realistic financial market modelling and simulation frameworks.", "questions": "The main questions and suggestions are derived from the identified weaknesses.\n\nThe paper should be restructured by including more specific key definitions and design decisions, including ML-specifc (relevant for the ICLR audience) from the Supplementary Materials into the main paper.\n\n\"RL-agent training tasks\" is mentioned twice in the paper (p. 8). It would help to link this term to Section 4.4, for improved clarity and readability. Also, discussing the differences between MaRs/LMM and DeepLOB would improve the paper. Clearly defining the synthetic data and synthetic market impact (rather than referring to them indirectly in the main part of paper) would also be helpful.\n\nIn addition, it would help for the authors to address reproducibility, in terms of code and data.\n\nOverall, the suggested changes would improve the rigor, clarity and overall contribution of the paper, as well as its suitability for the ICLR audience.\n\nThere are some minor spelling/ typo errors, e.g.: \"these information concludes\" (p. 5); \"with constrains\" (p. 28); Eq.equation (p.28)", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "The paper makes a contribution in a highly relevant application domain, i.e. realistic financial market simulation frameworks. The methodology is adequate, and experiments and results are included in support of the statements and contribution claims. The main part of the paper is focused on LLM and MaRs, presenting the design and implementation decisions, and a detailed description of the experiments and results. The paper includes evidence of the LLM's scalability across data size and model complexity. In addition, MaRs enables more realistic, interactive and controllable order generation. A range of different scenarios illustrate the applicability of MaRs to key domain-specific tasks such as forecasting, detection, analysis, and agent training, thus demonstrating its contributions towards more realistic financial market modelling and simulation frameworks.", "weaknesses": "The current structure of the main part of the paper prioritises a high-level presentation of LLM and MaRs, and the applicability of the proposed solution to four relevant use cases. The MaRs design and features (Section 2) are also presented at a high level, with insufficient rigour in the problem definition (Section 2.1) -- which may not be known to a ML audience. It is not clear why, for example, being able to provide a text-based description of the desired market scenario, would guarantee controllability (the definition of controllability on page 2 is fairly vague). Similarly, the assumptions made/ requirements about the user-injected orders are not specified. The language is ambiguous in places, e.g. \"any possible market condition\" (p. 2); \"often using recent real orders\" (p. 3). More technical detail could be included in Section 2.1.2, for self-contained, rigorously specified problem and solution,  and to support the claims made in this section.\n\nIt would help to better define the control signals, and discuss their effectiveness for increasing correlation scores.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "VhjLoXlQx9", "reviewer": "Reviewer_nX8c", "summary": "In this paper, the authors propose a financial market simulation framework, MarS, powered by a large market model (LMM) trained on real-world limit order book (LOB) data. They introduce two key algorithmic innovations: order sequence modeling, which tokenizes the LOB data, and order batch sequence modeling, which converts it into a tensor representation similar to the RGB format in image processing. These techniques connect LOB market simulation to recent advances in the field. In their experiments, the authors demonstrate that the LMM follows the scaling law for model and training data size, showcasing potential use cases for the framework.", "questions": "- In the section B.2, the author mentioned the index could uniquely identify a limit order. Could the authors provide a concrete example?\n\n- In the order-batch sequence modeling part, is there any mechanism/constraint to prevent the number of cancel order be greater than the outstanding orders? If such scenario happens, how the will the framework cope with it?\n\n- In the section 3.3, I am not following why the interaction ability is evaluated using the correlation. Could the authors elaborate?", "limitations": "", "rating": 6, "confidence": 4, "soundness": 2, "presentation": 2, "contribution": 3, "strengths": "1. A major strength of this paper is its algorithmic innovation in using order book data tokenization and an RGB-like tensor representation, which importantly bridges market simulation with advances in language and vision modeling.\n\n2. The paper introduces a timely topic by connecting LOB market simulation with generative modeling.", "weaknesses": "1. The paper’s reproducibility would benefit from providing additional critical details about the method and implementation.\n\n  - In Section 2.1.1, the authors outline that conditional trading order generation requires several hyperparameters, such as DES_TEXT for general market description and MTCH_R for specifying the matching rule for trading orders. However, the experimental section does not provide configuration details for these hyperparameters in relation to the obtained results.\n  \n  - While the authors provide sufficient detail on order sequence modeling and order batch sequence modeling, the training process for the ensemble model lacks detailed illustration, and further illustration on how the two methods are combined within the ensemble would be beneficial.\n\n  - The authors mention that the LMM is trained on real-world market data; however, they do not provide data processing details. For example, real-world LOB data includes various order types (e.g., stop-loss orders, limit orders, market orders) that may arrive asynchronously in the market, yet the paper does not specify how these orders are mapped to the bid and ask sides as described.\n\n2. More comprehensive evaluations are needed to demonstrate the authenticity of the simulated market. Although the authors include three tests of stylized facts, further testing to show that the framework conforms to additional stylized facts would strengthen its credibility. Please see \"Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative finance, 1(2), 223.\" for details. Ideally,  multiple iterations and providing confidence intervals for the measures are preferred.\n\n3. Some of the experiments are not necessarily good demonstrations about the model strength and their design need to be further improved.\n\n  - In the 4.2 detection experiment, 1) the manipulation seems can be easily identified due to anomaly in the distribution tail without resorting to the simulation 2) the distribution similarity need to be clearly defined and demonstrate it is statistical different from the others 3) the author may want to compare with other anomaly detection algorithms.\n\n  - The factor analysis is not a good application example because 1) it could also performed on real world data. 2) the simulated market may not good representation about the real-world market if only three stylized facts are satisfied.\n\n4. The paper’s clarity would benefit from further improvement. Since order sequence modeling and order-batch modeling are two key innovations, the description of these methods should be included in the main content rather than in the supplementary materials.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "5PIZIhUqPd", "reviewer": "Reviewer_dWUs", "summary": "This paper introduces a generative model designed to simulate realistic order-levels scenarios in financial markets. It uses a large language model to analyze the current market environment, taking this information within a proposed large market model. The model comprises two main components: an order-batch model that captures temporal patterns and an order model that addresses the sequential nature of market orders. These orders are then interactive with user's injection in a simulated in a simulated clearinghouse environment.\n\nTo validate the model, the paper conducts tests on stylized facts to ensure realistic simulation outcomes and applies the square-root law to assess interactive simulation capabilities. It also evaluates the model’s scalability in large-scale market scenarios.\n\nFollowing validation, the model is applied in four downstream applications: forecasting, anomaly detection, what-if scenario analysis, and training datasets for agent-based models.\n\nThe paper contributes a model for simulating realistic financial markets, which has potential for application across various downstream scenarios.", "questions": "(1) Order-sequence model \nThe order-sequence model uses an autoregressive approach to capture patterns within the order book, aiming to predict subsequent orders. However, the diversity of trading strategies among market participants complicates this task, often making the next order seemingly random and unpredictable. For instance, a momentum trader might buy following a price increase, anticipating continued upward movement based on the persistence of price trends. Conversely, a mean reversion trader sees a price rise as a selling opportunity, expecting prices to normalize back to the mean, counter to the current trend. Could you provide literatures or evidences in your experiments supporting a relationship between orders?\n\n(2) Diffusion model\nIn Figure 1, a diffusion model is introduced. Could you explain the rationale behind this choice and how the diffusion model is utilized in this context?", "limitations": "", "rating": 8, "confidence": 3, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "The paper introduces a Large Market Mode and the MarS engine, which use order-level generative foundation models for simulating financial markets. This is an advancement research expanding on traditional statistical and agent-based models, providing promissing resolution, interactivity, and realism.\n\nThis paper is well-written, clear, and consice. It begins by identifying a specific research gap, then clearly states the proposed solution, and explains how it functions. Additionally, the paper describes potential downstream applications and further research opportunities, all within a well-organized logic chain.", "weaknesses": "(1) Time Interval. \nThe model discussed in this paper simulates market at the minute level, whereas in actual financial markets, transactions can occur at the nanosecond level. There could be challenges in accurately capturing the extreme volatility and rapid decision-making. Specifically, using a closed-source LLM engine might introduce limitations due to rate constraints. In contrast, this paper employs an open-source engine, which necessitates careful consideration of its reasoning and inferential capabilities to ensure it can effectively model the high-speed dynamics of financial markets. Does the MarS model have the design capability and flexibility to increase the level of trading time intervals?\n\n(2) Multi-order book correlation.\nIn the design of large market models, the two primary approaches are the order-sequence model and the order-batch model, which capture temporal correlations and patterns. Additionally, in the conditional generation process, it seems to focus solely on a single order book. Considering that markets consist of multiple order books and each asset is significantly influenced by others as well as the market environment, how can the model effectively capture the correlations between different order books?", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "R7jMtR4XTP", "reviewer": "Reviewer_dx5Y", "summary": "This paper presents a market simulation environment driven by a generative model that dynamically produces new market orders, based on the current market context and the historical order flow. This enables a responsive, interactive simulation of market dynamics. The model aims at supporting various applications, including forecasting, anomaly detection, market analysis, and agent training.\n\nThe core generative model, named the Large Market Model (LMM), is designed on the idea of a \"foundation model for financial market simulation, akin to language modeling in the digital world\".", "questions": "- What does \"MTCH R\" refer to exactly? It’s not clear how a conditional model should interpret a constraint on the \"feasible space for each order\".\n\n- Is the \"SIMULATED CLEARING HOUSE\" simply an exchange engine simulating a double auction market, or is it something else? It seems to be the latter. \n\n- For the order-batch model, which generates orders at the end of each minute, is this the smallest reaction time of the simulation in response to orders? Or does the model plan a minute ahead (a batch of orders) and then refine (by conditioning) that batch using the Order model? How exactly does the condition in Figure 3 function here?\n\n- In Figure 5a, the market replay appears to be shifted (due to buy orders). Is this intentional? Using the replay series as a control? I suggest showing this experiment with a shaded area over multiple simulations with similar buy and sell orders (similar to Figure 17).\n\n- Why is MarS assumed to have a \"real\" transition distribution P(s | s, a) in Table 1? \n\n- In Section 4.2, the detection approach is interesting, but I’m curious whether the observed difference in distribution similarity (computed how?) is statistically significant. Are stressful trading days or shocks interpreted as manipulation as well? Before claiming this approach is feasible, it would be helpful to see the average difference in spread distribution over multiple days or periods.\n\n- In Figure 19b, the market impact appears to be permanent. Is it true? What happens if we extend the simulation period?\n\n- How does the model adapt to different markets (without re-training)? For example, Chinese markets generally differ significantly from U.S. markets in terms of liquidity and frequency.", "limitations": "", "rating": 8, "confidence": 4, "soundness": 2, "presentation": 4, "contribution": 3, "strengths": "- The paper addresses an important and complex challenge, moving a step towards a more general and powerful generative model for limit order book simulation.\n- The authors use for the first (to the best of my knowledge) the LLaMA2 architecture for order flow generation, showing also the potential of this architecture with more data and model parameters (Fig.2) \n- The downstream tasks are quite interesting and useful.\n- The paper is well written and easy to follow.", "weaknesses": "Overall, I believe the paper has significant merit and I tend to recommend acceptance (and increase my score). However, I have some concerns, particularly regarding reproducibility. I would encourage the authors to make efforts to improve this aspect of their framework.\n\nBelow, I outline my main concerns and questions:\n- Key details needed for reproducibility, such as code or datasets, are missing.\n- Given that this is a conference on representation learning, more discussion on the embedding of orders and the LOB state would be valuable. For instance, are all possible order prices linearly discretized into the range [0, 32)? Are price outliers excluded? does the model use absolute prices or the distance from the midprice?\n- What are the training and simulation times? The latter is particularly crucial for the proposed tasks, as generating a few hours of price paths requires thousands of generated orders.\n- A discussion of limitations is missing. For example, unlike text with a relatively fixed vocabulary, a fixed embedding for orders might reduce adaptability across different markets?\n(see also questions)\n\nMinor:\n- Some essential details should appear in the main paper, such as the dataset used and the authors’ use of a LLAMA2 architecture.\n- In line 40, when the authors briefly discuss existing market simulation models, it would be helpful to include citations. This will guide readers interested in statistical or agent-based models to relevant literature.\n- There is occasional overuse of non-technical terms, such as “gold mine of data,” and some paragraphs (e.g., lines 236 and 240), which are also capitalized. Are these intended as citations?\n- In paragraph 2.1.2, clearer spacing or breaks between components would improve readability.\n- Typo on line 384 (“classesup…”).\n- The diffusion model in Figure 1 is not explained or discussed.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Decision: Accept (Poster)