Developing High Frequency Trading Systems: Learn how to implement high-frequency trading from scratch with C++ or Java basics
- Length: 305 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-07-11
- ISBN-10: 1803242817
- ISBN-13: 9781803242811
- Sales Rank: #285880 (See Top 100 Books)
Use your programming skills to create and optimize high-frequency trading systems in no time with Java, C++, and Python
Key Features
- Learn how to build high-frequency trading systems with ultra-low latency
- Understand the critical components of a trading system
- Optimize your systems with high-level programming techniques
Book Description
The world of trading markets is complex, but it can be made easier with technology. Sure, you know how to code, but where do you start? What programming language do you use? How do you solve the problem of latency? The Developing High-Frequency Trading Systems book answers all these questions.
This practical guide will help you navigate the fast-paced world of algorithmic trading and show you how to build a high-frequency trading system from complex technological components, supported by accurate data.
Starting off with an introduction to high-frequency trading, exchanges, and the critical components of a trading system, the book quickly moves on to the nitty-gritty of optimizing hardware and your operating system for low-latency trading, such as bypassing the kernel, memory allocation, and the danger of context switching. Monitoring your system’s performance is vital, so you’ll also get up to speed with logging and statistics.
As you move beyond the traditional high-frequency trading programming languages, such as C++ and Java, you’ll learn how to use Python to achieve high levels of performance. And what book on trading would be complete without diving into cryptocurrency?
By the end of this book, you’ll be ready to take on the markets with high-frequency trading systems.
What you will learn
- Understand the architecture of high-frequency trading systems
- Boost system performance to achieve the lowest possible latency
- Leverage the power of Python, C++, and Java to build your trading systems
- Bypass your kernel and optimize your operating system
- Use static analysis to improve code development
- Use C++ templates and Java multithreading for super-low latency
- Apply your knowledge to cryptocurrency trading
Who This Book Is For
This book is for software engineers, quantitative developers or researchers, and DevOps engineers who want to understand the technical side of high-frequency trading systems and the optimizations that are needed to get to ultra-low latency systems. Prior experience working with C++ and Java will help you grasp the topics covered in this book.
Developing High-Frequency Trading Systems Contributors About the authors About the reviewers Preface Who this book is for What this book covers To get the most out of this book Download the color images Conventions used Get in touch Share Your Thoughts Part 1: Trading Strategies, Trading Systems, and Exchanges Chapter 1: Fundamentals of a High-Frequency Trading System History of HFT The post-1930s era The modern era Why have HFT? What makes HFT so different from regular trading? Effect of dark pools Who trades HFT? What do I need to start an HFT? What are HFT strategies? Asset classes Liquidity Tick-by-tick data and data distribution Liquidity rebates Matching engine Market making Scalping Statistical arbitrage Latency arbitrage Impact of news Momentum ignition Rebate strategies Pinging Illegal activities Summary Chapter 2: The Critical Components of a Trading System Understanding the trading system Trading system architecture Gateways connecting to trading exchanges Making a trading system trade with exchanges Examining the API for communication Order book management Order book considerations Strategy making decisions on when to trade The OMS Critical components Non-critical components Command and control Services Summary Chapter 3: Understanding the Trading Exchange Dynamics Architecting a trading exchange for handling orders at a large scale History of trading exchanges Understanding features of an exchange Exchange architecture General order book and matching engine Best price scenario Partial fill scenario No match scenario Multiple orders with the same price Summary Part 2: How to Architect a High-Frequency Trading System Chapter 4: HFT System Foundations – From Hardware to OS Understanding HFT computers CPUs, from multi-processor to multi-core Main memory or RAM Shared memory I/O devices Using the OS for HFT systems User space and kernel space Process scheduling and CPU resource management Memory management Paged memory and page tables System calls Threading Interruption management The role of compilers Executable file formats Static versus dynamic linking Summary Chapter 5: Networking in Motion Understanding networking in HFT systems Learning about network conceptual models Network communications between systems in HFT Comprehending how switches work Important protocol concepts Using Ethernet for HFT communication Using IPv4 as a network layer UDP and TCP for the transport layer Designing financial protocols for HFT exchanges FIX protocol Interior networks versus exterior networks Understanding the packet life cycle Comprehending the packet life in the send/receive (TX/RX) path Software layer receiving the packet Monitoring the network Packet capture and analysis Valuing time distribution Time-synchronization services Summary Chapter 6: HFT Optimization – Architecture and Operating System Performance mental model Understanding context switches Types of context switches Why are context switches good Steps and operations involved in a context switch operation Why are context switches bad for HFT? Techniques to avoid or minimize context switches Building lock-free data structures When/why are locks needed (non-HFT applications) Types of synchronization mechanisms Problems and inefficiencies with using locks Pre-fetching and pre-allocating memory Memory hierarchy Pre-fetching based alternatives to boost performance Dynamic memory allocation Pre-allocation-based alternatives to dynamic memory allocation Summary Chapter 7: HFT Optimization – Logging, Performance, and Networking Comparing kernel space and user space What is kernel and user space? Investigating performance – kernel versus user space Using kernel bypass Understanding why kernel bypass is the alternative Presenting kernel bypass latencies Learning about memory-mapped files Using cable fiber, hollow fiber, and microwave technologies Evolution from cable fiber to hollow fiber to microwave How hollow fiber works How microwave works Diving into logging and statistics The need for logging in HFT The need for online/live statistics computation in HFT Measuring performance Motivation for measuring performance Linux tools for measuring performance Custom techniques for measuring performance Summary Part 3: Implementation of a High-Frequency Trading System Chapter 8: C++ – The Quest for Microsecond Latency C++ 14/17 memory model What is a memory model? The need for a memory model The C++ 11 memory model and its rules C++ memory model principles Removing runtime decisions Motivation for removing runtime decisions Virtual functions Performance penalties Dynamic memory allocation Runtime performance penalty Using constexpr efficiently Exceptions impeding performance Templates reducing the runtime What are templates? Template specialization Why use templates? Disadvantages of templates Performance of templates Standard Template Library (STL) Static analysis What is C++ static analysis? The need for static analysis Types of static analysis Steps in static analysis Benefits and drawbacks of static analysis Use case - Building an FX high-frequency trading system Summary Chapter 9: Java and JVM for Low-Latency Systems Introducing the basics of Java Reducing the impact of the GC What to do to keep GC events low and fast Warming up the JVM Tiered compilation in JVM Optimizing the JVM for better startup performance Measuring the performance of a Java software Why are Java microbenchmarks difficult to create? Real-time performance measures Java threading Using a thread pool/queue with threads High-performance task queue Queues Circular buffer LMAX disruptor Logging and DB access External or internal thread? Summary Chapter 10: Python – Interpreted but Open to High Performance Introducing Python Making use of Python for analytics Why is Python slow? How do we use libraries in Python? Python and C++ for HFT Using C++ in Python Using Python with C++ Boost.Python library Using ctypes/CFFI to accelerate Python code SWIG Improving the speed of Python code in HFT Summary Chapter 11: High-Frequency FPGA and Crypto Reducing latencies with FPGA Evolution of the fierce competition of speed in HFT Introduction to FPGA Diving into FPGA trading systems Advantages of FPGA trading systems Disadvantages of FPGA trading systems Final words on FPGAs Exploring HFT with cryptocurrencies What is crypto? How do crypto transactions work? What is a blockchain? What is cryptocurrency mining? Similarities between traditional asset trading and cryptocurrency trading Main differences between traditional asset trading and cryptocurrency trading Trading with cryptocurrency exchange HFT strategies in crypto Building a high-frequency system for crypto trading How to build a trading system in the cloud Summary Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Developing High Frequency Trading Systems: Learn how to implement high-frequency trading from scratch with C++ or Java basics
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.