# ============================================================================== # POLYMARKET COPY TRADING BOT - CONFIGURATION # ============================================================================== # ------------------------------------------------------------------------------ # TRADERS TO COPY (Multiple addresses supported) # ------------------------------------------------------------------------------ # Option 1: Single trader # USER_ADDRESSES = '0xd62531bc536bff72394fc5ef715525575787e809' # Option 2: Multiple traders (comma-separated) # USER_ADDRESSES = '0xTrader1..., 0xTrader2..., 0xTrader3...' # Option 3: Multiple traders (JSON array format) # USER_ADDRESSES = '["0xTrader1...", "0xTrader2...", "0xTrader3..."]' USER_ADDRESSES = '' # ------------------------------------------------------------------------------ # YOUR WALLET CONFIGURATION # ------------------------------------------------------------------------------ # Your Polygon wallet address (must match PRIVATE_KEY) PROXY_WALLET = '' # Your wallet's private key (WITHOUT 0x prefix) # ⚠️ NEVER share this key or commit it to git! PRIVATE_KEY = 'your_private_key_here_without_0x_prefix' # ------------------------------------------------------------------------------ # POLYMARKET API ENDPOINTS # ------------------------------------------------------------------------------ CLOB_HTTP_URL = 'https://clob.polymarket.com/' CLOB_WS_URL = 'wss://ws-subscriptions-clob.polymarket.com/ws' # ------------------------------------------------------------------------------ # BOT SETTINGS # ------------------------------------------------------------------------------ # How often to check for new trades (in seconds) FETCH_INTERVAL = 1 # Ignore trades older than X hours TOO_OLD_TIMESTAMP = 1 # Maximum retry attempts for failed orders RETRY_LIMIT = 3 # Network request timeout in milliseconds (default: 10000 = 10 seconds) # Increase if you experience frequent timeout errors REQUEST_TIMEOUT_MS = 10000 # Maximum retry attempts for network errors (default: 3) # Helps handle temporary connection issues to Polymarket API NETWORK_RETRY_LIMIT = 3 # ============================================================================== # COPY STRATEGY CONFIGURATION (NEW SYSTEM!) # ============================================================================== # Choose your copy strategy: PERCENTAGE, FIXED, or ADAPTIVE # - PERCENTAGE: Copy a fixed % of trader's order (recommended for beginners) # - FIXED: Copy a fixed dollar amount per trade (predictable spending) # - ADAPTIVE: Dynamically adjust % based on trade size (advanced) COPY_STRATEGY = 'PERCENTAGE' # Main parameter - meaning depends on strategy: # - PERCENTAGE: Percentage of trader's order (e.g., 10.0 = 10%) # - FIXED: Fixed dollar amount per trade (e.g., 50.0 = $50) # - ADAPTIVE: Base percentage for adaptive scaling (e.g., 10.0 = 10%) COPY_SIZE = 10.0 # ------------------------------------------------------------------------------ # SAFETY LIMITS (Protect your account!) # ------------------------------------------------------------------------------ # Maximum size for a single order in USD (default: 100.0) # This prevents oversized trades even if trader makes huge orders MAX_ORDER_SIZE_USD = 100.0 # Minimum size for a single order in USD (default: 1.0) # Orders below this will be skipped (Polymarket requirement) MIN_ORDER_SIZE_USD = 1.0 # Optional: Maximum total position size in USD (per market) # Prevents accumulating too large position in one market # MAX_POSITION_SIZE_USD = 500.0 # Optional: Maximum total trading volume per day in USD # Prevents overtrading in a single day # MAX_DAILY_VOLUME_USD = 1000.0 # ------------------------------------------------------------------------------ # ADAPTIVE STRATEGY PARAMETERS (Only used if COPY_STRATEGY = 'ADAPTIVE') # ------------------------------------------------------------------------------ # Minimum percentage for large orders (default: 5.0) ADAPTIVE_MIN_PERCENT = 5.0 # Maximum percentage for small orders (default: 20.0) ADAPTIVE_MAX_PERCENT = 20.0 # Threshold in USD to trigger adaptation (default: 500.0) # Orders above this use lower %, orders below use higher % ADAPTIVE_THRESHOLD_USD = 500.0 # ============================================================================== # TIERED MULTIPLIERS (NEW FEATURE!) # ============================================================================== # Apply different multipliers based on trader's position size # Solves the problem of copying traders with varying position sizes: # - Small trades get higher multipliers (don't miss opportunities) # - Large trades get lower multipliers (prevent over-allocation) # # Format: "min-max:multiplier,min-max:multiplier,min+:multiplier" # - Use "min-max" for bounded ranges # - Use "min+" for infinite upper bound (must be last) # - Ranges are in USD based on trader's order size # # Example for $2k account copying a $500k-$1M trader: # TIERED_MULTIPLIERS = 1-10:2.0,10-100:1.0,100-500:0.2,500-1000:0.1,1000-5000:0.02,5000-10000:0.01,10000-50000:0.002,50000-100000:0.001,100000-500000:0.0005,500000+:0.0002 # # What this does: # - $5 trader order × 2.0x = $10 copy (capture small trades) # - $50 trader order × 1.0x = $50 copy # - $500 trader order × 0.1x = $50 copy # - $10,000 trader order × 0.002x = $20 copy # - $250,000 trader order × 0.0002x = $50 copy (manage large trades) # # Simpler example for $1k account: # TIERED_MULTIPLIERS = 1-100:2.0,100-1000:0.5,1000-10000:0.1,10000+:0.01 # # Leave unset to use single TRADE_MULTIPLIER or no multiplier (1.0x) # ============================================================================== # LEGACY CONFIGURATION (For backward compatibility) # ============================================================================== # These are kept for compatibility with old .env files # If you don't set COPY_STRATEGY, the bot will use these: # - COPY_PERCENTAGE: Percentage of trader's order size (default: 10.0) # - TRADE_MULTIPLIER: Single multiplier applied to copy percentage (default: 1.0) # ⚠️ DEPRECATED: Please migrate to new COPY_STRATEGY system above! # ⚠️ NOTE: If TIERED_MULTIPLIERS is set, it overrides TRADE_MULTIPLIER # COPY_PERCENTAGE = 10.0 # TRADE_MULTIPLIER = 1.0 # ------------------------------------------------------------------------------ # TRADE AGGREGATION SETTINGS (NEW!) # ------------------------------------------------------------------------------ # Enable trade aggregation for small trades (default: false) # - true = Combine multiple small trades from the same trader into one larger trade # - false = Execute each trade individually (original behavior) # 💡 Useful when traders make many small trades that individually fall below # Polymarket's $1 minimum but together would be worth copying! TRADE_AGGREGATION_ENABLED = false # Time window to wait for more trades before executing (in seconds) # Default: 300 (5 minutes) # - 60 = 1 minute # - 300 = 5 minutes (recommended) # - 600 = 10 minutes # ⏱️ Longer windows allow more trades to combine but delay execution TRADE_AGGREGATION_WINDOW_SECONDS = 300 # Preview/Dry-Run Mode (default: false) # - true = Monitor trades but DO NOT execute them (safe testing) # - false = Execute trades normally (live trading) # 🔍 Use preview mode to test the bot without risking funds! PREVIEW_MODE = false # ------------------------------------------------------------------------------ # DATABASE CONFIGURATION # ------------------------------------------------------------------------------ # MongoDB connection string # ⚠️ Keep this private! Never share or commit to git! MONGO_URI = 'mongodb+srv://username:password@cluster.mongodb.net/database' # ------------------------------------------------------------------------------ # BLOCKCHAIN CONFIGURATION (Polygon Mainnet) # ------------------------------------------------------------------------------ # Polygon RPC endpoint (you can use Infura, Alchemy, or QuickNode) RPC_URL = 'https://polygon-mainnet.infura.io/v3/YOUR_INFURA_KEY' # USDC Contract Address on Polygon (DO NOT CHANGE) USDC_CONTRACT_ADDRESS = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' # ============================================================================== # SECURITY NOTES: # - Never commit .env file to git (it's in .gitignore) # - Use a dedicated wallet with limited funds for the bot # - Regularly monitor bot activity # - Change MongoDB password if exposed # ==============================================================================