Top 10 considerations of High-Frequency Trading systems in C++
Ariel Silahian
Global Leader in Electronic Trading & High-Frequency Trading Systems | Hands-On Expertise & Executive Leadership in Market Infrastructure
- Data structures that are contained within a single cache-line are more efficient.
- Use appropriate containers (e.g. prefer reserved std::vector than std::list)
- Organize your data to avoid alignment holes (sorting your struct members by decreasing size is one way)
- Don’t neglect the cache in data structure and algorithm design
- Use smaller data types
- Beware of the standard dynamic memory allocator, which may introduce holes and spread your data around in memory as it warms up
- Make sure all adjacent data is actually used in the hot loops. Otherwise, consider breaking up data structures into hot and cold components, so that the hot loops use hot data.
- Avoid algorithms and datastructures that exhibit irregular access patterns, and favor linear datastructures.
- Know and exploit the implicit structure of data
ARIEL SILAHIAN
Secretaria, Gestora, AdministratiVa on line
8 年Use smaller data types Beware of the standard dynamic memory allocator, which may introduce holes and spread your data around in memory as it warms up Make sure all adjacent data is actually used in the hot loops. Otherwise, consider breaking up data structures into hot and cold components, so that the hot loops use hot data. Avoid algorithms and datastructures that exhibit irregular access patterns, and favor linear datastructures. Know and exploit the implicit structure of data ?
Inventor with Billions of Users | FPGA Design Expert | ULL HFT Developer
8 年For the last few hundred nanoseconds, use FPGAs.
Do you code trading platforms on JVM stack ? Java etc ?
Tim, don't give away all the secrets.
Assistant Portfolio Manager at Proprietary Trading Firm
8 年Nice suggestions; also I think the root of latency evil can come from STL & system function calls as they are slow from my profiling; for example, vector is slower than array because of wrapper and system time function call can cost you around 1 micro-second