KEY: tq_sandbox_...
SANDBOX ACTIVE
AJ
Ajey
DESK SIM 01 MILLENNIUM / JANE STREET TIER-1 PROP DESK SANDBOX ENVIRONMENT ACTIVE

Institutional HFT StatArb Engine

Pairs Cointegration & Adaptive 2D Kalman Filter State-Space Execution

1. Provided Data Files & Candidate API Key

AUTHORIZED CREDENTIALS
YOUR SANDBOX API KEY ● Active · 10,000 req/min · Sub-Millisecond Gateway
API KEY: tq_sandbox_usr_9941a7bc81e3d042 Header: X-TQ-KEY: tq_sandbox_usr_9941a7bc81e3d042
Required Problem Datasets:
Click to download offline dataset files directly for your local research or sandbox buffer
LIVE DESK API ENDPOINTS TrainQuants High-Frequency Feed
GET https://api.trainquants.com/v1/marketdata/statarb/ticks?pair=BTCUSDT,ETHUSDT&resolution=100ms&limit=5000
WSS wss://stream.trainquants.com/ws/statarb-live-ticks Latency ≤ 12ms
// Click "Test Endpoint & Pull Sample Tick" above to inspect returned tick stream...

2. Detailed Strategy Description & Math Formulation

MILLENNIUM STATARB // TIER 1
PORTFOLIO MANAGER MANDATE: You are tasked with architecting and engineering an automated High-Frequency Statistical Arbitrage Engine for cross-exchange crypto pair assets (BTC/USDT and ETH/USDT). You must pull the API feed above, implement Kalman state filtering, apply strict Half-Kelly sizing, honor the 3% trailing drawdown limit, and match our official desk benchmark backtest results.

3. Strategy Entry & Exit Signals Brief

SIGNAL LOGIC SPECIFICATION

Your quantitative engine must continuously evaluate the incoming tick buffer and execute the following 4 deterministic trading states:

LONG ENTRY Z ≤ -2.00

Long Spread Under-Valuation

When the dynamic spread drops ≥ 2.0 standard deviations below mean, Asset A is undervalued relative to Asset B. Send Immediate-Or-Cancel (IOC) buy order for Asset A and sell order for β fraction of Asset B.

ACTION: BUY BTC / SELL β ETH
SHORT ENTRY Z ≥ +2.00

Short Spread Over-Valuation

When the dynamic spread rises ≥ 2.0 standard deviations above mean, Asset A is overvalued relative to Asset B. Send IOC sell order for Asset A and buy order for β fraction of Asset B.

ACTION: SELL BTC / BUY β ETH
TAKE PROFIT EXIT |Z| ≤ 0.35

Equilibrium Reversion Target

When the spread converges back to within 0.35 standard deviations of the Kalman center line, close both leg positions simultaneously to crystallize net arbitrage profit.

ACTION: FLATTEN BOTH LEGS TO CASH
STOP-LOSS / RISK TRIP |Z| > 3.80 OR DD ≥ 3%

Hard Risk Circuit Breaker

If spread diverges beyond 3.80 standard deviations (structural regime breakdown) or portfolio trailing drawdown breaches 3.0%, trigger emergency flat and halt execution.

ACTION: EMERGENCY CLOSE & LOCKOUT

4. Strategy Sample Signal Chart with Entry & Exit Markers

VISUAL EXECUTION BLUEPRINT
BTC/ETH Synthetic Spread Innovations & Execution Points INTERACTIVE SAMPLE
Buy Long Sell Short Target Exit Trigger Bands
DESK GROUND TRUTH BENCHMARK TARGET

Stats You Must Code & Match:

Your strategy implementation in the sandbox will be backtested against the provided dataset. Your code output must match our desk ground truth within ±2.50% tolerance.

Required Target Performance

Target Cumulative PnL +18.42% (+$18,420)
Target Sharpe Ratio 3.92
Max Trailing Drawdown ≤ -1.42%
Expected Win Rate 76.4% (42/55 Fills)
Target Executed Trades 55 Fills
Execution Latency Budget ≤ 0.18 ms
Allowable Variance Tolerance ± 2.50%

Solving Protocol Roadmap:

1. Ingest dataset using API key or downloaded file
2. Wire modular classes in System Architecture
3. Write strategy & risk logic in Code Studio
4. Run Backtester & match ground truth stats

Quantitative System Architecture Blueprint

Click any modular pipeline node below to inspect its input/output interface, mathematical formulation, and failover strategy.

6 MODULAR NODES
Data Ingestion State Estimation Signal Engine Risk Guard Execution Router

01. L2 Market Data Ingestion Feed

Binance WebSocket depth20@100ms • Zero-copy ring buffer parsing

0.02ms ACTIVE

02. Cointegration & Residual Engine

Engle-Granger Two-Step • Augmented Dickey-Fuller stationarity check

0.04ms ACTIVE

03. Adaptive Kalman State Estimator

Recursive 2D state-space model • Dynamic βt slope & innovation error

0.05ms ACTIVE

04. Normalized Z-Score Signal Generator

Rolling Welford variance • Entry threshold |Z| ≥ 2.0 • Mean exit |Z| ≤ 0.35

0.03ms ACTIVE

05. Millennium Mandate Drawdown Guard

3.0% trailing drawdown circuit breaker • Half-Kelly position sizing

0.03ms ACTIVE

06. Smart Order Router & L2 Book Matcher

Immediate-or-Cancel limit order routing • Queue position & slippage penalty

0.05ms ACTIVE
ARCHITECTURE NODE INSPECTOR

03. Adaptive Kalman State Estimator

DATA INPUT INTERFACE
Sequential tick pair prices [P_BTC, P_ETH], process noise Q, measurement noise R
DATA OUTPUT INTERFACE
Dynamic state vector theta_t = [beta_t, alpha_t], innovation error e_t
LATENCY BUDGET
0.05ms latency budget (2x2 recursive matrix update)
MATHEMATICAL FORMULATION K_t = P_{t|t-1} F_t^T (F_t P_{t|t-1} F_t^T + R)^{-1}; \theta_t = \theta_{t|t-1} + K_t e_t
PYTHON SIGNATURE
def step(self, px_a, px_b): ...
FAILOVER & EXCEPTION RECOVERY
Covariance matrix clamping prevents divergence or numeric underflow during extreme volatility.
SYSTEM MODULES (5)
Candidate Sandbox: Implement all TODO blocks in your code. You can switch to Reference Solution anytime to verify the institutional ground truth implementation.
01_api_client.py Python 3.11 WASM
AUTOMATED TEST SUITE & BENCHMARK CONSOLE PYODIDE WASM ENGINE // SANDBOX READY
Ready to compile and test your sandbox code against live provided API market data...
Editing enabled: Type code directly or click "Reference Solution" to see the desk gold standard.
CORE USP AUDIT

Institutional Backtest Result Matcher

Evaluating your sandbox strategy implementation against the proprietary desk benchmark on the provided 5,000-tick historical API dataset.

98.9% MATCH // BENCHMARK VERIFIED
REGIME:
Your Sandbox Strategy
Desk Benchmark Target
TOLERANCE: ≤ ±2.5%

Backtest Performance Concurrence Audit

Dataset: 5,000 High-Frequency Ticks • Capital: $100,000 USD
Performance Metric Desk Benchmark Target Your Strategy Result Variance (Δ) Audit Status
Cumulative Net PnL +18.42% (+$18,420) +18.15% (+$18,150) Δ -0.27% MATCHED (98.5%)
Annualized Sharpe Ratio 3.92 3.89 Δ -0.03 MATCHED (99.2%)
Max Trailing Drawdown -1.42% (≤ 3.0% Guard) -1.45% Δ -0.03% COMPLIANT (< 3.0%)
Win Rate 76.4% 75.9% Δ -0.5% MATCHED (99.3%)
Total Pair Fills 55 Round-Trips 54 Round-Trips Δ -1 Fill MATCHED (98.2%)
Mean Execution Latency ≤ 0.25 ms 0.18 ms Δ -0.07 ms PASSED (FASTER)
Millennium Drawdown Invariant 0 Hard Violations 0 Violations 0 100% COMPLIANT
YOUR STRATEGY PNL +$18,150 Target: +$18,420 (±0.27%)
ANNUALIZED SHARPE 3.89 Target: 3.92 (99.2% Concurrence)
MAX DRAWDOWN -1.45% Hard Ceiling: 3.00%
WIN RATE 75.9% 41 of 54 pair round-trips
CORRELATION TO BENCHMARK 0.994 Near-perfect curve track
LIVE SPREAD OSCILLATOR & DUAL EQUITY CURVE 60 FPS TICK ENGINE
THRESHOLD: ±2.0σ
SPREAD Z-SCORE: -0.42σ
LIVE ORDER BLOTTER 54 Fills
BUY SPREAD BTC $64,210.5 +$320.40
SHORT SPREAD BTC $64,285.0 +$180.20
BUY SPREAD BTC $64,195.0 +$240.80
SHORT SPREAD BTC $64,310.2 +$195.00

SYSTEM ARCHITECT COMPETENCY AUDIT: BENCHMARK MATCHED (98.9%)

Your end-to-end HFT StatArb engine meets all institutional requirements. Provided API ticks parsed cleanly, Kalman filter state dynamics converged within 38 ticks, and backtest results matched the Millennium desk ground truth with zero drawdown breaches.