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
37 lines
820 B
Bash
Executable File
37 lines
820 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Trading Bot v4 - Docker Build Script
|
|
# Builds production-ready Docker image
|
|
|
|
set -e
|
|
|
|
echo "🐳 Building Trading Bot v4 Docker Image..."
|
|
echo ""
|
|
|
|
# Navigate to v4 directory
|
|
cd "$(dirname "$0")"
|
|
|
|
# Check if .env exists
|
|
if [ ! -f ".env" ]; then
|
|
echo "⚠️ Warning: .env file not found!"
|
|
echo " Creating from .env.example..."
|
|
cp .env.example .env
|
|
echo " ✅ .env created. Please edit it with your credentials."
|
|
echo ""
|
|
fi
|
|
|
|
# Build with BuildKit for better performance
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
echo "📦 Building image with BuildKit..."
|
|
docker-compose build --progress=plain
|
|
|
|
echo ""
|
|
echo "✅ Build complete!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Edit .env file with your credentials"
|
|
echo " 2. Run: docker-compose up -d"
|
|
echo " 3. Check logs: docker-compose logs -f"
|
|
echo ""
|