SYSTEMS OPERATIONAL
← BACK TO ARCHIVE
DeFi active

StableArb

Multi-chain DEX/CEX arbitrage engine with real-time pricing and automated execution

PythonWeb3.pyAsyncIOPrometheusDocker
247 tests5 exchangesReal-time monitoring

Overview

StableArb is a production arbitrage engine that identifies and executes price discrepancies across decentralized and centralized exchanges. It monitors real-time pricing across multiple chains and exchanges, calculates profitable opportunities factoring in gas costs, slippage, and fees, then executes trades automatically.

Architecture

The system uses an async event-driven architecture built on Python’s AsyncIO. Exchange connectors maintain persistent WebSocket connections for real-time order book data. An opportunity detection engine continuously evaluates cross-exchange spreads against configurable thresholds.

Key design decisions:

  • Async-first: All I/O is non-blocking, enabling monitoring of multiple pairs across multiple exchanges simultaneously
  • Prometheus metrics: Full observability with Grafana dashboards for spread tracking, execution latency, and P&L
  • Docker Compose deployment: Production-ready containerized setup with health checks and restart policies

Testing

Comprehensive test suite with 247 tests covering exchange connectors, opportunity detection logic, execution paths, and error handling. Uses pytest with async fixtures for realistic testing of WebSocket-based flows.