IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2407.18957.html

When AI Meets Finance (StockAgent): Large Language Model-based Stock Trading in Simulated Real-world Environments

Author

Listed:
  • Chong Zhang
  • Xinyi Liu
  • Zhongmou Zhang
  • Mingyu Jin
  • Lingyao Li
  • Zhenting Wang
  • Wenyue Hua
  • Dong Shu
  • Suiyuan Zhu
  • Xiaobo Jin
  • Sujian Li
  • Mengnan Du
  • Yongfeng Zhang

Abstract

Can AI Agents simulate real-world trading environments to investigate the impact of external factors on stock trading activities (e.g., macroeconomics, policy changes, company fundamentals, and global events)? These factors, which frequently influence trading behaviors, are critical elements in the quest for maximizing investors' profits. Our work attempts to solve this problem through large language model based agents. We have developed a multi-agent AI system called StockAgent, driven by LLMs, designed to simulate investors' trading behaviors in response to the real stock market. The StockAgent allows users to evaluate the impact of different external factors on investor trading and to analyze trading behavior and profitability effects. Additionally, StockAgent avoids the test set leakage issue present in existing trading simulation systems based on AI Agents. Specifically, it prevents the model from leveraging prior knowledge it may have acquired related to the test data. We evaluate different LLMs under the framework of StockAgent in a stock trading environment that closely resembles real-world conditions. The experimental results demonstrate the impact of key external factors on stock market trading, including trading behavior and stock price fluctuation rules. This research explores the study of agents' free trading gaps in the context of no prior knowledge related to market data. The patterns identified through StockAgent simulations provide valuable insights for LLM-based investment advice and stock recommendation. The code is available at https://github.com/MingyuJ666/Stockagent.

Suggested Citation

  • Chong Zhang & Xinyi Liu & Zhongmou Zhang & Mingyu Jin & Lingyao Li & Zhenting Wang & Wenyue Hua & Dong Shu & Suiyuan Zhu & Xiaobo Jin & Sujian Li & Mengnan Du & Yongfeng Zhang, 2024. "When AI Meets Finance (StockAgent): Large Language Model-based Stock Trading in Simulated Real-world Environments," Papers 2407.18957, arXiv.org, revised Jun 2026.
  • Handle: RePEc:arx:papers:2407.18957
    as

    Download full text from publisher

    File URL: https://arxiv.org/pdf/2407.18957
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Herbert A. Simon, 1955. "A Behavioral Model of Rational Choice," The Quarterly Journal of Economics, President and Fellows of Harvard College, vol. 69(1), pages 99-118.
    2. Tiwari, Aviral Kumar & Abakah, Emmanuel Joel Aikins & Bonsu, Christiana Osei & Karikari, Nana Kwasi & Hammoudeh, Shawkat, 2022. "The effects of public sentiments and feelings on stock market behavior: Evidence from Australia," Journal of Economic Behavior & Organization, Elsevier, vol. 193(C), pages 443-472.
    3. Sean D. Campbell, 2005. "A review of backtesting and backtesting procedures," Finance and Economics Discussion Series 2005-21, Board of Governors of the Federal Reserve System (U.S.).
    4. Alok Kumar, 2009. "Who Gambles in the Stock Market?," Journal of Finance, American Finance Association, vol. 64(4), pages 1889-1933, August.
    5. Danso, Albert & Adomako, Samuel & Lartey, Theophilus & Amankwah-Amoah, Joseph & Owusu-Yirenkyi, Diana, 2020. "Stakeholder integration, environmental sustainability orientation and financial performance," Journal of Business Research, Elsevier, vol. 119(C), pages 652-662.
    6. Daniel Kahneman & Amos Tversky, 2013. "Prospect Theory: An Analysis of Decision Under Risk," World Scientific Book Chapters, in: Leonard C MacLean & William T Ziemba (ed.), HANDBOOK OF THE FUNDAMENTALS OF FINANCIAL DECISION MAKING Part I, chapter 6, pages 99-127, World Scientific Publishing Co. Pte. Ltd..
    7. De Bondt, Werner F M & Thaler, Richard, 1985. "Does the Stock Market Overreact?," Journal of Finance, American Finance Association, vol. 40(3), pages 793-805, July.
    8. Svitlana Voronkova & Martin T. Bohl, 2005. "Institutional Traders' Behavior in an Emerging Stock Market: Empirical Evidence on Polish Pension Fund Investors," Journal of Business Finance & Accounting, Wiley Blackwell, vol. 32(7-8), pages 1537-1560.
    9. Alonso-Robisco, Andres & Carbó, José Manuel, 2023. "Analysis of CBDC narrative by central banks using large language models," Finance Research Letters, Elsevier, vol. 58(PC).
    10. Audrino, Francesco & Sigrist, Fabio & Ballinari, Daniele, 2020. "The impact of sentiment and attention measures on stock market volatility," International Journal of Forecasting, Elsevier, vol. 36(2), pages 334-357.
    11. Foucault, Thierry & Pagano, Marco & Roell, Ailsa, 2013. "Market Liquidity: Theory, Evidence, and Policy," OUP Catalogue, Oxford University Press, number 9780199936243.
    12. Svitlana Voronkova & Martin T. Bohl, 2005. "Institutional Traders’ Behavior in an Emerging Stock Market: Empirical Evidence on Polish Pension Fund Investors," Journal of Business Finance & Accounting, Wiley Blackwell, vol. 32(7‐8), pages 1537-1560, September.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Ryuji Hashimoto & Takehiro Takayanagi & Masahiro Suzuki & Kiyoshi Izumi, 2026. "LLM agents reveal how human bias shapes path-dependent market dynamics," Journal of Computational Social Science, Springer, vol. 9(2), pages 1-26, May.
    2. Antonino Castelli & Paolo Giudici & Alessandro Piergallini, 2025. "Building crypto portfolios with agentic AI," Papers 2507.20468, arXiv.org.
    3. Sedigheh Mahdavi & Jiating & Chen & Pradeep Kumar Joshi & Lina Huertas Guativa & Upmanyu Singh, 2025. "Integrating Large Language Models in Financial Investments and Market Analysis: A Survey," Papers 2507.01990, arXiv.org.
    4. Junyi Yao & Zihao Zheng, 2026. "Beyond Agent Architecture: Execution Assumptions and Reproducibility in LLM-Based Trading Systems," Papers 2606.08285, arXiv.org.
    5. Weilong Fu, 2025. "The New Quant: A Survey of Large Language Models in Financial Prediction and Trading," Papers 2510.05533, arXiv.org.
    6. Mostapha Benhenda, 2026. "Look-Ahead-Bench: a Standardized Benchmark of Look-ahead Bias in Point-in-Time LLMs for Finance," Papers 2601.13770, arXiv.org.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Ni, Yensen & Cheng, Yirung & Huang, Paoyu & Day, Min-Yuh, 2018. "Trading strategies in terms of continuous rising (falling) prices or continuous bullish (bearish) candlesticks emitted," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 501(C), pages 188-204.
    2. Itzhak Venezia, 2018. "Lecture Notes in Behavioral Finance," World Scientific Books, World Scientific Publishing Co. Pte. Ltd., number 10751.
    3. Stefano DellaVigna, 2009. "Psychology and Economics: Evidence from the Field," Journal of Economic Literature, American Economic Association, vol. 47(2), pages 315-372, June.
    4. Patrick Krieger & Carsten Lausberg, 2021. "Entscheidungen, Entscheidungsfindung und Entscheidungsunterstützung in der Immobilienwirtschaft: Eine systematische Literaturübersicht [Decisions, decision-making and decisions support systems in real estate: a systematic literature review]," Zeitschrift für Immobilienökonomie (German Journal of Real Estate Research), Springer;Gesellschaft für Immobilienwirtschaftliche Forschung e. V., vol. 7(1), pages 1-33, April.
    5. Puput Tri Komalasari & Marwan Asri & Bernardinus M. Purwanto & Bowo Setiyono, 2022. "Herding behaviour in the capital market: What do we know and what is next?," Management Review Quarterly, Springer, vol. 72(3), pages 745-787, September.
    6. Pan, Changchun & Song, Yuhang & Jin, Long, 2024. "Stock price spillovers from foreign institutional investor divestment: Evidence from BlackRock's closure of the China Flexible Equity Fund," International Review of Financial Analysis, Elsevier, vol. 96(PB).
    7. Zamri Ahmad & Haslindar Ibrahim & Jasman Tuyon, 2017. "Institutional investor behavioral biases: syntheses of theory and evidence," Management Research Review, Emerald Group Publishing Limited, vol. 40(5), pages 578-603, May.
    8. M. Rozina & М. Розина, 2019. "Теория и практика поведенческой экономики в процессе принятия финансовых решений // The Use of Theory and Methods of Behavioural Economics in the Process of Making Financial Decisions," Review of Business and Economics Studies // Review of Business and Economics Studies, Финансовый Университет // Financial University, vol. 7(3), pages 45-82.
    9. Daniele SCHILIRÒ, 2013. "Bounded Rationality: Psychology, Economics And The Financial Crises," Theoretical and Practical Research in the Economic Fields, ASERS Publishing, vol. 4(1), pages 97-108.
    10. Moatemri Ouarda & Abdelfatteh El Bouri & Olivero Bernard, 2013. "Herding Behavior under Markets Condition: Empirical Evidence on the European Financial Markets," International Journal of Economics and Financial Issues, Econjournals, vol. 3(1), pages 214-228.
    11. EOM, Cheoljun & EOM, Yunsung & PARK, Jong Won, 2024. "Intermediate cross-sectional prospect theory value in stock markets: A novel method," International Review of Financial Analysis, Elsevier, vol. 93(C).
    12. Gavriilidis, Konstantinos & Kallinterakis, Vasileios & Tsalavoutas, Ioannis, 2016. "Investor mood, herding and the Ramadan effect," Journal of Economic Behavior & Organization, Elsevier, vol. 132(S), pages 23-38.
    13. Daniel Fonseca Costa & Cláudia Cardoso Soares & Bruno César Melo Moreira & Adriano Olímpio Tonelli, 2025. "Construction and validation of an overconfidence scale in investment decisions," Future Business Journal, Springer, vol. 11(1), pages 1-15, December.
    14. Lane, David C. & Rouwette, Etiënne A.J.A., 2023. "Towards a behavioural system dynamics: Exploring its scope and delineating its promise," European Journal of Operational Research, Elsevier, vol. 306(2), pages 777-794.
    15. Daniele Schilirò, 2012. "Bounded Rationality And Perfect Rationality: Psychology Into Economics," Theoretical and Practical Research in the Economic Fields, ASERS Publishing, vol. 3(2), pages 99-108.
    16. George Obeng, 2019. "Behavioural Antecedents Complementing Classical Financial Models for Rational Decision Making," International Journal of Publication and Social Studies, Asian Economic and Social Society, vol. 4(2), pages 111-122, June.
    17. David Hirshleife, 2015. "Behavioral Finance," Annual Review of Financial Economics, Annual Reviews, vol. 7(1), pages 133-159, December.
    18. Goto, Shingo & Yamada, Toru, 2023. "What drives biased odds in sports betting markets: Bettors’ irrationality and the role of bookmakers," International Review of Economics & Finance, Elsevier, vol. 86(C), pages 252-270.
    19. Thomas Holtfort, 2019. "From standard to evolutionary finance: a literature survey," Management Review Quarterly, Springer, vol. 69(2), pages 207-232, June.
    20. Alasdair Brown & Fuyu Yang, 2017. "Salience and the Disposition Effect: Evidence from the Introduction of “Cash‐Outs” in Betting Markets," Southern Economic Journal, John Wiley & Sons, vol. 83(4), pages 1052-1073, April.

    More about this item

    NEP fields

    This paper has been announced in the following NEP Reports:

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2407.18957. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: https://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.