IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2502.15757.html
   My bibliography  Save this paper

TLOB: A Novel Transformer Model with Dual Attention for Price Trend Prediction with Limit Order Book Data

Author

Listed:
  • Leonardo Berti
  • Gjergji Kasneci

Abstract

Price Trend Prediction (PTP) based on Limit Order Book (LOB) data is a fundamental challenge in financial markets. Despite advances in deep learning, existing models fail to generalize across different market conditions and assets. Surprisingly, by adapting a simple MLP-based architecture to LOB, we show that we surpass SoTA performance; thus, challenging the necessity of complex architectures. Unlike past work that shows robustness issues, we propose TLOB, a transformer-based model that uses a dual attention mechanism to capture spatial and temporal dependencies in LOB data. This allows it to adaptively focus on the market microstructure, making it particularly effective for longer-horizon predictions and volatile market conditions. We also introduce a new labeling method that improves on previous ones, removing the horizon bias. We evaluate TLOB's effectiveness across four horizons, using the established FI-2010 benchmark, a NASDAQ and a Bitcoin dataset. TLOB outperforms SoTA methods in every dataset and horizon. Additionally, we empirically show how stock price predictability has declined over time, -6.68 in F1-score, highlighting the growing market efficiency. Predictability must be considered in relation to transaction costs, so we experimented with defining trends using an average spread, reflecting the primary transaction cost. The resulting performance deterioration underscores the complexity of translating trend classification into profitable trading strategies. We argue that our work provides new insights into the evolving landscape of stock price trend prediction and sets a strong foundation for future advancements in financial AI. We release the code at https://github.com/LeonardoBerti00/TLOB.

Suggested Citation

  • Leonardo Berti & Gjergji Kasneci, 2025. "TLOB: A Novel Transformer Model with Dual Attention for Price Trend Prediction with Limit Order Book Data," Papers 2502.15757, arXiv.org, revised May 2025.
  • Handle: RePEc:arx:papers:2502.15757
    as

    Download full text from publisher

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

    References listed on IDEAS

    as
    1. Rama Cont & Arseniy Kukanov & Sasha Stoikov, 2014. "The Price Impact of Order Book Events," Journal of Financial Econometrics, Oxford University Press, vol. 12(1), pages 47-88.
    2. Jean-Philippe Bouchaud & Marc Mezard & Marc Potters, 2002. "Statistical properties of stock order books: empirical results and models," Science & Finance (CFM) working paper archive 0203511, Science & Finance, Capital Fund Management.
    3. Hanna Hultin & Henrik Hult & Alexandre Proutiere & Samuel Samama & Ala Tarighati, 2023. "A generative model of a limit order book using recurrent neural networks," Quantitative Finance, Taylor & Francis Journals, vol. 23(6), pages 931-958, June.
    4. Bossaerts, Peter & Hillion, Pierre, 1999. "Implementing Statistical Criteria to Select Return Forecasting Models: What Do We Learn?," The Review of Financial Studies, Society for Financial Studies, vol. 12(2), pages 405-428.
    5. Justin A. Sirignano, 2019. "Deep learning for limit order books," Quantitative Finance, Taylor & Francis Journals, vol. 19(4), pages 549-570, April.
    6. Jean-Philippe Bouchaud & Marc Mezard & Marc Potters, 2002. "Statistical properties of stock order books: empirical results and models," Quantitative Finance, Taylor & Francis Journals, vol. 2(4), pages 251-256.
    7. R. Cont, 2001. "Empirical properties of asset returns: stylized facts and statistical issues," Quantitative Finance, Taylor & Francis Journals, vol. 1(2), pages 223-236.
    Full references (including those not matched with items on IDEAS)

    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. Leonardo Berti & Bardh Prenkaj & Paola Velardi, 2025. "TRADES: Generating Realistic Market Simulations with Diffusion Models," Papers 2502.07071, arXiv.org, revised Feb 2025.
    2. Zijian Shi & John Cartlidge, 2024. "Neural stochastic agent‐based limit order book simulation with neural point process and diffusion probabilistic model," Intelligent Systems in Accounting, Finance and Management, John Wiley & Sons, Ltd., vol. 31(2), June.
    3. Zijian Shi & John Cartlidge, 2023. "Neural Stochastic Agent-Based Limit Order Book Simulation: A Hybrid Methodology," Papers 2303.00080, arXiv.org.
    4. Matthias Schnaubelt & Jonas Rende & Christopher Krauss, 2019. "Testing Stylized Facts of Bitcoin Limit Order Books," JRFM, MDPI, vol. 12(1), pages 1-30, February.
    5. Jean-Philippe Bouchaud & Julien Kockelkoren & Marc Potters, 2006. "Random walks, liquidity molasses and critical response in financial markets," Quantitative Finance, Taylor & Francis Journals, vol. 6(2), pages 115-123.
    6. Juan C. Henao-Londono & Sebastian M. Krause & Thomas Guhr, 2021. "Price response functions and spread impact in correlated financial markets," The European Physical Journal B: Condensed Matter and Complex Systems, Springer;EDP Sciences, vol. 94(4), pages 1-20, April.
    7. Lallouache, Mehdi & Abergel, Frédéric, 2014. "Tick size reduction and price clustering in a FX order book," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 416(C), pages 488-498.
    8. Wang, Yougui & Stanley, H.E., 2009. "Statistical approach to partial equilibrium analysis," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 388(7), pages 1173-1180.
    9. Gu, Gao-Feng & Chen, Wei & Zhou, Wei-Xing, 2008. "Empirical regularities of order placement in the Chinese stock market," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 387(13), pages 3173-3182.
    10. Sandrine Jacob Leal & Mauro Napoletano & Andrea Roventini & Giorgio Fagiolo, 2016. "Rock around the clock: An agent-based model of low- and high-frequency trading," Journal of Evolutionary Economics, Springer, vol. 26(1), pages 49-76, March.
    11. Svitlana Vyetrenko & David Byrd & Nick Petosa & Mahmoud Mahfouz & Danial Dervovic & Manuela Veloso & Tucker Hybinette Balch, 2019. "Get Real: Realism Metrics for Robust Limit Order Book Market Simulations," Papers 1912.04941, arXiv.org.
    12. Anirban Chakraborti & Ioane Muni Toke & Marco Patriarca & Frederic Abergel, 2011. "Econophysics review: I. Empirical facts," Quantitative Finance, Taylor & Francis Journals, vol. 11(7), pages 991-1012.
    13. repec:spo:wpmain:info:hdl:2441/f6h8764enu2lskk9p4oq9ig8k is not listed on IDEAS
    14. Martin D. Gould & Mason A. Porter & Stacy Williams & Mark McDonald & Daniel J. Fenn & Sam D. Howison, 2010. "Limit Order Books," Papers 1012.0349, arXiv.org, revised Apr 2013.
    15. Jovanovic, Franck & Mantegna, Rosario N. & Schinckus, Christophe, 2019. "When financial economics influences physics: The role of Econophysics," International Review of Financial Analysis, Elsevier, vol. 65(C).
    16. Korolev, V.Yu. & Chertok, A.V. & Korchagin, A.Yu. & Zeifman, A.I., 2015. "Modeling high-frequency order flow imbalance by functional limit theorems for two-sided risk processes," Applied Mathematics and Computation, Elsevier, vol. 253(C), pages 224-241.
    17. Hamza Bodor & Laurent Carlier, 2024. "Stylized Facts and Market Microstructure: An In-Depth Exploration of German Bond Futures Market," Papers 2401.10722, arXiv.org.
    18. Aaron Wheeler & Jeffrey D. Varner, 2023. "Scalable Agent-Based Modeling for Complex Financial Market Simulations," Papers 2312.14903, arXiv.org, revised Jan 2024.
    19. Thiago W. Alves & Ionut Florescu & George Calhoun & Dragos Bozdog, 2020. "SHIFT: A Highly Realistic Financial Market Simulation Platform," Papers 2002.11158, arXiv.org, revised Aug 2020.
    20. repec:hal:spmain:info:hdl:2441/f6h8764enu2lskk9p4oq9ig8k is not listed on IDEAS
    21. Jakob Albers & Mihai Cucuringu & Sam Howison & Alexander Y. Shestopaloff, 2021. "Fragmentation, Price Formation, and Cross-Impact in Bitcoin Markets," Papers 2108.09750, arXiv.org.
    22. Alexandru Mandes, 2014. "Order Placement in a Continuous Double Auction Agent Based Model," MAGKS Papers on Economics 201443, Philipps-Universität Marburg, Faculty of Business Administration and Economics, Department of Economics (Volkswirtschaftliche Abteilung).

    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:2502.15757. 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: http://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.