A PoC of an automated trading bot for Solana tokens using the official Solana Tracker Data API SDK and Swap API.
It supports Raydium V4, Raydium CPMM, Raydium CLMM, Raydium Launchpad, Meteora Curve, Meteora Dynamic (v1 and v2), Meteora DLMM, Pumpfun, Pumpfun AMM, Moonshot, Orca, Boop and Jupiter.
Includes two powerful trading modes:
- HTTP Mode: Traditional polling-based approach using the Data API
- WebSocket Mode: Real-time trading using Solana Tracker's Datastream for instant token discovery and price monitoring
- Real-time Trading: Instant token discovery and price monitoring via WebSocket
- Automated Trading: Hands-free buying and selling based on configurable criteria
- Multi-DEX Support: Trade on Raydium, Orca, Pumpfun, Moonshot, and more
- Advanced Filtering: Filter tokens by liquidity, market cap, risk score, and social presence
- Position Management: Real-time PnL tracking with automatic stop-loss and take-profit
- Parallel Execution: Handle multiple trades simultaneously
- Comprehensive Logging: Color-coded console output with detailed trade information
- Persistent Storage: Maintains position history across restarts
- Rate Limit Handling: Built-in rate limit management and retry logic
- Node.js (v14 or later) or Bun JS (Preferred)
- npm or yarn
- A Solana wallet with SOL
- Solana Tracker API Key from solanatracker.io
- WebSocket URL (for real-time mode) - Available with Premium plans or higher
- Clone the repository:
git clone https://github.com/YZYLAB/solana-trade-bot.git
cd solana-trade-bot
- Install dependencies:
npm install
Or using the official SDK directly:
npm install @solana-tracker/data-api
- Configure your environment:
cp .env.example .env
# Edit .env with your configuration
node index.js
node websocket.js
Configure the bot by editing your .env
file:
# API Credentials
SOLANA_TRACKER_API_KEY=your_api_key_here
SOLANA_TRACKER_WS_URL=your_websocket_url_here # For WebSocket mode
# Wallet
PRIVATE_KEY=your_wallet_private_key
# Trading Settings
AMOUNT=0.01 # Amount of SOL per trade
SLIPPAGE=15 # Maximum slippage percentage
PRIORITY_FEE=0.00001 # Priority fee in SOL
JITO=false # Enable Jito bundles
# Position Management
MAX_POSITIONS=10 # Maximum concurrent positions
MAX_NEGATIVE_PNL=-50 # Stop loss percentage
MAX_POSITIVE_PNL=100 # Take profit percentage
# Token Filters
MIN_LIQUIDITY=1000 # Minimum liquidity in USD
MAX_LIQUIDITY=100000 # Maximum liquidity in USD
MIN_MARKET_CAP=10000 # Minimum market cap in USD
MAX_MARKET_CAP=1000000 # Maximum market cap in USD
MIN_RISK_SCORE=0 # Minimum risk score (0-10)
MAX_RISK_SCORE=7 # Maximum risk score (0-10)
MIN_HOLDERS=10 # Minimum number of holders
REQUIRE_SOCIAL_DATA=false # Require social media presence
# Markets to trade on (comma-separated)
MARKETS=raydium,orca,pumpfun,moonshot,raydium-cpmm
# Monitoring Intervals
DELAY=5000 # Delay between scans (HTTP mode)
MONITOR_INTERVAL=30000 # Position monitoring interval
# Debugging
DEBUG=true # Enable detailed logging
# RPC Configuration
RPC_URL=https://rpc-mainnet.solanatracker.io/?api_key=xxxx
This bot uses the official @solana-tracker/data-api SDK, providing:
- Type-safe API calls with full TypeScript support
- Built-in error handling and rate limit management
- Automatic retries with exponential backoff
- WebSocket support for real-time data streaming
- Comprehensive token and wallet data access
- Real-time Datastream: WebSocket connections for instant updates
- Token Discovery: Latest tokens, trending tokens, and custom searches
- Price Monitoring: Real-time price feeds and historical data
- Risk Analysis: Built-in risk scoring and holder analytics
- Multi-token Support: Batch operations for efficiency
Feature | HTTP Mode | WebSocket Mode |
---|---|---|
Token Discovery | 1-second polling | Real-time (instant) |
Price Updates | On-demand | Live streaming |
API Usage | Higher | Minimal |
Response Time | Seconds | Milliseconds |
Best For | Testing/Low-volume | Production trading |
- Never share your private key or API credentials
- Use a dedicated trading wallet with limited funds
- Test with small amounts first
- Monitor the bot regularly
- Keep your dependencies updated
- Use WebSocket mode for production trading
- Adjust filters based on market conditions
- Monitor API usage to stay within limits
- Enable debug mode to understand filtering decisions
- Use multiple RPC endpoints for redundancy
"No tokens found"
- Filters may be too restrictive
- Enable
DEBUG=true
to see why tokens are filtered
"Rate limit exceeded"
- Upgrade your Solana Tracker plan
- Increase delay between requests
"Transaction failed"
- Check wallet balance
- Increase slippage
- Try different RPC endpoint
This bot is for educational purposes only. Cryptocurrency trading carries significant risk. Always:
- Understand the code before running it
- Start with small amounts
- Never invest more than you can afford to lose
- Do your own research
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
If you find this project helpful:
- Give it a star on GitHub
- Share it with others
- Report issues and suggest features
- Consider supporting the developers
- v2.0: Migrated to official Solana Tracker Data API SDK
- v1.0: Initial release with HTTP polling and Datastream
Built using the Solana Tracker Data API