πŸ€–trading bot

Pump.fun Trading Bot Documentation

Overview

The Pump.fun Trading Bot is a real-time trading automation tool that detects newly launched tokens on Pump.fun, buys them as soon as they launch, monitors their prices, and sells them when a target profit is achieved.

Features

  1. Real-Time Token Detection:

    • Listens to Pump.fun's WebSocket for new token launches.

    • Immediately processes and notifies about new tokens.

  2. Automated Buying:

    • Automatically buys a specified amount of SOL for newly detected tokens.

  3. Profit Monitoring:

    • Monitors token prices in real-time and sells them when a target profit (e.g., 50%) is reached.

  4. Discord Notifications:

    • Sends updates to a specified Discord channel for:

      • New token launches.

      • Successful token purchases.

      • Token sales.


Installation

1. Prerequisites

  • Python 3.8 or higher.

  • Pip (Python package manager).

  • Access to a server or local machine to run the bot.

2. Clone the Repository

3. Install Dependencies

4. Set Environment Variables

Create a .env file in the root directory with the following variables:

Replace your_discord_bot_token, your_discord_channel_id, your_wallet_public_key, and your_wallet_private_key with your actual values.

5. Run the Bot


Configuration

Key Parameters

  • BUY_AMOUNT_SOL:

    • Amount of SOL to spend on each token purchase.

    • Default: 0.001.

  • SLIPPAGE:

    • The maximum allowable slippage for token trades.

    • Default: 10.

  • PROFIT_MULTIPLIER:

    • The profit target multiplier for selling tokens (e.g., 1.5 for 50% profit).

    • Default: 1.5.

Modify these values in the bot script to customize behavior.


How It Works

1. Real-Time Token Detection

  • The bot establishes a WebSocket connection to Pump.fun.

  • Subscribes to new token events and listens for real-time updates.

  • For each detected token:

    • Sends a notification to Discord.

    • Attempts to buy the token.

2. Automated Buying

  • When a new token is detected:

    • The bot sends a buy request to the Pump.fun trading API.

    • Logs the transaction and stores the token’s details for monitoring.

3. Price Monitoring

  • After buying a token, the bot tracks its price in real-time.

  • If the price reaches the target profit (e.g., 1.5x the buy price), the bot initiates a sell transaction.

4. Selling Tokens

  • When the profit condition is met:

    • The bot sends a sell request to the Pump.fun API.

    • Notifies the Discord channel about the sale.


Discord Notifications

Examples

New Token Detected

Token Bought

Token Sold


File Structure


Troubleshooting

Common Issues

  1. WebSocket Connection Fails:

    • Ensure Pump.fun WebSocket endpoint (PUMP_FUN_WEBSOCKET) is correct.

    • Check your internet connection or server firewall settings.

  2. API Key Issues:

    • Verify PUBLIC_KEY and PRIVATE_KEY are set correctly in the .env file.

    • Ensure your wallet has sufficient SOL balance.

  3. Discord Notifications Not Sending:

    • Ensure the bot is added to the Discord server with the correct permissions.

    • Verify DISCORD_CHANNEL_ID matches the target channel.

  4. Bot Doesn't Trade:

    • Check the buy/sell API endpoints for correctness.

    • Ensure sufficient SOL is available in your wallet.


Future Enhancements

  • Dynamic Profit Targets:

    • Allow users to set different profit targets for individual tokens.

  • Stop-Loss Functionality:

    • Automatically sell tokens to minimize losses if prices drop significantly.

  • Enhanced Monitoring:

    • Add more granular price tracking with alerts for specific thresholds.


License

This project is licensed under the MIT License.

Last updated