Skip to content

NalinDalal/hft-cpp

Repository files navigation

Here’s a powerful, no-fluff project list to impress HFT / trading firms — designed to hit all 3 pillars: C++, systems, and trading logic.


🚀 Ultimate Project List for HFT/Quant Interviews

Each of these projects should live in its own GitHub repo, with:

  • 🔹 A well-written README (overview, usage, benchmarks)
  • 🔹 Optimized C++17/20 code
  • 🔹 Makefile or CMakeLists.txt
  • 🔹 (Optional) perf or valgrind output logs to show profiling

🧠 Category 1: Systems & Performance

1. Lock-Free Queue

  • ✅ Multiple producer/consumer support
  • ✅ Based on circular buffer + atomic CAS
  • ✅ Compare against std::queue + mutex in benchmark

2. Memory Pool / Custom Allocator

  • ✅ Fixed-size allocator using malloc slabs
  • ✅ Compare speed vs new/delete
  • ✅ Optional: allocator reuse for object pool

3. SIMD String Search

  • ✅ Use AVX2 or SSE to speed up substring search
  • ✅ Compare vs std::strstr or std::string::find
  • ✅ Print time taken for large inputs (1GB+)

4. Fast LRU Cache

  • ✅ Use unordered_map + doubly linked list
  • ✅ O(1) access + eviction
  • ✅ Add performance graph for different workloads

💹 Category 2: Trading-Inspired Simulations

5. Order Book Simulator

  • ✅ Simulate limit/market orders
  • ✅ Maintain bid/ask books
  • ✅ FIFO matching engine
  • ✅ Optional: Add latency stats or multithreading

6. Market Data Feed Parser

  • ✅ Simulate real-time feed using stdin or file
  • ✅ Parse data in fixed-format binary or CSV
  • ✅ Track best bid/ask and top-of-book stats

7. Latency Benchmarking Tool

  • ✅ Measure round-trip time of TCP vs UDP packets
  • ✅ Plot latency histogram
  • ✅ Compare local vs remote IP

🧰 Category 3: CP Tooling / Templates

8. CP Template Toolkit

  • ✅ Pre-filled main.cpp with fast I/O, DSU, graph classes, etc.

  • ✅ Header-only snippets for:

    • Segment Tree
    • Binary Lifting
    • Trie
    • Bitmask DP
  • ✅ Add benchmarks (e.g. Segment Tree: 100K queries in X ms)

9. CP Problem Annotator

  • ✅ CLI tool: Parse problem links + log verdict/time
  • ✅ Store problem type (e.g. Graph, DP)
  • ✅ Export Markdown summary or leaderboard

🧪 Bonus Projects (for standout candidates)

10. Real-Time Trade Replay (HFT Emulation)

  • ✅ Load historical trades (e.g. CSV)
  • ✅ Replay ticks with accurate timing
  • ✅ Show PnL or execution stats

11. Bloom Filter Implementation

  • ✅ Simple + Scalable versions
  • ✅ Compare false positive rate vs hash count
  • ✅ Compare vs unordered_set

📝 README Must Contain:

Section Example
Overview “High-performance lock-free queue using ring buffer and atomic ops”
Build make / g++ -O3 -std=c++20
Benchmark “10M enqueues: Lock-free = 12ms, std::queue = 63ms”
References Papers, blog posts, STL source links

🔧 Tools You Should Use

  • g++ -O3 -std=c++20, clang++ for strict checking
  • valgrind, perf, gprof, time for benchmarks
  • Google Benchmark or Catch2 for unit testing
  • Doxygen for documenting advanced repos (optional)

⚙️ Advanced Systems / OS-Level Projects

12. High-Frequency Timer Wheel

  • Event scheduling with O(1) time complexity
  • Outperforms std::priority_queue for timer events
  • Use for scheduling order expiration or delayed actions

13. Multithreaded Logger with Batching

  • Lock-free circular buffer for log writes
  • Background thread flushes to disk every N ms
  • Supports log(level, msg) from multiple threads at 10M+ QPS

14. In-Memory Columnar Database

  • Create Column<T> types with SIMD scan/filter support
  • Benchmark queries like: select avg(price) where qty > 50
  • Use cache-aligned memory blocks

📈 Trading + Quant Inspired Projects

15. Limit Order Matching Engine (Concurrent Version)

  • Multithreaded engine with read/write locks
  • Match incoming orders against top-of-book
  • Use atomic queues for order ingestion

16. Volatility Estimator Tool

  • Given historical prices, compute:

    • Realized volatility
    • GARCH model prediction (optional Python/C++ hybrid)
  • Plot results using matplotlib-cpp or export to CSV

17. Simple Options Pricing Engine

  • C++ implementation of Black-Scholes
  • Add binary and European call/put options
  • CLI inputs: price, volatility, expiry

📊 Data Structures on Steroids

18. Cache-Optimized Segment Tree

  • Use flat array layout to minimize pointer chasing
  • Add benchmarks against classic segment tree
  • Optional: Add SIMD speedup for range queries

19. Compressed Trie (DAWG or Patricia Trie)

  • Memory-efficient structure for millions of strings
  • Compare against unordered_set<string> for speed and size
  • Application: fast ticker/ISIN search

20. Heavy Hitters (Count-Min Sketch)

  • Approximate frequency counter for streams
  • Use for estimating most traded stocks
  • Constant memory, logarithmic accuracy guarantees

🔄 Concurrency / Distributed Systems Projects

21. Mini Redis Clone (in C++)

  • In-memory KV store with pub/sub
  • Multi-client TCP support using epoll/select
  • Add optional LRU eviction

22. Zero-Copy Network Messaging

  • Design a messaging system with mmap/shared_memory
  • No serialization; direct memory buffers
  • Use for IPC between trading components

23. Distributed Ticker Aggregator

  • Simulate N data feeds
  • One aggregator merges & sorts ticks with timestamp alignment
  • Benchmark latency across data sources

📦 Bundle Recommendation: GitHub Repo Structure

📁 cpp-hft-projects/
├── README.md (index of all projects)
├── order-book-sim/
├── fast-lru-cache/
├── latency-benchmark/
├── black-scholes-pricer/
├── cp-templates/
├── zero-copy-messaging/
└── volatility-estimator/

🧠 BONUS: Ideas That Show Depth

Project Why It’s Impressive
Trading Log Replayer Understands market tick structure and replay logic
Real-Time Strategy Backtester Shows simulation skill and finance intuition
Cache-Aware Data Structures Shows CPU-level memory optimization
Concurrency-Safe Order Engine Demonstrates real-world production logic
Latency Analyzer CLI Tool Shows OS-level timing and benchmarking understanding

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors