Skip to content

Auto solana trading bot on pumpfun, pumpswap, raydium launchpad using gRPC or shredstream solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot

Notifications You must be signed in to change notification settings

radioman/Auto-solana-trading-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 

Repository files navigation

πŸš€ Solana PumpPortal Trading Bot

Solana TypeScript Node.js WebSocket

Advanced automated trading bot for Solana tokens using PumpPortal WebSocket feeds

Features β€’ Installation β€’ Configuration β€’ Usage β€’ API β€’ Contributing


✨ Features

πŸ”₯ Core Trading Features

  • Real-time Token Detection: Monitors PumpPortal WebSocket for new token launches
  • Automated Trading: Executes buy/sell orders based on market conditions
  • Risk Management: Built-in stop-loss and take-profit mechanisms
  • Position Tracking: Monitors active positions and PnL in real-time
  • Multi-token Support: Handles multiple concurrent token positions

πŸ›‘οΈ Safety & Security

  • Slippage Protection: Configurable slippage tolerance for trades
  • Liquidity Checks: Validates minimum liquidity before trading
  • Error Handling: Comprehensive error handling and recovery
  • Rate Limiting: Built-in rate limiting to prevent API abuse

πŸ“Š Monitoring & Analytics

  • Real-time Logging: Detailed logging with configurable levels
  • Telegram Notifications: Get notified of trades, errors, and status updates
  • Portfolio Tracking: Track total PnL and trade statistics
  • Performance Metrics: Monitor success rates and profitability

πŸ”§ Technical Features

  • TypeScript: Fully typed for better development experience
  • Modular Architecture: Clean, maintainable code structure
  • WebSocket Reconnection: Automatic reconnection with exponential backoff
  • Transaction Optimization: Optimized for Solana's transaction model

πŸš€ Installation

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • Solana Wallet with SOL for trading
  • Telegram Bot (optional, for notifications)

Quick Start

  1. Clone the repository

    git clone https://github.com/radioman/Auto-solana-trading-bot.git
    cd Auto-solana-trading-bot
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Set up environment variables

    cp env.example .env
  4. Configure your environment Edit .env file with your settings:

    # Required
    PRIVATE_KEY=your_base58_private_key_here
    
    # Optional
    RPC_ENDPOINT=https://api.mainnet-beta.solana.com
    BUY_AMOUNT_SOL=0.01
    MAX_CONCURRENT_TRADES=5
    TELEGRAM_BOT_TOKEN=your_telegram_bot_token
    TELEGRAM_CHAT_ID=your_telegram_chat_id
  5. Build and run

    # Development
    npm run dev
    
    # Production
    npm run build
    npm start

βš™οΈ Configuration

Environment Variables

Variable Description Default Required
PRIVATE_KEY Base58 encoded Solana private key - βœ…
RPC_ENDPOINT Solana RPC endpoint https://api.mainnet-beta.solana.com ❌
COMMITMENT_LEVEL Transaction commitment level confirmed ❌
BUY_AMOUNT_SOL SOL amount per trade 0.01 ❌
MAX_CONCURRENT_TRADES Maximum concurrent positions 5 ❌
STOP_LOSS_PERCENTAGE Stop loss percentage 20 ❌
TAKE_PROFIT_PERCENTAGE Take profit percentage 50 ❌
TELEGRAM_BOT_TOKEN Telegram bot token - ❌
TELEGRAM_CHAT_ID Telegram chat ID - ❌
SOLANA_VIBE_STATION_API_KEY API key for token metadata - ❌

Trading Configuration

You can modify trading parameters in src/constants/index.ts:

export const BUY_AMOUNT_SOL = 0.01;           // SOL per trade
export const MAX_CONCURRENT_TRADES = 5;       // Max positions
export const STOP_LOSS_PERCENTAGE = 20;       // Stop loss %
export const TAKE_PROFIT_PERCENTAGE = 50;     // Take profit %

🎯 Usage

Basic Usage

# Start the bot
npm run dev

# Or build and run
npm run build
npm start

Advanced Usage

import { SolanaTradingBot } from './src/index';

const bot = new SolanaTradingBot();

// Start trading
await bot.start();

// Get current status
const status = bot.getStatus();
console.log(status);

// Stop trading
await bot.stop();

Monitoring

The bot provides real-time monitoring through:

  1. Console Logs: Detailed logging with timestamps
  2. Telegram Notifications: Real-time alerts and updates
  3. Status Endpoint: Programmatic status checking

πŸ“Š API Reference

TradingBot Class

Methods

  • start(): Start the trading bot
  • stop(): Stop the trading bot
  • getState(): Get current bot state
  • getConfig(): Get current configuration
  • updateConfig(config): Update trading configuration

State Object

interface BotState {
  isRunning: boolean;
  activeTrades: Map<string, TokenPosition>;
  totalPnl: number;
  totalTrades: number;
  successfulTrades: number;
  failedTrades: number;
}

PumpPortalService Class

Methods

  • connect(): Connect to PumpPortal WebSocket
  • disconnect(): Disconnect from WebSocket
  • isWebSocketConnected(): Check connection status

Events

  • trade: Emitted when a new trade is detected
  • error: Emitted when an error occurs

πŸ”§ Development

Project Structure

src/
β”œβ”€β”€ constants/          # Configuration constants
β”œβ”€β”€ services/           # External service integrations
β”‚   β”œβ”€β”€ pumpportal.ts  # PumpPortal WebSocket client
β”‚   β”œβ”€β”€ telegram.ts    # Telegram notification service
β”‚   └── tokenService.ts # Token metadata service
β”œβ”€β”€ trading/            # Core trading logic
β”‚   └── tradingBot.ts  # Main trading bot class
β”œβ”€β”€ types/              # TypeScript type definitions
β”œβ”€β”€ utils/              # Utility functions
β”‚   β”œβ”€β”€ helpers.ts     # Helper functions
β”‚   └── logger.ts      # Logging utility
└── index.ts           # Main entry point

Building

# Build TypeScript
npm run build

# Watch mode
npm run watch

# Clean build
npm run clean

Testing

# Run tests (when implemented)
npm test

# Run with coverage
npm run test:coverage

πŸ›‘οΈ Security Considerations

Wallet Security

  • Never commit private keys to version control
  • Use environment variables for sensitive data
  • Consider using a hardware wallet for large amounts
  • Regularly rotate keys and monitor transactions

Trading Risks

  • Start with small amounts to test the bot
  • Monitor performance regularly
  • Set appropriate stop-losses to limit downside
  • Understand the risks of automated trading

Best Practices

  • Test on devnet before mainnet
  • Monitor logs for errors and anomalies
  • Keep the bot updated with latest changes
  • Backup your configuration regularly

πŸ“ˆ Performance Tips

Optimization

  1. Use a fast RPC endpoint for better performance
  2. Monitor memory usage for long-running instances
  3. Adjust trade frequency based on market conditions
  4. Use appropriate slippage settings for your strategy

Monitoring

  1. Set up alerts for critical errors
  2. Monitor PnL regularly
  3. Check transaction success rates
  4. Review trade logs for patterns

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

How to Contribute

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests (if applicable)
  5. Submit a pull request

Development Setup

# Fork and clone
git clone https://github.com/radioman/Auto-solana-trading-bot.git
cd Auto-solana-trading-bot

# Install dependencies
npm install

# Create feature branch
git checkout -b feature/your-feature-name

# Make changes and test
npm run dev

# Submit PR
git push origin feature/your-feature-name

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

This software is for educational purposes only. Trading cryptocurrencies involves substantial risk of loss and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade cryptocurrencies, you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with cryptocurrency trading and seek advice from an independent financial advisor if you have any doubts.


πŸ†˜ Support

Getting Help

Common Issues

  1. Connection Issues: Check your RPC endpoint and internet connection
  2. Transaction Failures: Verify wallet balance and gas settings
  3. WebSocket Disconnections: Check network stability and reconnection settings

Made with ❀️ for the Solana community

⭐ Star this repo β€’ πŸ› Report Bug β€’ πŸ’‘ Request Feature

About

Auto solana trading bot on pumpfun, pumpswap, raydium launchpad using gRPC or shredstream solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot solana trading bot

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published