A professional-grade automated trading bot for the Solana ecosystem that discovers newly launched tokens via Twitter, executes trades with technical analysis, and manages risk with capital preservation.
- Twitter Real-Time Streaming - Monitors Twitter for new Solana token launches and announcements
- Smart Extraction - Automatically extracts and validates Solana token addresses from tweets
- Event Classification - Categorizes mentions as launches, announcements, or general mentions
- RugCheck Integration - Analyzes tokens for rug-pull risk factors
- Birdeye API - Checks for honeypot indicators and freeze authority
- Composite Scoring - Combines multiple data sources for comprehensive safety assessment
- Liquidity Validation - Ensures minimum liquidity requirements before trading
- RSI (Relative Strength Index) - Identifies overbought/oversold conditions
- MACD - Detects trend momentum and crossovers
- EMA Crossovers - Tracks short/medium/long-term moving average alignments
- Volume Analysis - Confirms signals with volume validation
- Re-Entry Detection - Identifies opportunities to re-enter after pullbacks
- Jupiter DEX Integration - Executes swaps through Jupiter V6 API
- Slippage Protection - Configurable slippage tolerance
- Priority Fees - Adjustable transaction priority
- Paper Trading Mode - Test strategies without risking real funds
- Stop-Loss - Fixed percentage stop-loss protection
- Trailing Stop - Dynamic stop that follows price upward after reaching targets
- Take Profit - Automatic profit-taking at 2x (100% gain) or custom targets
- Capital Preservation - Locks initial capital after reaching 200% profit threshold
- Circuit Breaker - Emergency shutdown on excessive daily losses or consecutive losing trades
- Python 3.10 or higher
- Solana Wallet with SOL for trading
- API Keys:
- Twitter API v2 (Elevated access required)
- Birdeye API
- Solana RPC endpoint (recommended: Helius, QuickNode)
git clone https://github.com/yourusername/solana-trading-bot.git
cd solana-trading-botpython -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activatepip install -r requirements.txt# Copy the example environment file
cp .env.example .env
# Edit .env with your credentials
notepad .env # Windows
nano .env # Linux/MacEdit your .env file with the following required settings:
# Solana Configuration
SOLANA_PRIVATE_KEY=your_base58_private_key
SOLANA_RPC_URL=https://your-rpc-endpoint.com
# Twitter API v2
TWITTER_BEARER_TOKEN=your_twitter_bearer_token
# Birdeye API
BIRDEYE_API_KEY=your_birdeye_api_key# Capital Settings
INITIAL_CAPITAL_SOL=1.0
MAX_TRADE_AMOUNT_SOL=0.1
# Risk Settings
STOP_LOSS_PERCENT=15
TAKE_PROFIT_MULTIPLIER=2.0
MAX_SLIPPAGE_PERCENT=5.0
# Risk Management
MAX_DAILY_LOSS_SOL=0.5
MAX_CONSECUTIVE_LOSSES=3
CAPITAL_PRESERVE_THRESHOLD=200
# Mode: 'paper' for simulation, 'live' for real trading
TRADING_MODE=paperMIN_RUGCHECK_SCORE=60
MIN_LIQUIDITY_USD=10000
MAX_TOP_HOLDER_PERCENT=20python main.py --mode paper
⚠️ Warning: Live trading involves real financial risk. Start with small amounts.
python main.py --mode livepython main.py --help
Options:
--mode {live,paper} Trading mode (default: paper)
--capital FLOAT Override initial capital in SOL
--debug Enable debug loggingA buy signal is generated when:
- Token passes security checks (RugCheck score ≥ 60)
- RSI is between 30-70 (not overbought/oversold)
- MACD shows bullish crossover or positive momentum
- Volume is above average
- Price is above 20 EMA
| Condition | Action |
|---|---|
| Price ≥ 2x entry | Take profit (sell all) |
| Price ≤ -15% from entry | Stop-loss (sell all) |
| Price drops 10% from peak (after 2x) | Trailing stop (sell all) |
After reaching 200% total profit:
- Original capital is locked and protected
- Bot continues trading only with profits
- Maximum 10% of available profits per trade
Solana-Bot/
├── main.py # Entry point
├── requirements.txt # Dependencies
├── .env.example # Configuration template
│
├── config/
│ └── settings.py # Pydantic configuration
│
├── solana_client/
│ ├── wallet.py # Keypair & balance management
│ └── jupiter.py # Jupiter DEX integration
│
├── discovery/
│ ├── twitter_stream.py # Twitter API v2 streaming
│ └── token_extractor.py # Address validation
│
├── security/
│ ├── rugcheck_client.py # RugCheck API
│ ├── birdeye_client.py # Birdeye API
│ └── analyzer.py # Composite security analysis
│
├── analysis/
│ ├── indicators.py # RSI, MACD, EMA
│ └── signals.py # Signal generation
│
├── trading/
│ ├── executor.py # Trade execution
│ └── position_manager.py# Position tracking
│
├── risk/
│ ├── stop_loss.py # Stop-loss logic
│ ├── capital_manager.py # Capital preservation
│ └── circuit_breaker.py # Emergency shutdown
│
├── bot/
│ └── orchestrator.py # Main coordinator
│
├── database/
│ └── models.py # SQLAlchemy models
│
└── tests/
├── test_indicators.py # TA tests
└── test_risk.py # Risk management tests
pytest tests/ -vpytest tests/ -v --cov=. --cov-report=htmlpytest tests/test_indicators.py -v
pytest tests/test_risk.py -vLogs are stored in the ./logs/ directory:
bot_YYYY-MM-DD.log- General bot activitytrades_YYYY-MM-DD.log- Trade-specific logserrors.log- Error tracking
Set via LOG_LEVEL in .env:
DEBUG- Verbose outputINFO- Standard operationWARNING- Warnings onlyERROR- Errors only
- Never share your private key - Keep
.envfile secure - Use a dedicated wallet - Don't use your main wallet
- Start with paper trading - Validate strategy before live trading
- Set conservative limits - Use small position sizes initially
- Monitor actively - Don't leave unattended during initial runs
- Use private RPC - Avoid public endpoints for trading
This software is for educational purposes only.
Trading cryptocurrencies, especially newly launched tokens, carries significant financial risk. You could lose some or all of your investment. The developers are not responsible for any financial losses incurred from using this software.
- Past performance does not guarantee future results
- Newly launched tokens are extremely volatile and risky
- Always do your own research before trading
- Only invest what you can afford to lose
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Jupiter - DEX Aggregator
- Birdeye - Token Analytics
- RugCheck - Token Security
- pandas-ta - Technical Analysis
For issues and feature requests, please use the GitHub Issues page.
Built with ❤️ for the Solana ecosystem