Quant Trading Systems: Architecture & Infrastructure › Software and Hardware Considerations
Quantitative FinanceAll chapters Quant Trading Systems: Architecture & Infrastructure › Software and Hardware ConsiderationsOne section · Sections in this chapter8 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The choice of programming languages and hardware depends critically on your strategy's latency requirements. Different components of the trading system have different performance needs, and understanding these differences allows you to allocate engineering resources effectively.
The fundamental insight is that most code in a trading system is not performance-critical. Most supporting functions can be slow without affecting trading performance. The performance-critical path, from receiving market data to sending orders, is typically a small fraction of the codebase. Optimizing this critical path while using convenient, productive tools elsewhere is the hallmark of well-designed trading systems.
Language Selection by Component
Professional trading systems typically use multiple languages, each chosen for its strengths in particular roles:
Python dominates research and strategy development due to its rich ecosystem (pandas, numpy, scikit-learn) and rapid prototyping capability. For strategies with holding periods of hours or longer, Python is often sufficient for production execution as well. The language's readability and extensive libraries make it ideal for the exploratory, iterative nature of strategy research. When a new idea can be tested in an afternoon rather than a week, you can explore more ideas and find better strategies.
C++ is the standard for latency-critical components. Order routing, market data processing, and execution engines at HFT firms are written in C++ (or increasingly, Rust) to achieve microsecond response times. C++ offers direct memory control, cache optimization, and deterministic performance. The language allows programmers to reason precisely about what the hardware is doing, which is essential when microseconds matter. However, C++ development is significantly slower than Python, so it's reserved for components where performance truly justifies the development cost.
Java sits between Python and C++; it has better performance than Python while maintaining memory safety and cross-platform compatibility. Many large banks and asset managers use Java for their trading infrastructure. Java's garbage collector can introduce latency spikes, but careful tuning can minimize these pauses. The language's mature ecosystem, strong typing, and extensive tooling make it attractive for large, long-lived codebases.

Latency Considerations
Latency, the time between receiving market data and having your order arrive at the exchange, determines viability for certain strategies. Understanding the components of latency helps you identify where optimization effort will yield the greatest benefit.
The components of latency include:
- Network latency: Time for data to travel over wires (speed of light in fiber imposes a floor of approximately 5 microseconds per kilometer)
- Processing latency: Time to process market data and make decisions
- Serialization latency: Time to encode orders into FIX or binary protocols
Each component can be optimized, but the costs and complexity increase dramatically as you push toward lower latencies. Network latency can be reduced by moving closer to the exchange. Processing latency can be reduced by using faster languages and more efficient algorithms. Serialization latency can be reduced by using binary protocols instead of text-based formats like FIX.
# Latency budget analysis for different strategy types
latency_budgets = {
"HFT Market Making": {
"target_total_us": 10, # microseconds
"network_us": 2,
"processing_us": 5,
"serialization_us": 1,
"buffer_us": 2,
"typical_language": "C++/FPGA",
"infrastructure": "Co-located servers, direct feeds",
},
"Statistical Arbitrage": {
"target_total_us": 1000, # 1 millisecond
"network_us": 100,
"processing_us": 700,
"serialization_us": 50,
"buffer_us": 150,
"typical_language": "C++/Java",
"infrastructure": "Low-latency data center",
},
"Intraday Momentum": {
"target_total_us": 100000, # 100 milliseconds
"network_us": 5000,
"processing_us": 80000,
"serialization_us": 1000,
"buffer_us": 14000,
"typical_language": "Python/Java",
"infrastructure": "Cloud or standard data center",
},
"Daily Rebalancing": {
"target_total_us": 60000000, # 60 seconds
"network_us": 50000,
"processing_us": 59000000,
"serialization_us": 10000,
"buffer_us": 940000,
"typical_language": "Python",
"infrastructure": "Any",
},
}
budget_summary = []
for strategy, budget in latency_budgets.items():
total = budget["target_total_us"]
if total >= 1000000:
total_str = f"{total / 1000000:.0f} seconds"
elif total >= 1000:
total_str = f"{total / 1000:.0f} ms"
else:
total_str = f"{total} μs"
budget_summary.append(
{
"strategy": strategy,
"total_str": total_str,
"language": budget["typical_language"],
"infrastructure": budget["infrastructure"],
}
)Latency Budget Analysis by Strategy Type ================================================================================ HFT Market Making Target latency: 10 μs Language: C++/FPGA Infrastructure: Co-located servers, direct feeds Statistical Arbitrage Target latency: 1 ms Language: C++/Java Infrastructure: Low-latency data center Intraday Momentum Target latency: 100 ms Language: Python/Java Infrastructure: Cloud or standard data center Daily Rebalancing Target latency: 60 seconds Language: Python Infrastructure: Any

The table highlights how latency requirements scale from microseconds for HFT to seconds for daily rebalancing, dictating the necessary choice of language and infrastructure. A daily rebalancing strategy has no reason to invest in co-location or C++ development; the execution quality benefit would be negligible. Conversely, an HFT market-making strategy cannot function without these investments.
Hardware Optimization
For strategies where microseconds matter, hardware optimization becomes essential. The software-only optimizations described above eventually hit physical limits, and further improvement requires specialized hardware.
Co-location places your servers physically in the exchange's data center, minimizing network latency. The distance from your server to the exchange's matching engine can be measured in meters. Co-location providers offer rack space in the same building as the exchange, with cross-connects measured in nanoseconds rather than milliseconds. The cost is substantial, but for latency-sensitive strategies, co-location is a prerequisite for competition.
FPGA (Field Programmable Gate Arrays) implement trading logic directly in hardware, achieving sub-microsecond processing times. FPGAs are reprogrammable, allowing updates without manufacturing new chips. Unlike CPUs that execute instructions sequentially, FPGAs can process multiple data paths simultaneously, eliminating the pipeline stalls and cache misses that limit software performance. The tradeoff is development complexity: FPGA programming requires specialized skills and significantly longer development cycles.
Microwave and laser links transmit data between data centers faster than fiber optic cables. The straight-line microwave path between Chicago (CME) and New Jersey (NYSE/NASDAQ) is faster than any fiber route. These links exploit the fact that electromagnetic waves travel faster through air than through glass fiber, and that straight-line paths are shorter than the routes fiber must take around obstacles.
# Speed of light calculation for different media
speed_of_light_vacuum = 299792458 # meters per second
fiber_refractive_index = 1.47 # Light slows down in fiber
microwave_speed = speed_of_light_vacuum * 0.99 # Nearly vacuum speed
# Chicago to New Jersey distances
fiber_distance_km = 1200 # Typical fiber route (not straight line)
straight_line_km = 1140 # Approximate straight line
# Calculate one-way latency
fiber_latency_ms = (
(fiber_distance_km * 1000)
/ (speed_of_light_vacuum / fiber_refractive_index)
* 1000
)
microwave_latency_ms = (straight_line_km * 1000) / microwave_speed * 1000
advantage_ms = fiber_latency_ms - microwave_latency_ms
advantage_us = advantage_ms * 1000Chicago to New Jersey Latency Comparison --------------------------------------------- Fiber optic (1,200 km route): 5.88 ms one-way Microwave (1,140 km direct): 3.84 ms one-way Microwave advantage: 2.04 ms Microwave advantage (μs): 2,043 μs
In HFT terms, the calculated advantage of over 2,000 microseconds can determine who captures an arbitrage opportunity. When two traders see the same price discrepancy, the one whose signal arrives first and whose order reaches the exchange first captures the profit. A 2-millisecond advantage is an eternity in this context.
For most quantitative strategies, even many that trade intraday, these extreme optimizations are unnecessary. The strategies where microseconds matter (market making, latency arbitrage) represent a small fraction of quantitative trading. As we discussed in the High-Frequency Trading chapter, competing on latency requires substantial infrastructure investment and increasingly yields diminishing returns as the field matures.