Back to projects

ACMF — Automated Crypto Market Framework

A production-grade quantitative trading bot for BTC/USDT perpetual futures on Binance. It runs a stacked ML ensemble combining a custom Mamba State Space Model with XGBoost, executing a 6-layer pipeline every 15 minutes. Currently in paper trading mode with live market data.

PythonPyTorchXGBoostFastAPIPostgreSQLRedisDockerNginxPrometheusasyncioBinance APITelegram API

Live Performance

Auto-refreshes every 5 minutes

System Architecture

The pipeline runs every 15 minutes at candle close, orchestrated by a central scheduler with an independent watchdog. Each layer is self-contained with graceful degradation — if any non-critical data source fails, the system continues with available data.

1

Data Collection

8 parallel data sources — Binance OHLCV (4 timeframes), order book depth, sentiment (Fear & Greed, funding, L/S ratio), macro (Gold, VIX, S&P500, DXY), on-chain, and LLM news analysis.

2

Feature Engineering

Produces a 192x22 sequence matrix for Mamba and ~66 tabular features for XGBoost. Price-relative normalization, stationarity transforms, multi-timeframe aggregation.

3

Prediction Engine

Stacked ensemble: Mamba SSM extracts 128-dim hidden state from sequence data, concatenated with 40 tabular features, fed into XGBoost classifier. Spread-based directional routing instead of argmax.

4

Trade Logic

12-condition entry filter with regime-specific thresholds, ATR-based position sizing (1.5% risk per trade), multi-stage exit system (stop-loss, trailing take-profit, opposite signal, time exit).

5

Execution

Paper mode with simulated fills and 0.02% slippage. Live mode via ccxt with server-side stop-loss and take-profit orders. Crash recovery reconciles DB vs exchange state.

6

Monitoring

Telegram alerts, Prometheus metrics, model decay detection (rolling accuracy < 45%), feedback loop triggering retrain at 200+ new samples.

Key Technical Highlights

Custom Mamba SSM

Pure PyTorch implementation of the Mamba State Space Model — no external mamba-ssm library. Trained via self-supervised pre-training on historical sequences, produces 128-dimensional hidden state representations.

Stacked Ensemble

Mamba hidden states concatenated with tabular features fed into XGBoost. Uses spread-based routing instead of argmax to handle ~55% NEUTRAL bias in the classifier output.

5-Layer Safety System

Live mode gate with 24h expiring confirmation, dual-mechanism kill switch, auto-triggering circuit breaker, pre-flight checks, and observe-only mode for first 2 cycles after start.

Full Infrastructure

7 Docker Compose services: PostgreSQL, Redis, trading bot, FastAPI dashboard, Nginx reverse proxy, Prometheus monitoring, and automated daily database backups.

Want the full technical deep-dive?

Read the detailed architecture paper covering the ML approach, feature engineering, risk management, and infrastructure decisions.

Read the Paper