Files
trading_bot_v4/docker-compose.dev.yml
mindesbunister 2405bff68a feat: Complete Trading Bot v4 with Drift Protocol integration
Features:
- Autonomous trading system with Drift Protocol on Solana
- Real-time position monitoring with Pyth price feeds
- Dynamic stop-loss and take-profit management
- n8n workflow integration for TradingView signals
- Beautiful web UI for settings management
- REST API for trade execution and monitoring

- Next.js 15 with standalone output mode
- TypeScript with strict typing
- Docker containerization with multi-stage builds
- PostgreSQL database for trade history
- Singleton pattern for Drift client connection pooling
- BN.js for BigNumber handling (Drift SDK requirement)

- Configurable stop-loss and take-profit levels
- Breakeven trigger and profit locking
- Daily loss limits and trade cooldowns
- Slippage tolerance controls
- DRY_RUN mode for safe testing

- Real-time risk calculator
- Interactive sliders for all parameters
- Live preview of trade outcomes
- Position sizing and leverage controls
- Beautiful gradient design with Tailwind CSS

- POST /api/trading/execute - Execute trades
- POST /api/trading/close - Close positions
- GET /api/trading/positions - Monitor active trades
- GET /api/trading/check-risk - Validate trade signals
- GET /api/settings - View configuration
- POST /api/settings - Update configuration

- Fixed Borsh serialization errors (simplified order params)
- Resolved RPC rate limiting with singleton pattern
- Fixed BigInt vs BN type mismatches
- Corrected order execution flow
- Improved position state management

- Complete setup guides
- Docker deployment instructions
- n8n workflow configuration
- API reference documentation
- Risk management guidelines

- Runs on port 3001 (external), 3000 (internal)
- Uses Helius RPC for optimal performance
- Production-ready with error handling
- Health monitoring and logging
2025-10-24 14:24:36 +02:00

65 lines
1.7 KiB
YAML

# Trading Bot v4 - Development Docker Compose
# Hot reload enabled, debug logging, no database required
services:
# ================================
# Trading Bot (Development)
# ================================
trading-bot-dev:
build:
context: ..
dockerfile: v4/Dockerfile.dev
args:
NODE_ENV: development
container_name: trading-bot-v4-dev
restart: unless-stopped
ports:
- "3001:3000" # Use different port to avoid conflicts
- "9229:9229" # Node.js debugger
environment:
NODE_ENV: development
PORT: 3000
LOG_LEVEL: debug
DEBUG: "*"
# Load from .env file
DRIFT_WALLET_PRIVATE_KEY: ${DRIFT_WALLET_PRIVATE_KEY}
DRIFT_ENV: ${DRIFT_ENV:-devnet} # Use devnet by default in development
API_SECRET_KEY: ${API_SECRET_KEY:-dev-secret-key}
SOLANA_RPC_URL: ${SOLANA_RPC_URL}
PYTH_HERMES_URL: ${PYTH_HERMES_URL:-https://hermes.pyth.network}
# Safe defaults for development
MAX_POSITION_SIZE_USD: ${MAX_POSITION_SIZE_USD:-10}
LEVERAGE: ${LEVERAGE:-10}
DRY_RUN: ${DRY_RUN:-true} # Dry run by default in dev
# Notifications (optional in dev)
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-}
TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID:-}
volumes:
# Hot reload - mount source code
- ..:/app:cached
- /app/node_modules
- /app/.next
# Mount logs
- ./logs:/app/logs
networks:
- trading-net-dev
command: npm run dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
trading-net-dev:
driver: bridge