Data Architecture
Redis-Based Data Architecture
The arbitrage system uses Redis as the central data hub for real-time market data processing. This architecture supports high-frequency data ingestion from multiple cryptocurrency exchanges while maintaining low-latency access for arbitrage calculations and dashboard visualization.
Core Components
The data architecture consists of four main components:
Data Ingestion: WebSocket streams and REST APIs collect market data
Data Storage: Redis provides fast key-value storage and pub/sub messaging
Data Processing: Buffered message processing for high-throughput operations
Data Distribution: Real-time data flow to arbitrage engine and dashboard
Data Ingestion Layer
WebSocket Stream Management
The system maintains persistent WebSocket connections to collect real-time data:
Exchange Connections:
Aster Exchange:
wss://fstream.asterdex.comfor futures dataBackpack Exchange:
wss://ws.backpack.exchangefor spot and futures datazkLighter Exchange:
wss://mainnet.zklighter.elliot.ai/streamfor perpetual data
Data Types Collected:
Orderbook Updates: Bid/ask prices with depth information
Funding Rates: Real-time funding rate changes for perpetuals
Market Statistics: Volume, price changes, and market status
Redis Data Structure
Key Organization
The system uses hierarchical key structures for efficient data organization:
Market Data Keys:
Index Keys:
Opportunity Logging Keys
Arbitrage opportunities are logged with structured data:
Historical Data Keys
Funding rate history is maintained for analysis:
Last updated

