---
id: wiki-2026-0508-high-frequency-trading-models
title: High Frequency Trading Models
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [HFT, Algorithmic Trading, Market Making]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [hft, trading, latency, market-microstructure]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: cpp
  framework: kdb+/qpython
---

# High Frequency Trading Models

## 매 한 줄
> **"매 microsecond 매 alpha"**. HFT 매 nanosecond-scale latency 매 statistical arbitrage 의 결합 — 매 2026 quantum-resistant signature 매 co-located FPGA 매 standard. Renaissance, Citadel, Jump 매 dominant; 매 average holding period 매 sub-second.

## 매 핵심

### 매 latency hierarchy
- **L1 (sub-µs)**: FPGA tick-to-trade, kernel bypass NICs (Solarflare, Mellanox).
- **L2 (1-10µs)**: 매 C++ hot path, lock-free queues, busy-spin threads.
- **L3 (10-100µs)**: 매 Python/kdb+ 매 signal generation.
- **L4 (ms+)**: 매 ML inference (XGBoost, transformer order-flow).

### 매 strategy taxonomy
- **Market Making**: 매 bid-ask spread capture, inventory risk hedge.
- **Statistical Arbitrage**: 매 cointegration, mean reversion (Ornstein-Uhlenbeck).
- **Latency Arbitrage**: 매 venue-to-venue price lag exploit.
- **Order-Flow Prediction**: 매 LOB imbalance → micro-price drift.
- **Index Arbitrage**: 매 ETF NAV vs constituent basket.

### 매 응용
1. 매 NYSE/NASDAQ co-location.
2. 매 crypto MEV (Flashbots, Jito).
3. 매 forex ECN aggregation.

## 💻 패턴

### 1. Order Book Imbalance (LOB micro-price)
```python
def micro_price(bid_px, bid_sz, ask_px, ask_sz):
    # 매 imbalance-weighted mid — predicts 100ms drift
    imb = bid_sz / (bid_sz + ask_sz)
    return ask_px * (1 - imb) + bid_px * imb

# 매 signal: micro_price - mid_price → directional alpha
```

### 2. Cointegration Pair Trade (Engle-Granger)
```python
import statsmodels.api as sm
import numpy as np

def find_pairs(prices_a, prices_b):
    beta = sm.OLS(prices_a, sm.add_constant(prices_b)).fit().params[1]
    spread = prices_a - beta * prices_b
    adf = sm.tsa.adfuller(spread)
    return beta, adf[1]  # p-value < 0.05 → tradeable

# 매 entry: spread > 2σ, exit: spread → 0
```

### 3. Lock-Free Order Book (C++)
```cpp
struct Level { std::atomic<int64_t> qty; int64_t px; };
struct Book { Level bids[1024]; Level asks[1024]; };

void on_tick(Book& b, int side, int idx, int64_t qty) {
    // 매 single-writer SPMC — no mutex
    auto& lvl = (side == 0) ? b.bids[idx] : b.asks[idx];
    lvl.qty.store(qty, std::memory_order_release);
}
```

### 4. Kalman Filter Spread Tracking
```python
# 매 dynamic hedge ratio — beta drifts over time
from pykalman import KalmanFilter
kf = KalmanFilter(transition_matrices=[1], observation_matrices=[1],
                  initial_state_mean=0, initial_state_covariance=1,
                  observation_covariance=1, transition_covariance=0.01)
state_means, _ = kf.filter(spread_series)
```

### 5. FPGA Tick-to-Trade (Verilog sketch)
```verilog
// 매 200ns tick parse → order send
always @(posedge clk) begin
    if (md_valid && (bid_px > threshold)) begin
        ord_send <= 1; ord_px <= bid_px; ord_qty <= 100;
    end
end
```

### 6. Almgren-Chriss Optimal Execution
```python
def almgren_chriss(X, T, sigma, eta, gamma, lam):
    # 매 minimize: variance + market impact
    kappa = np.sqrt(lam * sigma**2 / eta)
    n_steps = int(T / dt)
    schedule = [X * np.sinh(kappa*(T-t)) / np.sinh(kappa*T) for t in times]
    return schedule  # 매 hyperbolic decay
```

### 7. ML Order-Flow (LightGBM)
```python
import lightgbm as lgb
features = ['lob_imb_1','lob_imb_5','vwap_dev','trade_intensity']
model = lgb.train({'objective':'regression','num_leaves':31},
                  lgb.Dataset(X[features], y_future_return),
                  num_boost_round=500)
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| Sub-µs critical | FPGA + kernel bypass |
| Stat arb medium freq | Python + kdb+ |
| Crypto MEV | Rust + Flashbots bundle |
| Backtest | vectorbt, Nautilus Trader |

**기본값**: C++ hot path + Python research, 매 co-location 매 essential.

## 🔗 Graph
- 부모: [[Operations-Research]] · [[Statistics]]
- 변형: [[Algorithmic Trading]] · [[Market Making]]
- 응용: [[Kalman-Filter-and-State-Tracking]] · [[Optimal-Control-Theory]]
- Adjacent: [[Stochastic-Processes]] · [[Signal-Processing-Foundations]]

## 🤖 LLM 활용
**언제**: research signal hypothesis 생성, 매 backtest code scaffolding, 매 strategy documentation.
**언제 X**: 매 production hot path (latency budget violated), 매 real-time risk decision.

## ❌ 안티패턴
- **Garbage Collection in Hot Path**: 매 Java/Python GC pause → 100µs jitter. 매 C++/Rust 사용.
- **Overfit Backtest**: 매 in-sample Sharpe 5 → live -2. 매 walk-forward + transaction cost.
- **No Inventory Limit**: 매 market-maker blow-up (Knight Capital 2012, $440M loss in 45min).
- **Survivorship Bias**: 매 delisted ticker 무시 → inflated returns.

## 🧪 검증 / 중복
- Verified (Aldridge, *High-Frequency Trading*; Cartea et al., *Algorithmic and HFT*).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full FULL spec, 7 patterns + decision matrix |
