Production

Trade-Matrix MVP

Institutional-Grade Cryptocurrency Algorithmic Trading Platform

"Combining traditional quantitative finance with modern ML/RL techniques, inspired by Renaissance Technologies and Two Sigma patterns."

Jan 2025 - Present
12 min read

The Goal

The core goal of the Trade‑Matrix MVP is to adopt ML/RL/DL‑based algorithmic trading models within a Rust‑based, high‑performance data‑processing and execution system (capable of handling tick data), while providing a Python‑friendly environment for model development and testing, such as Jupyter Notebook.

The Solution

Trade-Matrix is a multi-modal trading system integrating OHLCV data, on-chain metrics, and sentiment analysis. It uses Transfer Learning for signal prediction and Reinforcement Learning (SAC) for dynamic position sizing, with a 4-tier fallback cascade ensuring robust operation.

The Impact

Production-deployed since September 1, 2025, achieving sub-5ms inference latency, 413+ monitoring metrics, and $0/month automation cost through GitHub Actions optimization, while getting total return +44.15% from Sep 01, 2025 to Dec 25, 2025 on ByBit Demo account.

Performance at a Glance

Key metrics demonstrating production-grade performance and institutional quality.

$0.0/mo
Infra Automation
100% GitHub Actions via GHCR
<$0/mo
Cloud Cost
Azure VM (K3S) + VMSS
<0.0ms
ML Latency
Sub-millisecond signal generation
0+
Metrics
Real-time Prometheus monitoring
0%
Uptime
K3S self-healing orchestration
0min
Training Time
Weekly transfer learning cycle
0.0
Fallback Tiers
RL → Blended → Kelly → Flat
0.0+
Years Data
6,977+ 4H bars (2022-2025)
System Blueprints

Interactive Visualizations

Explore the engineering diagrams that power Trade-Matrix. Interact with the live architecture below or launch detailed blueprints.

Live System Architecture

System Architecture

DATACACHESTORAGEINTELLIGENCEEXECUTIONINFRASTRUCTURE4H OHLCVVVIXReal-timeHistoricalModelsRegistrySignalsPositionsOrdersStateMetricsQueryLogsBybitDATA SOURCESDeribit DVOLDATA SOURCESRedisCACHEPostgreSQLSTORAGEMinIOSTORAGEMLflowSTORAGEML InferenceINTELLIGENCERL Agent (SAC)INTELLIGENCENautilusTraderEXECUTIONPrometheusMONITORINGGrafanaMONITORINGLokiMONITORINGK3S ClusterINFRASTRUCTURE

Key Capabilities

Institutional-grade features powering the trading system.

Hybrid Cloud Architecture

Optimized hybrid workflow: Local Docker for dev/training (MLflow+MinIO) and Azure K3S for inference. Achieves <$50/mo production cost by deprecating heavy resource containers in prod.

  • Local: MLflow + MinIO + TimescaleDB for R&D
  • Prod: GHCR-only deployment (Base + Model images)
  • Storage: GitHub Container Registry for base images (6.24GB) + model artifacts (319MB)
  • Compute: VMSS for scalable inference resources

Resilient Model Loading System

Artifact-first 4-tier loading with automatic fallback. Models are immutable artifacts; MLflow provides metadata (nice-to-have, not critical).

Tier 1

Registered Model

MLflow Model Registry with aliases (@production, @champion)

Semantic model names, automatic artifact resolution, no run_id dependency

Tier 2

Run ID + Artifact

Load from MLflow run_id and artifact path

Development/testing use, requires MLflow database availability

Tier 3

Direct S3/MinIO

Bypass MLflow, load directly from S3 bucket

Disaster recovery: works even if MLflow DB is corrupted

Tier 4

Local Filesystem

Most resilient fallback from local model directory

models/ml/ directory, no external dependency required

Critical: Feature order validation (sklearn validates names AND order) • Zero-failure initialization across Docker, K3S, and Azure environments

3-Tier Warmup System with Data Persistence

Progressive warmup ensuring signal continuity across restarts.

Tier 1~100ms

Redis State Recovery

Fastest path: direct Redis restore when state is fresh (<4h old)

  • Direct Redis signal_state restore
  • PostgreSQL bar history load after restore
  • Validates age (<4h), correlation (>=0.95), completeness
Tier 2<50ms/bar

Gap Fill Recovery

Medium path: DB-first incremental computation when Redis is stale or DB has 200+ predictions

  • DB-first approach: checks ml_prediction_history before recomputing
  • Rebuilds EWMA from 200 DB predictions if Redis missing
  • Timestamp-based gap calculation (not count-based)
Tier 3~10-30s

Full Bootstrap

Cold start: full bootstrap from 1600 historical bars when no Redis and DB <200 predictions

  • 9-phase vectorized pipeline for efficiency
  • Quality gates: IC >= 0.05, p-value < 0.15, Sharpe > 0.5
  • NORMALIZE-first-THEN-update operation order (ERROR #148 fix)

Data Persistence Strategy

PostgreSQL
  • OHLCV historical data
  • ML predictions history
  • External data (VVIX, funding rates)
Redis DB2
  • Signal state (deque, IC, bootstrap)
  • EWMA statistics
  • Real-time prediction cache
State Sync Protocol
  • K3S → Local validation scripts
  • Signal parity checks
  • 90-second warmup protection

4-Tier Position Sizing Cascade

Graceful degradation from full RL autonomy to emergency flat positions. Tier 3 integrates MS-GARCH regime-adaptive Kelly fractions.

Tier 1

FULL_RL

100% RL position sizing

Confidence >= 0.50, IC >= 0.05

Tier 2

BLENDED

50% RL + 50% Kelly

Medium confidence/IC

Tier 3

PURE_KELLY

100% Kelly criterion with regime-adaptive fractions

Low confidence or IC failure

Tier 4

EMERGENCY_FLAT

0% position (flat)

Circuit breaker OPEN (1h cooldown, 3-state FSM)

Tier 3 Detail: Regime-Adaptive Kelly Fractions

When PURE_KELLY is active, position sizing adapts to the current market regime detected by MS-GARCH (4-state HMM with Hamilton Filter).

Crisis

17%

Extreme volatility protection

Bear

25%

Conservative sizing

Neutral

50%

Balanced allocation

Bull

67%

Aggressive sizing

Monitoring & Observability

Comprehensive visibility through Prometheus/Grafana/Loki with 413+ real-time metrics

71 Base Metrics

413+ Time Series

Label expansion: instrument, strategy, status, direction

10 Exporters

5-15s Refresh

Trading, ML, RL, infrastructure layers

30-Day Retention

Prometheus + Loki

Metrics storage and log aggregation

Trading Cockpit

56 panels, 9 rows

  • Portfolio Overview (Value, P&L, Balance, Leverage, Risk)
  • Position Performance (Unrealized P&L, Position Value)
  • Open Positions (Detailed Bybit-style table)
  • ML/RL Signals (Confidence, Activity, Multiplier)
  • Market Regime Status (Signal Status, Bootstrap Quality)
  • Order Management & Flow Rate
  • System Performance (Tick-to-Fill, Exchange Latency)
  • Trading Performance (Ratios, Risk Metrics, Win Rate)
  • Equity Curve (Sep 1, 2025 baseline with JADE Index & K-Ratio)

Market Analysis

22 panels, 7 rows

  • Market Prices (BTC, ETH, SOL, BNB real-time)
  • Market Microstructure (Bid/Ask, Spread, Relative Spread)
  • Price Action (5min & 1hour changes)
  • Market Depth & Liquidity Analysis
  • Market Volatility (5min & 1hour)
  • OHLCV Candlestick Charts (BTC & ETH)
  • Price Correlation Matrix (7d calculated heatmap)

Infrastructure Ops

System health monitoring

  • Pod health & availability
  • Resource utilization (CPU, memory)
  • Database metrics & performance
  • Cache performance (Redis)
  • Network latency & throughput
  • Container restart metrics

Technology Stack

Production-grade technologies powering institutional trading.

Python

100% type-hinted production code

Language

NautilusTrader

Institutional-grade trading framework (342MB vendored)

Trading

PostgreSQL + TimescaleDB

Time-series optimized database

Database

Redis

Event pub/sub and feature caching

Caching

MLflow

ML experiment tracking and model registry

ML Ops

MinIO

S3-compatible artifact storage

Storage

K3S (Kubernetes)

Lightweight production orchestration

Infrastructure

Prometheus + Grafana

71 base metrics with label expansion

Monitoring

Soft Actor-Critic (SAC)

Entropy-maximized RL for position sizing

ML/RL

ML Algorithms

Random Forest, XGBoost with Boruta feature selection

ML

MS-GARCH

4-state HMM for regime detection

Quant

Docker Compose

Local development environment (12.6GB)

DevOps

Development Journey

From research to production deployment.

Jan 2025

Research Phase

Quantitative research across 5 domains

Mar 2025

Architecture Design

Event-driven with NautilusTrader

Apr 2025

Feature Testing & Development

Core feature implementation and validation

May 2025

ML Pipeline

Transfer Learning + Boruta feature selection

Jun 2025

RL Integration

SAC with curriculum learning (45min convergence)

Jul 2025

Local Backtesting System

Backtesting framework and historical validation

Aug 2025

Docker-based Dev & Testing

Docker Compose environment setup

Sep 2025

Production Deployment

Initial production deployment

Nov 2025

K3S + Weekly Automation

K3S on DigitalOcean + GitHub Actions automation

Jan 2026

Azure Cloud VMs + VMSS

Scaled infrastructure on Azure VMs

Current Limitations & Future Potential

Honest assessment of MVP constraints with expansion-ready architecture

Current Constraints

Compute Resources

Constraints: CPU-only inference (no GPU), Azure B2als_v2: 2 vCPU 4GB RAM, Lightweight models only
Rationale: R&D budget prioritizes architecture over scale

Data Frequency

Constraints: 4-hour bars (not tick data), Single exchange (Bybit), 3 instruments (BTC/ETH/SOL)
Rationale: Better noise-to-signal ratio, sustainable costs

Monthly Budget: <$200

Azure Cloud (VM + Storage):~$60/mo
GitHub Actions:$0
Electricity:~$100/mo

Alpha Data Scope

Constraints: Price-Endogenous Only (OHLCV). Blind to exogenous alpha (On-Chain, Macro, Sentiment).
Rationale: Premium structured data (Glassnode/Bloomberg) >$2k/mo. Unstructured data requires high engineering overhead.

Future Potential

HFT-Ready Foundation

Current: <5ms latencyUpgraded: <500μs
Details: NautilusTrader supports microseconds, Redis Streams for tick data, Event-driven scales horizontally

GPU ML Pipeline

Current: RF/XGBoost (CPU)Upgraded: Transformers/LSTM (GPU)
Details: Option 1: T4 GPU training + CPU inference (~$252/mo recommended for 4H bars)

Multi-Exchange

Current: 1 exchangeUpgraded: 3+ exchanges
Details: Plugin architecture exchange-agnostic, Add Binance/OKX, Cross-exchange arbitrage. Cost: API dev only

Multi-Modal Alpha Fusion

Current: Technical AnalysisUpgraded: On-Chain + NLP Sentiment
Details: LLM-driven News/Social sentiment analysis & On-Chain whale flow monitoring for orthogonal alpha generation.

Cost Comparison Matrix

Scaling options with incremental costs and expanded capabilities

ScenarioCostCapabilities
Current MVP$0/mo automation + <$50/mo cloudCPU-only, 4H bars, 1 exchange
+GPU Pipeline+$252-961/moTransformers/LSTM, T4-A100 GPU options
+Multi-ExchangeAPI dev only3+ exchanges, cross-exchange arbitrage
+Tick Data+$500/moSub-second data, HFT strategies
+Exogenous Alpha+$2,000+/moGlassnode/Bloomberg, News/Sentiment API, On-Chain Metrics

Explore Trade-Matrix in Depth

Live trading results, quantitative research foundations, and backtesting validation.