Skip to content

Advanced multi-chain automated trading bot for memecoin launches with real-time monitoring, risk management, and Telegram integration.

Notifications You must be signed in to change notification settings

Dascott1990/memecoin-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Memecoin Trading Bot - Professional Edition

Advanced multi-chain automated trading bot for memecoin launches with real-time monitoring, risk management, and Telegram integration.

🌟 Features

Core Trading

  • βœ… Multi-Chain Support: Solana (Jupiter) & BSC (PancakeSwap)
  • βœ… Real-Time Scanning: DexScreener API integration
  • βœ… Multiple Strategies: Launch Sniper & Momentum Trader
  • βœ… Advanced Risk Management: Position sizing, stop-loss, take-profit
  • βœ… Automated Execution: Real-time trade execution

Monitoring & Control

  • πŸ“± Telegram Bot: Full command interface
  • πŸ“Š Live Updates: Real-time opportunities and performance
  • πŸ’° Portfolio Tracking: Complete position management
  • πŸ“ˆ Performance Analytics: Win rate, P&L, trade history

Safety Features

  • πŸ›‘οΈ Risk Limits: Daily loss limits, position size limits
  • ⚠️ Honeypot Detection: Basic scam token filtering
  • πŸ”’ Secure Key Management: Encrypted private key storage
  • πŸ“‰ Drawdown Protection: Auto position size reduction

πŸ“‹ Requirements

Python 3.9+
asyncio
aiohttp
python-telebot
solders
solana
web3
eth-account
python-dotenv
cryptography

πŸš€ Quick Start

1. Installation

# Clone the repository
cd memecoin_bot

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Create .env Configuration

# Copy template
cp .env.template .env

# Edit .env with your settings
nano .env  # or use any text editor

Minimum Required Configuration:

TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
ENVIRONMENT=TESTNET

3. Get Telegram Bot Token

  1. Open Telegram and search for @BotFather
  2. Send /newbot command
  3. Follow instructions to create your bot
  4. Copy the bot token to .env
  5. Send a message to your bot, then get your chat ID:
    https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
    
    Look for "chat":{"id":YOUR_CHAT_ID} and copy it to .env

4. Run the Bot

# Start in simulation mode (no real trading)
python main.py

# For real trading, add private keys to .env first!

πŸ“± Telegram Commands

Monitoring Commands

  • /start - Show help and available commands
  • /status - Bot status and health check
  • /opportunities - Current trading opportunities
  • /portfolio - Your portfolio summary
  • /performance - Trading performance statistics
  • /scan - Force immediate market scan

Control Commands

  • /start_trading - Start automated trading
  • /stop - Stop automated trading

βš™οΈ Configuration Guide

Trading Parameters

Edit .env to customize:

# Position Sizing
MAX_POSITION_SIZE_USD=50          # Maximum per trade
MAX_DAILY_LOSS_USD=100            # Daily loss limit
MAX_OPEN_POSITIONS=3              # Max concurrent positions

# Risk Management
STOP_LOSS_PERCENT=3.0             # Auto-close at 3% loss
TAKE_PROFIT_PERCENT=6.0           # Auto-close at 6% profit
MAX_SLIPPAGE_PERCENT=5.0          # Maximum acceptable slippage

# Token Filters
MIN_LIQUIDITY_USD=5000            # Minimum pool liquidity
MAX_TOKEN_AGE_MINUTES=30          # Only tokens < 30 min old
MIN_VOLUME_USD=1000               # Minimum 24h volume

# Strategy
REQUIRED_CONFIDENCE_SCORE=0.6     # 60% confidence minimum

Strategy Explanations

Launch Sniper Strategy

  • Target: New token launches (1-15 minutes old)
  • Focus: High liquidity, early entry, low price
  • Risk Level: Medium-High
  • Confidence Factors:
    • Liquidity strength (40%)
    • Age optimality (30%)
    • Price attractiveness (20%)
    • Volume momentum (10%)

Momentum Trader Strategy

  • Target: Trending tokens (10-60 minutes old)
  • Focus: Volume spikes, price momentum
  • Risk Level: Medium
  • Confidence Factors:
    • Momentum strength (35%)
    • Liquidity depth (25%)
    • Volume increase (20%)
    • Age optimality (15%)
    • Price stability (5%)

πŸ” Security Best Practices

For Real Trading (MAINNET)

  1. Never commit private keys to git

    # Add to .gitignore
    echo ".env" >> .gitignore
  2. Use encrypted private keys

    • The bot includes encryption utilities
    • Store encrypted keys in .env
  3. Start small

    • Test with TESTNET first
    • Start with small position sizes
    • Monitor performance before scaling
  4. Set strict limits

    • Use MAX_DAILY_LOSS_USD to limit risk
    • Keep MAX_POSITION_SIZE_USD conservative
    • Monitor the bot regularly

Wallet Setup

Solana Wallet

# Generate new wallet
solana-keygen new --outfile ~/.config/solana/id.json

# Get private key
solana-keygen pubkey ~/.config/solana/id.json

# Add to .env as base58 string

BSC Wallet

# Generate using web3.py
from eth_account import Account
account = Account.create()
print(f"Address: {account.address}")
print(f"Private Key: {account.privateKey.hex()}")

# Add private key to .env

πŸ“Š Understanding Risk Management

Position Sizing

The bot automatically calculates position sizes based on:

  1. Max Position Size: Set in config
  2. Liquidity Available: Max 1% of pool liquidity
  3. Risk Score: Higher risk = smaller position
  4. Current Drawdown: Reduces size by 50% during losses

Stop Loss / Take Profit

  • Stop Loss: Automatically closes position at X% loss
  • Take Profit: Automatically closes position at X% profit
  • Time Limit: Auto-closes positions after 2 hours

Daily Limits

  • Loss Limit: Stops trading when daily loss exceeds limit
  • Win Rate Tracking: Monitors performance
  • Drawdown Protection: Reduces position size after 3 consecutive losses

πŸ” Monitoring & Logging

Log Files

logs/
β”œβ”€β”€ trading_bot.log          # Main application log
└── trades.json              # Trade history

Real-Time Monitoring

  • Check Telegram for live updates
  • Use /status for quick health check
  • Monitor logs/trading_bot.log for detailed info

πŸ› Troubleshooting

Common Issues

"Telegram bot not configured"

Solution: Add TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID to .env

"Failed to connect to RPC"

Solution: Check RPC URLs in .env, use paid RPC for better reliability

"No opportunities found"

Solution:

  • Check if DexScreener API is accessible
  • Adjust MIN_LIQUIDITY_USD to lower value
  • Increase MAX_TOKEN_AGE_MINUTES

"Trade validation failed"

Solution: Check risk management logs, may need to:

  • Increase MAX_POSITION_SIZE_USD
  • Lower MIN_LIQUIDITY_USD
  • Reset daily metrics if hit loss limit

API Rate Limits

  • DexScreener: ~300 requests/minute (free tier)
  • Solution: Built-in rate limiting handles this automatically

πŸ“ˆ Performance Optimization

For Better Results

  1. Use Paid RPC Endpoints

    • Faster execution
    • Better reliability
    • Lower latency
  2. Adjust Strategy Parameters

    • Fine-tune confidence scores
    • Adjust age ranges for your strategy
    • Test different position sizes
  3. Monitor Market Conditions

    • Different strategies work better in different markets
    • Adjust parameters based on market volatility
  4. Keep Capital Reserved

    • Don't use all your capital
    • Keep reserves for better opportunities

🚨 Important Disclaimers

⚠️ Trading cryptocurrencies involves significant risk

  • This bot is for educational purposes
  • Past performance does not guarantee future results
  • Never invest more than you can afford to lose
  • Test thoroughly before using real funds
  • Start with TESTNET/SIMULATION mode
  • The authors are not responsible for any losses

πŸ“š Advanced Features

Honeypot Detection

  • Very new tokens with extreme liquidity
  • Tokens with no recent transactions
  • Extreme price volatility (>100% in 5 min)

Chain-Specific Features

Solana (Jupiter)

  • Fast execution (~400ms block time)
  • Lower fees
  • High throughput

BSC (PancakeSwap)

  • EVM compatibility
  • Lower fees than Ethereum
  • Large DEX ecosystem

πŸ› οΈ Development

Project Structure

memecoin_bot/
β”œβ”€β”€ main.py                 # Application entry point
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ settings.py        # Configuration management
β”‚   └── chains.py          # Chain configurations
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ trading_engine.py  # Main trading logic
β”‚   β”œβ”€β”€ risk_manager.py    # Risk management
β”‚   └── portfolio_manager.py # Portfolio tracking
β”œβ”€β”€ strategies/
β”‚   β”œβ”€β”€ base_strategy.py   # Strategy interface
β”‚   β”œβ”€β”€ launch_sniper.py   # Launch sniper strategy
β”‚   └── momentum_trader.py # Momentum strategy
β”œβ”€β”€ exchanges/
β”‚   β”œβ”€β”€ base_exchange.py   # Exchange interface
β”‚   β”œβ”€β”€ jupiter.py         # Jupiter (Solana)
β”‚   └── pancake.py         # PancakeSwap (BSC)
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ token_scanner.py   # Token discovery
β”‚   └── market_data.py     # Market data fetching
└── utils/
    β”œβ”€β”€ logger.py          # Logging utilities
    β”œβ”€β”€ security.py        # Security functions
    └── helpers.py         # Helper functions

Adding New Strategies

  1. Create new strategy file in strategies/
  2. Inherit from BaseStrategy
  3. Implement required methods:
    • initialize()
    • execute()
    • calculate_confidence()
  4. Add to trading_engine.py

Adding New Chains

  1. Create exchange connector in exchanges/
  2. Inherit from BaseExchange
  3. Implement chain-specific logic
  4. Add configuration to chains.py
  5. Update scanner to support chain

πŸ“ž Support

For issues, questions, or contributions:

  • Check logs in logs/ directory
  • Review this documentation
  • Test with simulation mode first

πŸ“„ License

This project is for educational purposes only. Use at your own risk.


Happy Trading! πŸš€

Remember: Always start with simulation mode and small positions!

About

Advanced multi-chain automated trading bot for memecoin launches with real-time monitoring, risk management, and Telegram integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published