Vision
ClyptQ’s engine will be rewritten in Rust with Python bindings via PyO3 — following the same architecture as PyTorch (C++/CUDA core, Python research interface). Builders write strategies in Python. The engine executes them at native speed. Goal: All PyTorch-equivalent functionality in Rust. Python does research. Rust does computation.Why Rust?
Current Bottlenecks (Python)
Target Architecture (Rust)
Rust vs Alternatives
Rust is the clear choice: memory safety without GC, zero-cost abstractions, and a proven track record in Python ecosystem tools (Polars, Ruff, Pydantic V2, cryptography).
Migration Strategy
Phase 1: Hot Path (TaggedArray + RollingBuffer)
Target: TBD (deferred — no Rust code written yet) The innermost loop — TaggedArray operations and buffer management — moves to Rust first.Phase 2: Graph Execution Engine
Target: TBD (depends on Phase 1 completion) TheStatefulGraph.on_tick() loop moves to Rust. Operators are still defined in Python, but the graph orchestration (buffer management, topological execution, input distribution) runs in Rust.
Phase 3: Built-in Operators in Rust
Target: TBD (depends on Phase 2 completion) Common operators (SMA, EMA, RSI, MACD, all 101 Alpha operators) get Rust implementations. Python definitions become thin wrappers.Phase 4: Order Matching & Risk Engine
Target: 2026 H2 The execution pipeline (intention → delta → order → fill) moves to Rust with zero-allocation order processing.Phase 5: Data I/O & Storage
Target: 2027 Parquet reading/writing and live data WebSocket handling in Rust. Usesarrow-rs for zero-copy Parquet I/O.
PyTorch Analogy
Key principle: Just as PyTorch lets ML researchers write Python while CUDA handles the heavy lifting, ClyptQ lets quant researchers write Python strategies while Rust handles tick-by-tick execution.

