An advanced autonomous trading bot for Solana memecoins featuring AI-driven decision making, adaptive learning, candlestick pattern recognition, and fortress-level protection optimized for small capital trading.
- AI Adaptive Learning V2: Learns from every trade to improve pattern recognition and confidence scoring
- Candlestick Pattern Analysis: Recognizes 10+ patterns (BULLISH_ENGULFING, HAMMER, MORNING_STAR, etc.)
- Dynamic Confidence Adjustments: AI adjusts strategy weights based on historical performance
- Multi-Strategy Intelligence: Candlestick + Martingale + Trend Reversal analysis combined
- Liquidity Filter: $15K minimum (optimized for small capital)
- Volume Filter: $10K minimum 24h volume
- RVOL Filter: 1.5x relative volume (high-conviction moves only)
- Rug Score: < 750 threshold (allows moderate risk for AI analysis)
- First Candle Rule: 5-minute minimum token age (avoids launch volatility)
- AI Candlestick Validation: Pattern-based entry signals
- Bearish Pattern Rejection: Filters out bearish setups automatically
- Efficient Balance Tracking: 1-minute verification cycle saves 3,000+ RPC calls/day
- Smart Caching: Price and validation data cached to minimize API usage
- Rate Limiting: Built-in RPC request management
- Multi-Endpoint Failover: Automatic fallback to backup RPCs
- Jupiter DEX Aggregation: Best swap rates across all Solana DEXs
- Position Management: Automatic tracking and profit target monitoring
- Telegram Notifications: Real-time trade alerts and status updates
- Secure Configuration: OS-level credential storage (keytar)
- Emergency Controls: Quick sell-all and position checking tools
- Node.js 18+ and npm
- Solana wallet with SOL for trading
- RPC endpoint (QuickNode recommended or public endpoints)
- Clone the repository:
git clone https://github.com/yourusername/SnipeBT.git
cd SnipeBT- Install dependencies:
npm install- Configure environment:
cp .env.example .env
# Edit .env with your settings- Store wallet private key securely (recommended):
npx ts-node src/storeSecret.ts --name WALLET_PRIVATE_KEY# RPC Endpoint (QuickNode recommended for reliability)
RPC_URL=https://your-quicknode-endpoint-here.solana-mainnet.quiknode.pro
BACKUP_RPC_URL=https://api.mainnet-beta.solana.com
RPC_WSS_URL=wss://your-wss-endpoint-here
# Trading Configuration
TRADE_AMOUNT_SOL=0.15 # Amount per trade (optimized for $100-200 capital)
MAX_POSITIONS=5 # Max concurrent positions
SLIPPAGE_BPS=150 # 1.5% slippage tolerance
# 7-Layer Protection Settings
MIN_LIQUIDITY_USD=15000 # Minimum liquidity ($15K - rug protection)
MIN_VOLUME24H_USD=10000 # Minimum 24h volume ($10K)
MIN_RVOL=1.5 # Relative volume filter (1.5x average)
MAX_RUG_SCORE=750 # Rug check threshold (< 750)
MIN_TOKEN_AGE_MINUTES=5 # First candle rule (5 min minimum age)
# AI Configuration
USE_AI_EXITS=true # Enable AI-driven exit decisions
AI_MIN_CONFIDENCE=65 # Minimum 65% confidence for trades
ENABLE_LEARNING=true # Enable adaptive learning from trades
# Allowed DEXs (raydium, orca, meteora, pumpswap)
ALLOWED_DEXES=raydium,orca,meteora,pumpswap
# Telegram (Optional)
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_idFilters out low-cap rugs and illiquid tokens. Optimized for small capital - higher than typical $5K but low enough to catch early opportunities.
Ensures token has active trading. Dead tokens filtered out automatically.
Formula: RVOL = vol1h / (vol24h / 24)
Only trades when current volume is 1.5x+ the hourly average. Prevents buying during low-activity periods.
Checks token security metrics. Allows moderate risk for AI analysis while blocking extreme rugs (scores > 750).
Rejects tokens younger than 5 minutes. Protects against launch volatility - 60% of rugs happen in first 5 minutes.
Analyzes 5-minute candles for patterns:
- BULLISH_ENGULFING, HAMMER, MORNING_STAR (enter)
- BEARISH_ENGULFING, SHOOTING_STAR, EVENING_STAR (avoid)
- DOJI, SPINNING_TOP (neutral - needs confirmation)
AI must be 65%+ confident before entering. Low-confidence setups automatically rejected.
- Configure Environment:
cp .env.example .env
# Edit .env with your wallet key, RPC endpoints, etc.- Store Wallet Key Securely (recommended):
npx ts-node src/storeSecret.ts --name WALLET_PRIVATE_KEY- Compile TypeScript:
npx tscStart Trading:
npm start
# or with PowerShell:
.\scripts\run-live.ps1Check Balance:
npx ts-node check-balance.tsCheck Open Positions:
npx ts-node check-positions-now.tsEmergency Sell All:
npx ts-node sell-all-positions.tsThe bot will:
- β
Load AI learning data from previous sessions (
learningData_v2.json) - β Initialize balance tracker (1-minute verification cycle)
- β Scan tokens from multiple sources (Dexscreener, Raydium, Birdeye)
- β Apply 7-layer protection filters
- β Analyze passing tokens with AI candlestick patterns
- β Enter high-confidence setups (65%+ confidence)
- β Monitor positions with AI-driven exit decisions
- β Learn from outcomes to improve future trades
Console Logs Show:
- Token discovery and filtering results
- Protection layer rejections (liquidity, volume, rug score, age)
- AI analysis (pattern detected, confidence score, decision)
- Trade execution (entry price, position size)
- Exit decisions (profit target hit, AI-driven exits)
- Learning updates (pattern performance adjustments)
Telegram Notifications (if configured):
- Bot startup/shutdown
- Trade entries with analysis
- Profit targets hit
- Emergency alerts## π§ AI Learning System
The bot uses adaptive learning to improve over time:
- Pattern Recognition: Analyzes candlestick patterns on every token
- Trade Execution: Enters based on AI confidence and pattern strength
- Outcome Tracking: Records win/loss for each pattern used
- Confidence Adjustment: Increases confidence for winning patterns, decreases for losing ones
- Strategy Weighting: Adjusts which strategies get more influence based on performance
All learning persists across restarts in learningData_v2.json:
- β Pattern performance stats (win rate per pattern)
- β Confidence score adjustments
- β Strategy effectiveness weights
- β Historical trade outcomes
The bot gets smarter with every trade!
Bullish Patterns (enter signals):
- BULLISH_ENGULFING: Strong reversal signal
- HAMMER: Bottom reversal after downtrend
- MORNING_STAR: Three-candle reversal pattern
- PIERCING_LINE: Bullish reversal
- THREE_WHITE_SOLDIERS: Strong uptrend
Bearish Patterns (avoid/exit signals):
- BEARISH_ENGULFING: Strong reversal down
- SHOOTING_STAR: Top reversal signal
- EVENING_STAR: Three-candle top pattern
- DARK_CLOUD_COVER: Bearish reversal
- THREE_BLACK_CROWS: Strong downtrend
Neutral Patterns (need confirmation):
- DOJI: Indecision, watch for next move
- SPINNING_TOP: Low conviction, needs volume
The bot combines three strategies for each decision:
-
Candlestick Strategy (30% weight)
- Pattern recognition
- Trend analysis
- Confidence based on historical pattern performance
-
Martingale Strategy (40% weight)
- Anti-martingale momentum detection
- Volume confirmation
- Waits for strong momentum entries
-
Trend Reversal Strategy (30% weight)
- Identifies reversals
- Confirmation signals
- Risk/reward assessment
Final Decision: Weighted average of all strategies
- BUY: If confidence β₯ 65% and bullish patterns detected
- HOLD: If confidence < 65% or neutral patterns (not blacklisted, re-evaluated)
- REJECT: If bearish patterns or failed protection layers (blacklisted)
- Never commit
.envfiles to git - Use OS credential store for private keys (keytar)
- Redact RPC URLs containing API keys before sharing
- Keep backups of your wallet private key offline
SnipeBT/
βββ src/
β βββ main.ts # Main bot orchestration
β βββ trade.ts # Trade execution (Jupiter integration)
β βββ validate.ts # 7-layer protection filtering
β βββ positionManager.ts # Position tracking
β βββ aiBalanceTracker.ts # RPC-efficient balance tracking
β βββ aiAdaptiveLearning_v2.ts # Adaptive learning system
β βββ aiCandlestickMonitor.ts # Candlestick pattern recognition
β βββ aiDynamicExits.ts # AI-driven exit decisions
β βββ aiPriceCache.ts # Price caching for RPC efficiency
β βββ aiTradeIntelligence.ts # Trade intelligence coordination
β βββ config.ts # Configuration management
β βββ secureConfig.ts # Secure credential handling
β βββ notifications.ts # Telegram notifications
β βββ rpcLimiter.ts # RPC rate limiting
β βββ cache.ts # Validation caching
β βββ logging.ts # Logging utilities
β βββ strategies/
β βββ baseStrategy.ts # Base strategy interface
β βββ candlestickStrategy.ts # Candlestick analysis
β βββ martingaleStrategy.ts # Momentum detection
β βββ trendReversalStrategy.ts # Reversal identification
β βββ strategyManager.ts # Strategy coordination
β βββ configs.ts # Strategy configurations
βββ scripts/
β βββ run-live.ps1 # PowerShell runner
βββ logs/
β βββ dryrun.csv # Trade simulation logs
βββ learningData_v2.json # AI learning persistence
βββ tradeHistory.json # Trade history log
βββ balance-tracker.json # Balance tracking state
βββ entryPrices.json # Position entry prices
βββ entryTimes.json # Position entry timestamps
βββ rpc-stats.json # RPC usage statistics
βββ .env.example # Configuration template
βββ package.json
βββ tsconfig.json
Check Protection Filters:
# Review logs for rejection reasons:
# - "Token XXX failed liquidity validation: $YYY < $15000"
# - "Token XXX failed rug check with score YYY (extreme rug)"
# - "Token XXX too young: X.X min < 5 min (first candle rule)"
# - "Low RVOL X.XXx (< 1.5x) - weak conviction"Common Fixes:
- β
Lower
MIN_LIQUIDITY_USDto 10000 (if you want riskier plays) - β
Lower
MIN_RVOLto 1.2 (less strict volume filter) - β
Increase
MAX_RUG_SCOREto 1000 (allow higher-risk tokens) - β
Lower
MIN_TOKEN_AGE_MINUTESto 3 (catch earlier launches) - β
Lower
AI_MIN_CONFIDENCEto 60 (accept lower confidence)
AI Exit Not Triggering:
- Check
USE_AI_EXITS=truein .env - Monitor AI exit analysis in console logs
- Bearish patterns should trigger exits automatically
Manual Sell:
npx ts-node sell-all-positions.tsSolutions:
- Use QuickNode or paid RPC (2.5M requests/day on Build plan)
- Check RPC usage:
cat rpc-stats.json - Increase
SCAN_INTERVAL_SECONDSto reduce request frequency - Balance tracker already optimized (saves 3,000+ calls/day)
Check Files:
# These files should exist after first trades:
ls learningData_v2.json # AI learning state
ls tradeHistory.json # Trade outcomes
ls balance-tracker.json # Balance stateReset Learning (if needed):
rm learningData_v2.json
# Bot will create fresh learning data on next startVerify Configuration:
TELEGRAM_BOT_TOKEN=your_actual_bot_token_from_BotFather
TELEGRAM_CHAT_ID=your_actual_chat_idTest Notification:
node test-telegram.js- Trade Size: 0.15 SOL (~$25) allows 4-5 concurrent positions
- Max Positions: 5 prevents over-diversification
- 7-Layer Protection: Filters 95%+ of rugs and low-quality tokens
- First Candle Rule: Avoids 60% of rugs that happen in first 5 minutes
- High Confidence Threshold: 65%+ ensures only strong setups
- Balance Tracker: Saves 3,000+ RPC calls/day (12% of daily budget)
- Price Caching: Reduces redundant price checks
- Smart Validation: Caches validation results (15-min TTL)
- Expected Usage: ~92K calls/day (3.7% of 2.5M QuickNode Build quota)
- Let It Learn: First 10-20 trades calibrate the AI
- Pattern Refinement: AI learns which patterns work in current market
- Strategy Weights: Automatically adjusts based on performance
- Continuous Improvement: Gets better with more trade data
- Small Position Sizes: 0.15 SOL = manageable losses
- Multiple Protection Layers: Each filter reduces risk significantly
- AI Confidence Gating: Won't trade on weak signals
- Adaptive Learning: Learns from mistakes to avoid repeating them
- Start Small: Run with 0.1 SOL trades first to verify behavior
- Monitor Learning: Check
learningData_v2.jsonafter 10 trades - Review Rejections: Understand why tokens are filtered (logs show reasons)
- Tune Protection: Adjust filters based on your risk tolerance
- Trust the AI: Don't override decisions - let it learn and adapt
Conservative (safer, fewer trades):
MIN_LIQUIDITY_USD=20000
MIN_VOLUME24H_USD=15000
MIN_RVOL=2.0
MAX_RUG_SCORE=500
MIN_TOKEN_AGE_MINUTES=10
AI_MIN_CONFIDENCE=70Aggressive (more trades, higher risk):
MIN_LIQUIDITY_USD=10000
MIN_VOLUME24H_USD=5000
MIN_RVOL=1.2
MAX_RUG_SCORE=1000
MIN_TOKEN_AGE_MINUTES=3
AI_MIN_CONFIDENCE=60Balanced (recommended default):
MIN_LIQUIDITY_USD=15000
MIN_VOLUME24H_USD=10000
MIN_RVOL=1.5
MAX_RUG_SCORE=750
MIN_TOKEN_AGE_MINUTES=5
AI_MIN_CONFIDENCE=65ENABLE_LEARNING=true # Enable adaptive learning
LEARNING_RATE=0.1 # How fast AI adjusts (0.1 = moderate)
MIN_TRADES_FOR_PATTERN=3 # Minimum trades before pattern adjustment
CONFIDENCE_DECAY=0.95 # How much losing trades reduce confidenceIMPORTANT - READ CAREFULLY:
- This bot is for educational and research purposes only
- Cryptocurrency trading carries significant financial risk
- You can lose all your invested capital
- This software is provided "AS IS" with no guarantees of profit
- Past performance (if any) does not indicate future results
- The AI learning system is experimental and may make mistakes
- Always test with small amounts first (0.05-0.1 SOL)
- Never trade with funds you cannot afford to lose
- The developers assume no liability for your trading losses
- You are responsible for complying with local trading regulations
- Use at your own risk
- β Start with test amounts (0.05-0.1 SOL per trade)
- β Monitor closely for first 10-20 trades
- β Review learning data to understand AI behavior
- β Keep majority of capital in cold storage
- β Set stop-loss limits for yourself (e.g., max 20% of wallet)
- β Understand that memecoins are highly volatile and risky
MIT License - See LICENSE file for details
Key Points:
- Free to use, modify, and distribute
- No warranty or guarantee of any kind
- Authors not liable for any damages
- Use at your own risk
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes (test thoroughly!)
- Commit changes:
git commit -m "Add your feature" - Push to branch:
git push origin feature/your-feature - Open a Pull Request with description of changes
- π§ Additional candlestick patterns
- π New trading strategies
- π‘οΈ Enhanced protection filters
- π Performance analytics dashboard
- π Additional notification channels
- π Documentation improvements
- π§ͺ Test coverage expansion
- Issues: Open a GitHub issue for bugs or questions
- Discussions: Use GitHub Discussions for strategy ideas
- Pull Requests: Submit improvements via PR
Please DO NOT share:
- β Your wallet private keys
- β RPC API keys or URLs
- β Telegram bot tokens
- β Any other sensitive credentials
- β AI adaptive learning v2
- β 7-layer protection system
- β Candlestick pattern recognition
- β RPC optimization
- β Multi-strategy decision making
- β First candle rule
- π Web dashboard for monitoring
- π Advanced backtesting framework
- π Multi-wallet support
- π Portfolio rebalancing
- π Social sentiment analysis
- π Advanced stop-loss strategies
Remember:
- π Never commit
.envfiles to version control - π Use OS credential storage for private keys (keytar)
- π Redact RPC URLs containing API keys before sharing
- π Keep backups of your wallet private key in secure offline storage
- π§ͺ Test with small amounts before scaling up
- π Monitor performance and adjust settings as needed
Happy Trading! Stay Safe! π