diff --git a/v4/.env.example b/v4/.env.example index 97d86c1..179d90a 100644 --- a/v4/.env.example +++ b/v4/.env.example @@ -4,20 +4,17 @@ # IMPORTANT: Never commit .env.local to git! # ================================ -# REQUIRED - DRIFT PROTOCOL TRADING +# REQUIRED - DRIFT PROTOCOL # ================================ # 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 environment (mainnet-beta for production, devnet for testing) DRIFT_ENV=mainnet-beta -# API secret key for authenticating n8n webhook requests +# API secret key for authenticating n8n requests # Generate with: openssl rand -hex 32 # ⚠️ MUST match API_SECRET_KEY in n8n environment variables API_SECRET_KEY=your_random_secret_key_here @@ -26,10 +23,8 @@ 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 (get free key at https://helius.dev) +# Helius free tier: 100,000 requests/day SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY # Alternative RPC providers: @@ -41,30 +36,29 @@ SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY # REQUIRED - PYTH NETWORK (Price Feeds) # ================================ -# Pyth Hermes WebSocket endpoint (for real-time prices) -# Default: https://hermes.pyth.network (no API key needed) +# Pyth Hermes WebSocket endpoint +# FREE - 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 +# Position size in USD (default: 50 for testing) +# With 5x leverage: $50 position = $250 notional value MAX_POSITION_SIZE_USD=50 -# Leverage multiplier (1-20, default: 10) -LEVERAGE=10 +# Leverage multiplier (1-20, default: 5) +LEVERAGE=5 # 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: Close 50% of position at this profit level TAKE_PROFIT_1_PERCENT=0.7 -# Take Profit 2: Close remaining 50% (default: +1.5%) +# Take Profit 2: Close remaining 50% at this profit level TAKE_PROFIT_2_PERCENT=1.5 # Move SL to breakeven when profit reaches this level @@ -72,30 +66,16 @@ BREAKEVEN_TRIGGER_PERCENT=0.4 # Risk limits # Stop trading if daily loss exceeds this amount (USD) -MAX_DAILY_DRAWDOWN=-150 +MAX_DAILY_DRAWDOWN=-50 # 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 +# OPTIONAL - DEVELOPMENT # ================================ # Node environment @@ -105,53 +85,68 @@ NODE_ENV=production 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) +# API server port PORT=3000 # ================================ -# NOTES & QUICK REFERENCE +# SETUP CHECKLIST # ================================ -# 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) +# [ ] 2. Get Solana wallet private key from Phantom +# [ ] 3. Get free Helius RPC key: https://helius.dev # [ ] 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): +# [ ] 5. Set same API_SECRET_KEY in n8n environment variables +# [ ] 6. Set MAX_POSITION_SIZE_USD=50 for testing +# [ ] 7. Start bot: npm run dev (or use Docker) +# [ ] 8. Import n8n-workflow-simple.json to n8n +# [ ] 9. Configure TradingView alert webhook +# [ ] 10. Test with small position first! + +# ================================ +# EXPECTED RISK PER TRADE +# ================================ + +# With default settings: # - 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: +# - Leverage: 5x +# - Notional Value: $250 +# - Max Loss (SL): $1.875 (-1.5% on 5x) +# - TP1 Gain: $0.875 (+0.7% on 5x, 50% position) +# - TP2 Gain: $1.875 (+1.5% on 5x, remaining 50%) +# - Full Win: $2.75 total profit + +# ================================ +# n8n ENVIRONMENT VARIABLES +# ================================ + +# You need to set these in n8n (Settings → Environment Variables): +# - TRADING_BOT_API_URL=http://your-server:3000 +# - API_SECRET_KEY=same_as_above +# - TELEGRAM_CHAT_ID=your_telegram_chat_id +# +# Note: Telegram notifications are handled by n8n, not by v4 bot + +# ================================ +# SECURITY NOTES +# ================================ + # ⚠️ 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 tier available) +# Phantom Wallet: Download from https://phantom.app +# Random secret: openssl rand -hex 32 +# Pyth Network: No API key needed - it's free! # Getting API Keys: