Real-time monitoring and control for CEX and DEX arbitrage trading.
# Install dependencies
pip install -r requirements.txt
cd web_ui && npm install && npm run build && cd ..
# Start server
python web_server.py
# Access at http://localhost:8000- Live balance, equity, and performance metrics
- Real-time opportunity feed and trade history
- System logs with auto-scroll
- Start/stop bot control
- Paper (Live Chain): Uses live RPC data but never broadcasts transactions (safe testing)
- Live Trading: Full execution with real transaction broadcasts
- Control panel with size, thresholds, slippage, gas configuration
- Real-time opportunities with profit/gas/slippage breakdown
- Equity chart and fills history
- Decision Trace: Debug why trades execute or skip
# Start paper mode (safe - no broadcasts)
curl -X POST http://localhost:8000/api/dex/control \
-H "Content-Type: application/json" \
-d '{
"action": "start",
"mode": "paper_live_chain",
"config": {
"size_usd": 1000,
"min_profit_threshold_bps": 10,
"slippage_floor_bps": 5,
"gas_model": "fast"
}
}'
# Stop scanner
curl -X POST http://localhost:8000/api/dex/control \
-H "Content-Type: application/json" \
-d '{"action": "stop"}'CEX
GET /api/balance- Current balance and equityGET /api/opportunities- Arbitrage opportunitiesGET /api/trades- Trade historyPOST /api/bot/start- Start CEX botPOST /api/bot/stop- Stop CEX bot
DEX
GET /api/dex/status- Current status with last decisionGET /api/dex/opportunities- Opportunity feed (max 50)GET /api/dex/fills- Recent fills (max 100)GET /api/dex/equity- Equity time seriesGET /api/dex/decisions- Decision history for debuggingPOST /api/dex/control- Start/stop with config
WebSocket
WS /ws- CEX real-time updatesWS /ws/dex- DEX real-time updates
Every opportunity is evaluated and logged as EXECUTE or SKIP with detailed reasoning.
# Get recent decisions
curl http://localhost:8000/api/dex/decisions | jq '.decisions[:5]'
# Get last decision from status
curl http://localhost:8000/api/dex/status | jq '.status.last_decision'
# Find all SKIP reasons
curl http://localhost:8000/api/dex/decisions | jq '.decisions[] | select(.action == "SKIP") | .reasons'[timestamp] Decision EXECUTE reasons=[] metrics: gross=0.80% net=0.40% breakeven=0.60% fees=0.30% slip=0.05% gas=0.05% size=$1000.00
[timestamp] Decision SKIP reasons=[threshold: net 0.04% < 0.20%] metrics: gross=0.39% net=0.04% breakeven=0.55% fees=0.30% slip=0.05% gas=0.20% size=$100.00
threshold- Net profit below configured minimumsize- Position size too small (<$10) or too largedepth- Depth-limiting reduced size below minimumleg1/leg2/leg3- Per-leg notional below $5 (CEX only)maker_legs- Insufficient maker legs for fee optimizationconcurrent- Too many trades executing simultaneouslycooldown- Not enough time since last tradeexchange- Exchange connection not readyquote- Missing quote data (DEX)gas- Missing gas estimate (DEX)
No trades executing?
-
Check threshold:
curl http://localhost:8000/api/dex/status | jq '.status.config.min_profit_threshold_bps'
-
Review rejections:
curl http://localhost:8000/api/dex/decisions | jq '.decisions[] | select(.action == "SKIP") | .reasons'
-
Lower threshold if needed:
curl -X POST http://localhost:8000/api/dex/control \ -H "Content-Type: application/json" \ -d '{"action": "start", "mode": "paper_live_chain", "config": {"min_profit_threshold_bps": 5}}'
Size constraints:
- Minimum: $10 per trade
- Maximum: Configured
size_usd - Per-leg minimum: $5 (CEX only)
# Terminal 1: Backend
python web_server.py
# Terminal 2: Frontend (hot reload)
cd web_ui && npm startFrontend at http://localhost:3000, backend at http://localhost:8000
docker-compose up -dAccess at http://localhost:8000
For production:
- Change CORS settings in
web_server.py(not"*") - Use HTTPS/WSS for secure connections
- Enable authentication
- Use environment variables for sensitive data
MIT License - See LICENSE file for details