Files
trading_bot_v3/v4/.env.example
mindesbunister 542b1abb16 refactor: Streamline .env.example to essentials only
- Removed unnecessary variables (Discord, Email, Database, Monitoring)
- Kept only required trading variables (Drift, Solana RPC, Pyth)
- Removed DRIFT_PROGRAM_ID (uses default)
- Removed advanced monitoring (DataDog, Grafana, New Relic)
- Removed database config (not needed for Phase 2)
- Removed n8n webhook URL (n8n calls v4, not vice versa)
- Simplified notes section with clear setup checklist
- Emphasized API_SECRET_KEY must match between v4 and n8n
- Total: 155 lines (down from 320)
2025-10-23 16:49:25 +02:00

161 lines
4.9 KiB
Plaintext

# Trading Bot v4 - Environment Variables Template
# Copy this file to .env.local and fill in your values
#
# IMPORTANT: Never commit .env.local to git!
# ================================
# REQUIRED - DRIFT PROTOCOL TRADING
# ================================
# Your Solana wallet private key (base58 format)
# ⚠️ SECURITY: Use a dedicated trading wallet with limited funds
# Get from: Phantom → Settings → Export Private Key
# Or: solana-keygen new --outfile ~/trading-wallet.json
DRIFT_WALLET_PRIVATE_KEY=your_base58_private_key_here
# Drift environment
# Options: mainnet-beta (production), devnet (testing)
DRIFT_ENV=mainnet-beta
# API secret key for authenticating n8n webhook requests
# Generate with: openssl rand -hex 32
# ⚠️ MUST match API_SECRET_KEY in n8n environment variables
API_SECRET_KEY=your_random_secret_key_here
# ================================
# REQUIRED - SOLANA RPC ENDPOINT
# ================================
# Solana RPC URL (Required for blockchain access)
#
# RECOMMENDED: Helius (best performance, free tier available)
# Get free API key at: https://helius.dev
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY
# Alternative RPC providers:
# QuickNode: https://solana-mainnet.quiknode.pro/YOUR_ENDPOINT/
# Alchemy: https://solana-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
# Ankr: https://rpc.ankr.com/solana
# ================================
# REQUIRED - PYTH NETWORK (Price Feeds)
# ================================
# Pyth Hermes WebSocket endpoint (for real-time prices)
# Default: https://hermes.pyth.network (no API key needed)
PYTH_HERMES_URL=https://hermes.pyth.network
# ================================
# TRADING CONFIGURATION
# ================================
# Position sizing
# Base position size in USD (default: 50 for safe testing)
# Example: 50 with 10x leverage = $500 notional position
MAX_POSITION_SIZE_USD=50
# Leverage multiplier (1-20, default: 10)
LEVERAGE=10
# Risk parameters (as percentages)
# Stop Loss: Close 100% of position when price drops this much
STOP_LOSS_PERCENT=-1.5
# Take Profit 1: Close 50% of position (default: +0.7%)
TAKE_PROFIT_1_PERCENT=0.7
# Take Profit 2: Close remaining 50% (default: +1.5%)
TAKE_PROFIT_2_PERCENT=1.5
# Move SL to breakeven when profit reaches this level
BREAKEVEN_TRIGGER_PERCENT=0.4
# Risk limits
# Stop trading if daily loss exceeds this amount (USD)
MAX_DAILY_DRAWDOWN=-150
# Maximum trades per hour (prevents overtrading)
MAX_TRADES_PER_HOUR=6
# Minimum seconds between trades (cooldown period)
MIN_TIME_BETWEEN_TRADES=600
# Maximum acceptable slippage (percentage)
SLIPPAGE_TOLERANCE=1.0
# ================================
# TELEGRAM NOTIFICATIONS (Recommended)
# ================================
# Telegram Bot for trade alerts
# 1. Create bot: Message @BotFather on Telegram, send /newbot
# 2. Get token from BotFather
# 3. Get chat ID: Message @userinfobot or your bot
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_CHAT_ID=123456789
# ================================
# OPTIONAL - ADVANCED SETTINGS
# ================================
# Node environment
NODE_ENV=production
# Log level (debug, info, warn, error)
LOG_LEVEL=info
# Enable dry run mode (simulate trades without executing)
# Set to 'true' for testing without real money
DRY_RUN=false
# API server port (default: 3000)
PORT=3000
# ================================
# NOTES & QUICK REFERENCE
# ================================
# Setup Checklist:
# [ ] 1. Copy this file to .env.local
# [ ] 2. Fill in DRIFT_WALLET_PRIVATE_KEY (from Phantom)
# [ ] 3. Fill in SOLANA_RPC_URL (get free Helius key)
# [ ] 4. Generate API_SECRET_KEY: openssl rand -hex 32
# [ ] 5. Set same API_SECRET_KEY in n8n environment
# [ ] 6. Fill in TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID
# [ ] 7. Set MAX_POSITION_SIZE_USD=50 for testing
# [ ] 8. Start bot: npm run dev
# [ ] 9. Import n8n-workflow-simple.json to n8n
# [ ] 10. Configure TradingView alert webhook
#
# Expected Risk Per Trade (with defaults):
# - Position Size: $50
# - Leverage: 10x
# - Notional Value: $500
# - Max Loss (SL): $7.50 (-1.5% on 10x)
# - TP1 Gain: $3.50 (+0.7% on 10x, 50% position)
# - TP2 Gain: $7.50 (+1.5% on 10x, remaining 50%)
# - Full Win: $11.00 total profit
#
# Security Reminders:
# ⚠️ Never commit .env.local to git
# ⚠️ Use a dedicated trading wallet with limited funds
# ⚠️ Start with small position sizes ($50-100)
# ⚠️ Keep private keys secure
# ⚠️ Rotate API_SECRET_KEY regularly
#
# n8n Environment Variables Required:
# - TRADING_BOT_API_URL=http://your-server:3000
# - API_SECRET_KEY=same_as_above
# - TELEGRAM_CHAT_ID=same_as_above
#
# Getting API Keys:
# - Helius RPC: https://helius.dev (free: 100k requests/day)
# - Telegram Bot: @BotFather on Telegram
# - Random secret: openssl rand -hex 32
# Getting API Keys:
# - Helius RPC: https://helius.dev (free: 100k requests/day)
# - Telegram Bot: @BotFather on Telegram
# - Random secret: openssl rand -hex 32