Unified Quantitative Research & Trading Framework - Copyright protected
OmniQuant
Quantitative trading research & simulation platform โ a hybrid Python / Rust / TypeScript system for strategy research, alpha generation, backtesting, and execution simulation.
The platform includes a native Rust Order Management System with a BTreeMap limit-order book, ITCH 5.0 parser, and append-only event journal, bridged to a Python ML/alpha layer and a Next.js monitoring dashboard.
Disclaimer: This is a research and simulation platform. Do not deploy against live markets without independent validation, additional hardening, and proper regulatory compliance.
Architecture Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js / React Dashboard โ
โ (TypeScript ยท TanStack Query ยท Tailwind) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ FastAPI Gateway (REST + WebSocket) โ
โ /api/v1/backtest ยท /api/v1/portfolio ยท /ws/market_data โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Message Transport Layer โ
โ InMemory (default) | Aeron (opt-in) | Kafka (opt-in) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Rust Native OMS (oms-core ยท cdylib FFI) โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ Matching โ โ ITCH 5.0 โ โ Event โ โ Software Risk โ โ
โ โ Engine โ โ Parser โ โ Journal โ โ Gate (SW ref. โ โ
โ โ (BTreeMap) โ โ โ โ (WAL) โ โ implementation) โ โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Python Alpha & Research Layer โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ ML Alpha โ โ Strategies โ โ Portfolio โ โ Risk Engine โ โ
โ โ Models โ โ โ โ Optimizer โ โ โ โ
โ โ LSTM โ โ Momentum โ โ MVO / HRP โ โ 11 pre-trade โ โ
โ โ Transformerโ โ Mkt Making โ โ Risk Parityโ โ checks, kill โ โ
โ โ XGBoost โ โ StatArb โ โ BL / CVaR โ โ switch, drop โ โ
โ โ Ensemble โ โ RL (DQN) โ โ โ โ copy reconcil. โ โ
โ โ ARIMA-GARCHโ โ โ โ โ โ โ โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Feature Engineering ยท Timeseries DB (DuckDB) ยท Data Pipeline โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Infrastructure: Docker ยท Kubernetes ยท Prometheus โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
What's Implemented vs. Planned
The table below distinguishes working functionality from items that are planned / API-only.
| Component | Status | Notes | |---|---|---| | Rust OMS โ BTreeMap LOB, matching, BBO | โ
Working | native/oms-core | | Rust OMS โ ITCH 5.0 parser | โ
Working | 20 message types | | Rust OMS โ Append-only event journal | โ
Working | WAL + snapshots | | Rust OMS โ FPGA risk gate | โ ๏ธ Software reference | PCIe DMA integration planned | | Rust OMS โ DPDK / io_uring | ๐ฒ Planned | Feature-gated, not implemented | | Python โ Momentum strategy | โ
Working | Z-score, configurable thresholds | | Python โ Market Making (A-S framework) | โ
Working | Reservation price, order tracking | | Python โ Statistical Arbitrage | โ
Working | Pairs trading, spread Z-score | | Python โ RL agent (DQN) | โ ๏ธ Prototype | Random-env training; no real data loop | | ML โ LSTM, Transformer, XGBoost, Ensemble, ARIMA-GARCH | โ
Working | Training + prediction pipelines | | Portfolio โ MVO, HRP, Risk Parity, BL | โ
Working | src/portfolio/optimizer.py | | Risk Engine โ 11 pre-trade checks | โ
Working | src/riskops/riskengine.py | | Risk โ Drop copy reconciliation | โ
Working | src/risk_ops/ | | Execution โ TWAP, VWAP, POV, IS | โ
Working | Almgren-Chriss trajectory | | FIX Protocol โ 4.2/4.4/5.0SP2 | โ
Working | Session lifecycle, TCP+TLS | | Data Pipeline โ Yahoo Finance, CSV, synthetic | โ
Working | src/data_pipeline/ingestion.py | | Data Pipeline โ Alpaca connector | โ ๏ธ API skeleton | Requires alpaca-py + API key | | Data Pipeline โ Polygon connector | โ ๏ธ API skeleton | Requires websockets + API key | | Feature Engineering โ Technical, Microstructure, Causal | โ
Working | Transfer entropy, Granger causality | | Timeseries DB โ DuckDB backend | โ
Working | Tick/bar/book tables | | Timeseries DB โ ClickHouse backend | โ ๏ธ Needs clickhouse-driver | Code exists, dep not bundled | | Timeseries DB โ kdb+ / ArcticDB | ๐ฒ Planned | Enum defined, no implementation | | Feature Store โ Offline + Online | โ
Working | In-memory online store | | Alt Data โ FinBERT sentiment | โ ๏ธ Optional | Fallback to rule-based if no transformers | | Alt Data โ NewsAPI connector | โ
Working | Requires API key | | Alt Data โ SEC EDGAR connector | โ
Working | Full-text search API | | Alt Data โ Options flow | โ ๏ธ API skeleton | Needs a paid data provider | | Messaging โ InMemory transport | โ
Working | Default for dev/testing | | Messaging โ Aeron transport | โ ๏ธ Opt-in | Requires aeron-python โ raises on missing dep | | Messaging โ Kafka transport | โ ๏ธ Opt-in | Requires confluent-kafka โ raises on missing dep | | Serialization โ MsgPack, JSON | โ
Working | MsgPack is wire default | | Serialization โ Compact Binary | โ
Working | Custom offset-table format | | Serialization โ Protobuf | ๐ฒ Planned | Falls back to MsgPack | | Frontend โ Next.js dashboard | โ ๏ธ Minimal | Single page with basic tables | | Distributed โ Ray / Dask | โ ๏ธ Opt-in | Code exists, deps not bundled | | GPU Training โ DDP + Optuna | โ ๏ธ Opt-in | Requires multi-GPU PyTorch | | Docker / K8s / Prometheus | โ
Working | docker-compose.yml, k8s/ |
Legend: โ Working | โ ๏ธ Partial / needs optional deps | ๐ฒ Planned
Key Capabilities
Native Rust OMS (oms-core)
- BTreeMap limit order book with price-time priority matching and BBO tracking
- 10+ order types: Market, Limit, Stop, StopLimit, IOC, FOK, GTC, Iceberg, Peg, Trailing Stop
- ITCH 5.0 feed parser (20 message types) and OUCH 4.2 order entry protocol
- Append-only Event Journal with write-ahead semantics and snapshot replay
- Software risk gate that mirrors intended FPGA register semantics (PCIe DMA integration planned)
- Feature flags:
dpdk,io_uring,fpgaโ API surface defined, hardware integration not yet implemented - Release profile:
opt-level = 3, LTO, single codegen unit, abort-on-panic - Python bridge (
oms_bridge.py): ctypes FFI with nanosecond latency tracking; includes a pure-PythonReferenceOMSfallback
FIX Protocol Engine
- Full FIX 4.2 / 4.4 / 5.0SP2 session lifecycle: logon, logout, heartbeat, sequence number management, gap-fill recovery
- TCP + TLS transport with automatic reconnection
- NewOrderSingle, OrderCancelRequest, execution report callbacks
Execution Algorithms
- TWAP โ time-weighted slicing
- VWAP โ volume-weighted participation
- POV โ percentage of volume with cap
- Implementation Shortfall โ Almgren-Chriss optimal execution trajectory
- Adaptive Execution โ dynamic strategy selection based on urgency, volatility, liquidity
Pre-Trade Risk Engine
- 11 sequential fail-fast checks: Kill Switch, Position Limit, Order Size, Fat Finger, Order Rate, Cancel Rate, Daily Loss, Drawdown, Leverage, Sector Concentration, Single-Name Exposure
- Drop Copy Reconciliation: internal-vs-exchange fill matching, break detection, auto-resolution
ML Alpha Models
| Model | Framework | |---|---| | LSTM | PyTorch (bidirectional, 3 FC layers) | | Transformer | PyTorch (encoder-decoder, multi-head attention) | | Gradient Boosting | XGBoost / LightGBM / CatBoost | | Ensemble | scikit-learn (stacking, blending, weighted average) | | Statistical | statsmodels / arch (ARIMA-GARCH, Kalman Filter, cointegration) |Trading Strategies
- Momentum โ Z-score entry/exit with configurable thresholds and stop loss
- Market Making โ Avellaneda-Stoikov reservation price with inventory-aware skewing and EMA volatility
- Statistical Arbitrage โ Pairs trading with spread Z-score and dynamic hedge ratios
- Reinforcement Learning โ DQN with experience replay (prototype; environment uses synthetic data)
Data Platform
- Feature Store: point-in-time correct, streaming + batch + on-demand compute, dependency graph, TTL, versioning
- Timeseries DB: DuckDB (working), ClickHouse (code present, needs dep), kdb+/ArcticDB (planned)
- Data Reconciliation: gap/duplicate/outlier detection, cross-source reconciliation
Alternative Data
- Sentiment: FinBERT model when
transformersinstalled, rule-based fallback otherwise - NewsAPI connector: fetches articles via REST, computes sentiment per symbol
- SEC EDGAR connector: full-text search for 10-K/10-Q/8-K filings
- Options flow: detection framework in place, requires a paid data source to be useful
Messaging & Transport
- InMemory transport (default) โ zero-dependency, for development and testing
- Aeron shared-memory IPC โ opt-in, requires
aeron-python(raises on missing dep) - Kafka / Redpanda persistent streaming โ opt-in, requires
confluent-kafka(raises on missing dep) - Serialization: MsgPack (default), JSON, compact binary format
Dashboard
- Next.js 14 / React / TypeScript โ single-page dashboard with API integration
- Basic metric cards, positions table; charting components planned
Infrastructure
- Event Bus: sync + async pub/sub with priority levels, wildcard subscriptions
- Event Sourcing: 20+ event types, append-only journal with checksums, snapshots
- Security: JWT (HS256), bcrypt, API key management, Fernet encryption, rate limiting
- Monitoring: Prometheus metrics, health checks, alerting (Slack, email, PagerDuty)
- Docker / Kubernetes: multi-service compose, K8s deployment with HPA
Quick Start
Prerequisites
- Python 3.10+
- Rust toolchain (2021 Edition) & Cargo
- Node.js 18+ & npm
- Docker & Docker Compose
Installation
git clone https://github.com/yourusername/omniquant.git
cd omniquant
1. Python environment
python -m venv venv
Windows: venv\Scripts\activate
Linux/Mac: source venv/bin/activate
pip install -r requirements.txt
pip install -e .
2. Build the Rust native OMS (release profile: LTO + opt-level 3)
cd native/oms-core
cargo build --release
cd ../..
3. Frontend
cd frontend
npm install
cd ..
Run the System
# Full stack (API + Postgres + Redis)
docker-compose up -d
Or individually:
uvicorn src.api.main:app --reload # FastAPI backend
cd frontend && npm run dev # Next.js trading terminal
Run a Backtest
from src.strategies.momentum import MomentumStrategy
from src.simulator.event_simulator import EventSimulator, SimulationConfig
config = SimulationConfig(initialcapital=100000, commission_rate=0.0002) sim = EventSimulator(sim_config=config) strategy = MomentumStrategy(config={"lookbackperiod": 20, "entrythreshold": 2.0})
results = sim.run_backtest(strategy, symbol="SYNTH") print(f"Sharpe: {results['sharperatio']:.2f} Return: {results['totalreturn']:.2%}")
Kubernetes Deployment
kubectl apply -f k8s/deployment.yaml
Deploys to omniquant-prod namespace:
- 3 replicas (HPA scales 3โ10 on CPU/memory)
- 50Gi fast-SSD PVC
- LoadBalancer service (port 80 โ 8000, 9090 metrics)
- Liveness/readiness probes on /health
See docs/QUICKSTART.md for a full walkthrough.
Project Layout
native/
oms-core/ Rust OMS โ matching engine, ITCH/OUCH parser, event journal, FPGA stubs
frontend/ Next.js 14 / React / TypeScript trading terminal
src/
integration.py Top-level TradingSystem wiring (hot path + cold path)
cli.py Typer CLI (strategy scaffolding)
alpha_models/ LSTM, Transformer, XGBoost/LightGBM/CatBoost, Ensemble, ARIMA-GARCH
api/ FastAPI REST + WebSocket gateway (backtest jobs, portfolio, market data)
common/ Event Bus, Event Sourcing, Monitoring, Security, DI Container
data_pipeline/ Ingestion, Cleaning, Alignment (Arrow/Parquet)
data_platform/ Feature Store (streaming + batch), Timeseries DB, Data Reconciliation
execution/ TWAP/VWAP/POV/IS/Adaptive algos, FIX engine, ITCH/OUCH feed handlers, Rust bridge
feature_engineering/ Technical, Microstructure, Causal (DoWhy/EconML) features
messaging/ Aeron / Kafka / InMemory transport, MsgPack/FlatBuffer serialization
portfolio/ MVO, Risk Parity, HRP, Black-Litterman, CVaR optimization & risk management
research/ Distributed backtesting (Ray/Dask), GPU training (DDP/Optuna), alt data pipelines
risk_ops/ Pre-trade risk engine (11 checks), drop copy reconciliation
simulator/ Event-driven backtest engine, order book, matching engine, market impact models
strategies/ Momentum, Market Making, StatArb, RL agents (DQN)
k8s/ Kubernetes manifests (Deployment, HPA, PVC, Service)
configs/ YAML configuration (features, models, strategies, execution, risk)
notebooks/ Research notebooks
Technology Stack
| Layer | Technologies | |---|---| | Languages | Python 3.10+, Rust (2021 Edition), TypeScript 5.3 | | Native OMS | crossbeam, tokio, memmap2, quanta, ringbuf, prometheus | | ML / AI | PyTorch, Optuna (opt-in), XGBoost, LightGBM, CatBoost, scikit-learn, statsmodels, arch | | NLP | FinBERT via transformers (optional, rule-based fallback) | | Data | Pandas 2.0, Polars, Apache Arrow/Parquet, DuckDB (default TSDB) | | Messaging | InMemory (default), Aeron (opt-in), Kafka (opt-in); MsgPack, JSON | | Web | FastAPI, Next.js 14, React 18, TanStack Query, Tailwind CSS | | Infrastructure | Docker, Kubernetes, Prometheus | | Protocols | FIX 4.2/4.4/5.0SP2, ITCH 5.0, OUCH 4.2, WebSocket |
Development
# Python tests
pytest tests/ -v
Rust tests
cd native/oms-core && cargo test
Linting
make lint
Documentation
License
MIT โ see LICENSE.
Disclaimer
This software is provided for research and simulation purposes. Trading financial instruments involves substantial risk of loss. Past backtest performance does not guarantee future results. Do not deploy against live markets without independent validation, additional hardening, and compliance review. Use at your own risk.
Contact
https://www.linkedin.com/in/pushkar-kumar-vats/