feat: Implement real-time monitoring for Drift trading
✨ Features Added: - Real-time event subscription using Drift SDK EventSubscriber - Periodic fallback monitoring for position changes - Interactive UI controls for starting/stopping monitoring - Comprehensive data source status tracking - Multi-source trade aggregation and deduplication 🔧 Backend Implementation: - EventSubscriber integration with OrderActionRecord events - Fallback to periodic monitoring (30s intervals) if events fail - Real-time trade cache management (last 100 trades) - Enhanced data availability status with monitoring state - Improved trade history from 5+ different API sources 🎨 Frontend Enhancements: - Live monitoring toggle button (🔴 Start Live / 🟢 Live) - Real-time status panel showing active monitoring state - Trade counter and last activity timestamps - Clear cache functionality for real-time trades - Enhanced status modal with monitoring details 🔗 API Endpoints: - POST /api/drift/realtime-monitoring - Control monitoring - GET /api/drift/realtime-monitoring - Check status - GET /api/drift/data-status - Enhanced with monitoring state 🐳 Docker Integration: - Updated container configuration for persistent monitoring - Environment variable support for real-time features - Database persistence for captured trades 💾 Database & Storage: - Automatic storage of real-time detected trades - Deduplication logic to prevent synthetic/duplicate trades - Persistent cache across container restarts 🚀 Usage: - Click 'Start Live' button in Trading History panel - Monitor will attempt EventSubscriber, fallback to periodic checks - All future trades automatically captured and stored - Status panel shows monitoring state and trade statistics This implements comprehensive real-time trading monitoring for Drift Protocol with robust fallback mechanisms and professional UI integration.
This commit is contained in:
@@ -15,21 +15,28 @@ services:
|
||||
# Playwright/TradingView automation settings
|
||||
- CHROMIUM_PATH=/usr/bin/chromium
|
||||
- DISABLE_CHROME_SANDBOX=true
|
||||
- DISPLAY=:99
|
||||
- DISPLAY=${DISPLAY:-:0}
|
||||
# CAPTCHA handling
|
||||
- ALLOW_MANUAL_CAPTCHA=true
|
||||
# Database configuration
|
||||
- DATABASE_URL=file:./prisma/dev.db
|
||||
|
||||
# Load environment variables from .env file
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
# Default port mapping
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
# Base volumes
|
||||
volumes:
|
||||
- ./screenshots:/app/screenshots
|
||||
- ./videos:/app/videos
|
||||
- ./.tradingview-session:/app/.tradingview-session
|
||||
- ./prisma:/app/prisma
|
||||
# X11 forwarding for GUI display (when ALLOW_MANUAL_CAPTCHA=true)
|
||||
- /tmp/.X11-unix:/tmp/.X11-unix:rw
|
||||
|
||||
# X11 and display configuration for manual CAPTCHA solving
|
||||
network_mode: host
|
||||
privileged: true
|
||||
|
||||
# Health check
|
||||
healthcheck:
|
||||
|
||||
Reference in New Issue
Block a user