refactor: Simplify env config - remove cooldown and Telegram from v4
- Removed MIN_TIME_BETWEEN_TRADES (no cooldown needed) - Removed TELEGRAM_BOT_TOKEN/CHAT_ID (n8n handles notifications) - Changed default LEVERAGE from 10x to 5x (safer) - Changed MAX_DAILY_DRAWDOWN from -150 to -50 (safer) - Clarified Pyth is FREE - no API key needed - Updated risk calculations for 5x leverage - Removed all unnecessary variables - Total: 136 lines (cleaner and focused)
This commit is contained in:
127
v4/.env.example
127
v4/.env.example
@@ -4,20 +4,17 @@
|
|||||||
# IMPORTANT: Never commit .env.local to git!
|
# IMPORTANT: Never commit .env.local to git!
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# REQUIRED - DRIFT PROTOCOL TRADING
|
# REQUIRED - DRIFT PROTOCOL
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
# Your Solana wallet private key (base58 format)
|
# Your Solana wallet private key (base58 format)
|
||||||
# ⚠️ SECURITY: Use a dedicated trading wallet with limited funds
|
|
||||||
# Get from: Phantom → Settings → Export Private Key
|
# 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_WALLET_PRIVATE_KEY=your_base58_private_key_here
|
||||||
|
|
||||||
# Drift environment
|
# Drift environment (mainnet-beta for production, devnet for testing)
|
||||||
# Options: mainnet-beta (production), devnet (testing)
|
|
||||||
DRIFT_ENV=mainnet-beta
|
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
|
# Generate with: openssl rand -hex 32
|
||||||
# ⚠️ MUST match API_SECRET_KEY in n8n environment variables
|
# ⚠️ MUST match API_SECRET_KEY in n8n environment variables
|
||||||
API_SECRET_KEY=your_random_secret_key_here
|
API_SECRET_KEY=your_random_secret_key_here
|
||||||
@@ -26,10 +23,8 @@ API_SECRET_KEY=your_random_secret_key_here
|
|||||||
# REQUIRED - SOLANA RPC ENDPOINT
|
# REQUIRED - SOLANA RPC ENDPOINT
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
# Solana RPC URL (Required for blockchain access)
|
# Solana RPC URL (get free key at https://helius.dev)
|
||||||
#
|
# Helius free tier: 100,000 requests/day
|
||||||
# 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
|
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_HELIUS_API_KEY
|
||||||
|
|
||||||
# Alternative RPC providers:
|
# 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)
|
# REQUIRED - PYTH NETWORK (Price Feeds)
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
# Pyth Hermes WebSocket endpoint (for real-time prices)
|
# Pyth Hermes WebSocket endpoint
|
||||||
# Default: https://hermes.pyth.network (no API key needed)
|
# FREE - No API key needed!
|
||||||
PYTH_HERMES_URL=https://hermes.pyth.network
|
PYTH_HERMES_URL=https://hermes.pyth.network
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# TRADING CONFIGURATION
|
# TRADING CONFIGURATION
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
# Position sizing
|
# Position size in USD (default: 50 for testing)
|
||||||
# Base position size in USD (default: 50 for safe testing)
|
# With 5x leverage: $50 position = $250 notional value
|
||||||
# Example: 50 with 10x leverage = $500 notional position
|
|
||||||
MAX_POSITION_SIZE_USD=50
|
MAX_POSITION_SIZE_USD=50
|
||||||
|
|
||||||
# Leverage multiplier (1-20, default: 10)
|
# Leverage multiplier (1-20, default: 5)
|
||||||
LEVERAGE=10
|
LEVERAGE=5
|
||||||
|
|
||||||
# Risk parameters (as percentages)
|
# Risk parameters (as percentages)
|
||||||
# Stop Loss: Close 100% of position when price drops this much
|
# Stop Loss: Close 100% of position when price drops this much
|
||||||
STOP_LOSS_PERCENT=-1.5
|
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_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
|
TAKE_PROFIT_2_PERCENT=1.5
|
||||||
|
|
||||||
# Move SL to breakeven when profit reaches this level
|
# Move SL to breakeven when profit reaches this level
|
||||||
@@ -72,30 +66,16 @@ BREAKEVEN_TRIGGER_PERCENT=0.4
|
|||||||
|
|
||||||
# Risk limits
|
# Risk limits
|
||||||
# Stop trading if daily loss exceeds this amount (USD)
|
# Stop trading if daily loss exceeds this amount (USD)
|
||||||
MAX_DAILY_DRAWDOWN=-150
|
MAX_DAILY_DRAWDOWN=-50
|
||||||
|
|
||||||
# Maximum trades per hour (prevents overtrading)
|
# Maximum trades per hour (prevents overtrading)
|
||||||
MAX_TRADES_PER_HOUR=6
|
MAX_TRADES_PER_HOUR=6
|
||||||
|
|
||||||
# Minimum seconds between trades (cooldown period)
|
|
||||||
MIN_TIME_BETWEEN_TRADES=600
|
|
||||||
|
|
||||||
# Maximum acceptable slippage (percentage)
|
# Maximum acceptable slippage (percentage)
|
||||||
SLIPPAGE_TOLERANCE=1.0
|
SLIPPAGE_TOLERANCE=1.0
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# TELEGRAM NOTIFICATIONS (Recommended)
|
# OPTIONAL - DEVELOPMENT
|
||||||
# ================================
|
|
||||||
|
|
||||||
# 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 environment
|
||||||
@@ -105,53 +85,68 @@ NODE_ENV=production
|
|||||||
LOG_LEVEL=info
|
LOG_LEVEL=info
|
||||||
|
|
||||||
# Enable dry run mode (simulate trades without executing)
|
# Enable dry run mode (simulate trades without executing)
|
||||||
# Set to 'true' for testing without real money
|
|
||||||
DRY_RUN=false
|
DRY_RUN=false
|
||||||
|
|
||||||
# API server port (default: 3000)
|
# API server port
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|
||||||
# ================================
|
# ================================
|
||||||
# NOTES & QUICK REFERENCE
|
# SETUP CHECKLIST
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
# Setup Checklist:
|
|
||||||
# [ ] 1. Copy this file to .env.local
|
# [ ] 1. Copy this file to .env.local
|
||||||
# [ ] 2. Fill in DRIFT_WALLET_PRIVATE_KEY (from Phantom)
|
# [ ] 2. Get Solana wallet private key from Phantom
|
||||||
# [ ] 3. Fill in SOLANA_RPC_URL (get free Helius key)
|
# [ ] 3. Get free Helius RPC key: https://helius.dev
|
||||||
# [ ] 4. Generate API_SECRET_KEY: openssl rand -hex 32
|
# [ ] 4. Generate API_SECRET_KEY: openssl rand -hex 32
|
||||||
# [ ] 5. Set same API_SECRET_KEY in n8n environment
|
# [ ] 5. Set same API_SECRET_KEY in n8n environment variables
|
||||||
# [ ] 6. Fill in TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID
|
# [ ] 6. Set MAX_POSITION_SIZE_USD=50 for testing
|
||||||
# [ ] 7. Set MAX_POSITION_SIZE_USD=50 for testing
|
# [ ] 7. Start bot: npm run dev (or use Docker)
|
||||||
# [ ] 8. Start bot: npm run dev
|
# [ ] 8. Import n8n-workflow-simple.json to n8n
|
||||||
# [ ] 9. Import n8n-workflow-simple.json to n8n
|
# [ ] 9. Configure TradingView alert webhook
|
||||||
# [ ] 10. Configure TradingView alert webhook
|
# [ ] 10. Test with small position first!
|
||||||
#
|
|
||||||
# Expected Risk Per Trade (with defaults):
|
# ================================
|
||||||
|
# EXPECTED RISK PER TRADE
|
||||||
|
# ================================
|
||||||
|
|
||||||
|
# With default settings:
|
||||||
# - Position Size: $50
|
# - Position Size: $50
|
||||||
# - Leverage: 10x
|
# - Leverage: 5x
|
||||||
# - Notional Value: $500
|
# - Notional Value: $250
|
||||||
# - Max Loss (SL): $7.50 (-1.5% on 10x)
|
# - Max Loss (SL): $1.875 (-1.5% on 5x)
|
||||||
# - TP1 Gain: $3.50 (+0.7% on 10x, 50% position)
|
# - TP1 Gain: $0.875 (+0.7% on 5x, 50% position)
|
||||||
# - TP2 Gain: $7.50 (+1.5% on 10x, remaining 50%)
|
# - TP2 Gain: $1.875 (+1.5% on 5x, remaining 50%)
|
||||||
# - Full Win: $11.00 total profit
|
# - 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
|
||||||
#
|
#
|
||||||
# Security Reminders:
|
# Note: Telegram notifications are handled by n8n, not by v4 bot
|
||||||
|
|
||||||
|
# ================================
|
||||||
|
# SECURITY NOTES
|
||||||
|
# ================================
|
||||||
|
|
||||||
# ⚠️ Never commit .env.local to git
|
# ⚠️ Never commit .env.local to git
|
||||||
# ⚠️ Use a dedicated trading wallet with limited funds
|
# ⚠️ Use a dedicated trading wallet with limited funds
|
||||||
# ⚠️ Start with small position sizes ($50-100)
|
# ⚠️ Start with small position sizes ($50-100)
|
||||||
# ⚠️ Keep private keys secure
|
# ⚠️ Keep private keys secure
|
||||||
# ⚠️ Rotate API_SECRET_KEY regularly
|
# ⚠️ Rotate API_SECRET_KEY regularly
|
||||||
#
|
|
||||||
# n8n Environment Variables Required:
|
# ================================
|
||||||
# - TRADING_BOT_API_URL=http://your-server:3000
|
# GETTING API KEYS
|
||||||
# - API_SECRET_KEY=same_as_above
|
# ================================
|
||||||
# - TELEGRAM_CHAT_ID=same_as_above
|
|
||||||
#
|
# Helius RPC: https://helius.dev (free tier available)
|
||||||
# Getting API Keys:
|
# Phantom Wallet: Download from https://phantom.app
|
||||||
# - Helius RPC: https://helius.dev (free: 100k requests/day)
|
# Random secret: openssl rand -hex 32
|
||||||
# - Telegram Bot: @BotFather on Telegram
|
# Pyth Network: No API key needed - it's free!
|
||||||
# - Random secret: openssl rand -hex 32
|
|
||||||
|
|
||||||
|
|
||||||
# Getting API Keys:
|
# Getting API Keys:
|
||||||
|
|||||||
Reference in New Issue
Block a user