Advanced multi-chain automated trading bot for memecoin launches with real-time monitoring, risk management, and Telegram integration.
- β 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
- π± 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
- π‘οΈ 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
Python 3.9+
asyncio
aiohttp
python-telebot
solders
solana
web3
eth-account
python-dotenv
cryptography# 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# Copy template
cp .env.template .env
# Edit .env with your settings
nano .env # or use any text editorMinimum Required Configuration:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
ENVIRONMENT=TESTNET- Open Telegram and search for
@BotFather - Send
/newbotcommand - Follow instructions to create your bot
- Copy the bot token to
.env - Send a message to your bot, then get your chat ID:
Look for
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates"chat":{"id":YOUR_CHAT_ID}and copy it to.env
# Start in simulation mode (no real trading)
python main.py
# For real trading, add private keys to .env first!/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
/start_trading- Start automated trading/stop- Stop automated trading
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- 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%)
- 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%)
-
Never commit private keys to git
# Add to .gitignore echo ".env" >> .gitignore
-
Use encrypted private keys
- The bot includes encryption utilities
- Store encrypted keys in
.env
-
Start small
- Test with TESTNET first
- Start with small position sizes
- Monitor performance before scaling
-
Set strict limits
- Use
MAX_DAILY_LOSS_USDto limit risk - Keep
MAX_POSITION_SIZE_USDconservative - Monitor the bot regularly
- Use
# 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# 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 .envThe bot automatically calculates position sizes based on:
- Max Position Size: Set in config
- Liquidity Available: Max 1% of pool liquidity
- Risk Score: Higher risk = smaller position
- Current Drawdown: Reduces size by 50% during losses
- Stop Loss: Automatically closes position at X% loss
- Take Profit: Automatically closes position at X% profit
- Time Limit: Auto-closes positions after 2 hours
- Loss Limit: Stops trading when daily loss exceeds limit
- Win Rate Tracking: Monitors performance
- Drawdown Protection: Reduces position size after 3 consecutive losses
logs/
βββ trading_bot.log # Main application log
βββ trades.json # Trade history
- Check Telegram for live updates
- Use
/statusfor quick health check - Monitor
logs/trading_bot.logfor detailed info
Solution: Add TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID to .env
Solution: Check RPC URLs in .env, use paid RPC for better reliability
Solution:
- Check if DexScreener API is accessible
- Adjust
MIN_LIQUIDITY_USDto lower value - Increase
MAX_TOKEN_AGE_MINUTES
Solution: Check risk management logs, may need to:
- Increase
MAX_POSITION_SIZE_USD - Lower
MIN_LIQUIDITY_USD - Reset daily metrics if hit loss limit
- DexScreener: ~300 requests/minute (free tier)
- Solution: Built-in rate limiting handles this automatically
-
Use Paid RPC Endpoints
- Faster execution
- Better reliability
- Lower latency
-
Adjust Strategy Parameters
- Fine-tune confidence scores
- Adjust age ranges for your strategy
- Test different position sizes
-
Monitor Market Conditions
- Different strategies work better in different markets
- Adjust parameters based on market volatility
-
Keep Capital Reserved
- Don't use all your capital
- Keep reserves for better opportunities
- 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
- Very new tokens with extreme liquidity
- Tokens with no recent transactions
- Extreme price volatility (>100% in 5 min)
- Fast execution (~400ms block time)
- Lower fees
- High throughput
- EVM compatibility
- Lower fees than Ethereum
- Large DEX ecosystem
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
- Create new strategy file in
strategies/ - Inherit from
BaseStrategy - Implement required methods:
initialize()execute()calculate_confidence()
- Add to
trading_engine.py
- Create exchange connector in
exchanges/ - Inherit from
BaseExchange - Implement chain-specific logic
- Add configuration to
chains.py - Update scanner to support chain
For issues, questions, or contributions:
- Check logs in
logs/directory - Review this documentation
- Test with simulation mode first
This project is for educational purposes only. Use at your own risk.
Happy Trading! π
Remember: Always start with simulation mode and small positions!