Skip to main content

Exploiting Concurrency in Domain-Specific Data Structures: A Concurrent Order Book and Workload Generator for Online Trading

  • Conference paper
  • First Online:
Networked Systems (NETYS 2016)

Part of the book series: Lecture Notes in Computer Science ((LNCCN,volume 9944))

Included in the following conference series:

  • 626 Accesses

Abstract

Concurrent programming is essential to exploit parallel processing capabilities of modern multi-core CPUs. While there exist many languages and tools to simplify the development of concurrent programs, they are not always readily applicable to domain-specific problems that rely on complex shared data structures associated with various semantics (e.g., priorities or consistency). In this paper, we explore such a domain-specific application from the financial field, where a data structure—an order book—is used to store and match orders from buyers and sellers arriving at a high rate. This application has interesting characteristics as it exhibits some clear potential for parallelism, but at the same time it is relatively complex and must meet some strict guarantees, notably w.r.t. the ordering of operations. We first present an accurate yet slightly simplified description of the order book problem and describe the challenges in parallelizing it. We then introduce several approaches for introducing concurrency in the shared data structure, in increasing order of sophistication starting from lock-based techniques to partially lock-free designs. We propose a comprehensive workload generator for constructing histories of orders according to realistic models from the financial domain. We finally perform an evaluation and comparison of the different concurrent designs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    To avoid possible confusion with the word “order” used to designate trading requests and for prioritizing operations (arrival and processing order), we will only use it in the former sense and resort to alternative expressions for the latter.

  2. 2.

    We assume that this queue is thread-safe as processing threads may dequeue orders concurrently with one another and with the (unique) thread that enqueues incoming orders.

  3. 3.

    Some implementation details, such as avoiding a second traversal of the heap by keeping track of locked queues, are omitted for simplicity.

  4. 4.

    java.util.concurrent.ConcurrentSkipListMap.

  5. 5.

    While the algorithms do not use explicit locks, they are not completely “lock-free” as in some situations a thread may be blocked waiting for the status flag to be updated by another thread. Techniques based on “helping” could be used to avoid such situations, at the price of increased complexity in the algorithms. We therefore slightly abuse the word “lock-free” in the rest of the paper.

References

  1. Ende, B., Uhle, T., Weber, M.C.: The impact of a millisecond: measuring latency effects in securities trading. In: Wirtschaftsinformatik Proceedings, Paper 116 (2011)

    Google Scholar 

  2. WIRED: Raging bulls: how wall street got addicted to light-speed trading (2012). http://www.wired.com/2012/08/ff_wallstreet_trading/2/

  3. Leber, C., Geib, B., Litz, H.: High frequency trading acceleration using FPGAs. In: International Conference on Field Programmable Logic and Applications, FPL (2011)

    Google Scholar 

  4. Preis, T.: Ökonophysik - Die Physik des Finanzmarktes. Springer, Wiesbaden (2011)

    Book  Google Scholar 

  5. Maslov, S.: Simple model of a limit order-driven market. Phys. A Stat. Mech. Appl. 278(3), 571–578 (2000)

    Article  Google Scholar 

  6. Maslov, S., Mills, M.: Price fluctuations from the order book perspective - empirical facts and a simple model. Phys. A Stat. Mech. Appl. 299(1), 234–246 (2001)

    Article  MATH  Google Scholar 

  7. Lea, D.: Concurrent Programming in Java: Design Principles and Patterns. Addison-Wesley, Boston (1996)

    MATH  Google Scholar 

  8. Bartolozzi, M.: Price variations in a stock market with many agents. Eur. Phys. J. B 78(2), 265–273 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  9. Bak, P., Paczuski, M., Shubik, M.: Price variations in a stock market with many agents. Phys. A Stat. Mech. Appl. 246(3–4), 430–453 (1997)

    Article  Google Scholar 

  10. Gabaix, X.: Power laws in economics and finance, Technical report. National Bureau of Economic Research (2008)

    Google Scholar 

  11. Bouchaud, J.-P., Mézard, M., Potters, M.: Statistical properties of stock order books: empirical results and models. Quant. Finan. 2(4), 251–256 (2002)

    Article  Google Scholar 

  12. Khanna, K., Smith, M., Wu, D., Zhang, T.: Reconstructing the order book, Technical report. Stanford University (2009)

    Google Scholar 

  13. Singla, A., Chandrasekaran, B., Godfrey, P.B., Maggs, B.: The internet at the speed of light. In: 13th ACM Workshop on Hot Topics in Networks, HotNets (2014)

    Google Scholar 

  14. Thompson, M., Farley, D., Barker, M., Gee, P., Stewart, A.: Disruptor: high performance alternative to bounded queues for exchanging data between concurrent threads. White paper (2011). http://disruptor.googlecode.com/files/Disruptor-1.0.pdf

  15. Shetty, Y., Jayaswal, S.: The order-matching engine. In: Practical .NET for Financial Markets. Apress, pp. 41–103 (2006)

    Google Scholar 

  16. Huang, W., Lehalle, C.-A., Rosenbaum, M.: Simulating, analyzing order book data: the queue-reactive model. J. Am. Stat. Assoc. 110(509), 107–122 (2013)

    Article  MathSciNet  Google Scholar 

  17. Cont, R., Stoikov, S., Talreja, R.: A stochastic model for order book dynamics. J. Am. Stat. Assoc. 58(3), 549–563 (2010)

    MathSciNet  MATH  Google Scholar 

  18. Kercheval, A.N., Zhang, Y.: Modelling high-frequency limit order book dynamics with support vector machines. Quant. Financ. 15(8), 1315–1329 (2015)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Raphaël P. Barazzutti .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Barazzutti, R.P., Hayduk, Y., Felber, P., Rivière, E. (2016). Exploiting Concurrency in Domain-Specific Data Structures: A Concurrent Order Book and Workload Generator for Online Trading. In: Abdulla, P., Delporte-Gallet, C. (eds) Networked Systems. NETYS 2016. Lecture Notes in Computer Science(), vol 9944. Springer, Cham. https://doi.org/10.1007/978-3-319-46140-3_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-46140-3_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-46139-7

  • Online ISBN: 978-3-319-46140-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics