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

C++ Design Patterns for Low-latency Applications Including High-frequency Trading

Author

Listed:
  • Paul Bilokon
  • Burak Gunduz

Abstract

This work aims to bridge the existing knowledge gap in the optimisation of latency-critical code, specifically focusing on high-frequency trading (HFT) systems. The research culminates in three main contributions: the creation of a Low-Latency Programming Repository, the optimisation of a market-neutral statistical arbitrage pairs trading strategy, and the implementation of the Disruptor pattern in C++. The repository serves as a practical guide and is enriched with rigorous statistical benchmarking, while the trading strategy optimisation led to substantial improvements in speed and profitability. The Disruptor pattern showcased significant performance enhancement over traditional queuing methods. Evaluation metrics include speed, cache utilisation, and statistical significance, among others. Techniques like Cache Warming and Constexpr showed the most significant gains in latency reduction. Future directions involve expanding the repository, testing the optimised trading algorithm in a live trading environment, and integrating the Disruptor pattern with the trading algorithm for comprehensive system benchmarking. The work is oriented towards academics and industry practitioners seeking to improve performance in latency-sensitive applications.

Suggested Citation

  • Paul Bilokon & Burak Gunduz, 2023. "C++ Design Patterns for Low-latency Applications Including High-frequency Trading," Papers 2309.04259, arXiv.org.
  • Handle: RePEc:arx:papers:2309.04259
    as

    Download full text from publisher

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

    References listed on IDEAS

    as
    1. Baron, Matthew & Brogaard, Jonathan & Hagströmer, Björn & Kirilenko, Andrei, 2019. "Risk and Return in High-Frequency Trading," Journal of Financial and Quantitative Analysis, Cambridge University Press, vol. 54(3), pages 993-1024, June.
    2. Engle, Robert & Granger, Clive, 2015. "Co-integration and error correction: Representation, estimation, and testing," Applied Econometrics, Russian Presidential Academy of National Economy and Public Administration (RANEPA), vol. 39(3), pages 106-135.
    3. Evan Gatev & William N. Goetzmann & K. Geert Rouwenhorst, 2006. "Pairs Trading: Performance of a Relative-Value Arbitrage Rule," The Review of Financial Studies, Society for Financial Studies, vol. 19(3), pages 797-827.
    4. Graeme D. Ruxton & Guy Beauchamp, 2008. "Time for some a priori thinking about post hoc testing," Behavioral Ecology, International Society for Behavioral Ecology, vol. 19(3), pages 690-693.
    5. Álvaro Cartea & José Penalva, 2012. "Where is the Value in High Frequency Trading?," Quarterly Journal of Finance (QJF), World Scientific Publishing Co. Pte. Ltd., vol. 2(03), pages 1-46.
    6. Marco Avellaneda & Jeong-Hyun Lee, 2010. "Statistical arbitrage in the US equities market," Quantitative Finance, Taylor & Francis Journals, vol. 10(7), pages 761-782.
    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. Boming Ning & Kiseop Lee, 2024. "Advanced Statistical Arbitrage with Reinforcement Learning," Papers 2403.12180, arXiv.org.
    2. Flori, Andrea & Regoli, Daniele, 2021. "Revealing Pairs-trading opportunities with long short-term memory networks," European Journal of Operational Research, Elsevier, vol. 295(2), pages 772-791.
    3. Ziping Zhao & Rui Zhou & Zhongju Wang & Daniel P. Palomar, 2018. "Optimal Portfolio Design for Statistical Arbitrage in Finance," Papers 1803.02974, arXiv.org.
    4. Guglielmo Maria Caporale & Luis Gil-Alana & Alex Plastun, 2017. "Searching for Inefficiencies in Exchange Rate Dynamics," Computational Economics, Springer;Society for Computational Economics, vol. 49(3), pages 405-432, March.
    5. Kasper Johansson & Thomas Schmelzer & Stephen Boyd, 2024. "Finding Moving-Band Statistical Arbitrages via Convex-Concave Optimization," Papers 2402.08108, arXiv.org.
    6. Boming Ning & Prakash Chakraborty & Kiseop Lee, 2023. "Optimal Entry and Exit with Signature in Statistical Arbitrage," Papers 2309.16008, arXiv.org, revised Mar 2024.
    7. Krauss, Christopher, 2015. "Statistical arbitrage pairs trading strategies: Review and outlook," FAU Discussion Papers in Economics 09/2015, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    8. Clegg, Matthew & Krauss, Christopher, 2016. "Pairs trading with partial cointegration," FAU Discussion Papers in Economics 05/2016, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    9. Tim Leung & Xin Li, 2015. "Optimal Mean Reversion Trading With Transaction Costs And Stop-Loss Exit," International Journal of Theoretical and Applied Finance (IJTAF), World Scientific Publishing Co. Pte. Ltd., vol. 18(03), pages 1-31.
    10. Law, K.F. & Li, W.K. & Yu, Philip L.H., 2018. "A single-stage approach for cointegration-based pairs trading," Finance Research Letters, Elsevier, vol. 26(C), pages 177-184.
    11. Matthew Clegg & Christopher Krauss, 2018. "Pairs trading with partial cointegration," Quantitative Finance, Taylor & Francis Journals, vol. 18(1), pages 121-138, January.
    12. Ziping Zhao & Daniel P. Palomar, 2017. "Mean-Reverting Portfolio Design with Budget Constraint," Papers 1701.05016, arXiv.org.
    13. Viviana Fanelli & Claudio Fontana & Francesco Rotondi, 2023. "A hidden Markov model for statistical arbitrage in international crude oil futures markets," Papers 2309.00875, arXiv.org.
    14. Bahman Angoshtari, 2016. "On the Market-Neutrality of Optimal Pairs-Trading Strategies," Papers 1608.08268, arXiv.org.
    15. Han, Chulwoo & He, Zhaodong & Toh, Alenson Jun Wei, 2023. "Pairs trading via unsupervised learning," European Journal of Operational Research, Elsevier, vol. 307(2), pages 929-947.
    16. Alessia Naccarato & Andrea Pierini & Giovanna Ferraro, 2021. "Markowitz portfolio optimization through pairs trading cointegrated strategy in long-term investment," Annals of Operations Research, Springer, vol. 299(1), pages 81-99, April.
    17. Khizar Qureshi & Tauhid Zaman, 2024. "Pairs Trading Using a Novel Graphical Matching Approach," Papers 2403.07998, arXiv.org.
    18. Bo Liu & Lo-Bin Chang & Hélyette Geman, 2017. "Intraday pairs trading strategies on high frequency data: the case of oil companies," Quantitative Finance, Taylor & Francis Journals, vol. 17(1), pages 87-100, January.
    19. Emmanouil Mavrakis & Christos Alexakis, 2018. "Statistical Arbitrage Strategies under Different Market Conditions: The Case of the Greek Banking Sector," Journal of Emerging Market Finance, Institute for Financial Management and Research, vol. 17(2), pages 159-185, August.
    20. Bruno Breyer Caldas & João Frois Caldeira & Guilherme Vale Moura, 2016. "Is Pairs Trading Performance Sensitive To The Methodologies?: A Comparison," Anais do XLII Encontro Nacional de Economia [Proceedings of the 42nd Brazilian Economics Meeting] 130, ANPEC - Associação Nacional dos Centros de Pós-Graduação em Economia [Brazilian Association of Graduate Programs in Economics].

    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:2309.04259. 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.