Skip to content

TradeSEB/Raydium-Copytrading-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raydium Copytrading Bot

Solana/Raydium copytrading bot that:

  • Streams target wallet transactions.
  • Detects Raydium swaps for LaunchLab, AMM, CPMM, and CLMM programs.
  • Copies target buy transactions (buy same token).
  • Supports two sell modes:
    • AUTO_SELL=true: use your own TP/SL sell logic.
    • AUTO_SELL=false: copy target wallet sell behavior.
  • Includes fund gathering script to consolidate SPL + SOL from child wallets.

Features

  • Streaming monitor with Solana onLogs subscription.
  • Raydium protocol detection via known program IDs.
  • Copy-buy execution using Raydium transaction API.
  • Auto-sell by configurable take-profit / stop-loss.
  • Copy-sell mode with full or proportional sell replication.
  • Fund gather utility for treasury consolidation.

Quick Start

1) Install

npm install

2) Configure

Copy .env.example to .env and fill values:

cp .env.example .env

Required minimum:

  • RPC_URL
  • PRIVATE_KEY
  • TARGET_WALLET

3) Run

npm run dev

Build production:

npm run build
npm start

Environment Variables

Variable Description
RPC_URL Solana HTTPS RPC endpoint
WS_URL Solana WS endpoint (optional)
PRIVATE_KEY Your bot wallet secret key (base58)
TARGET_WALLET Wallet to copy
COPY_RATIO Multiplier for copied trade sizes
COPY_BUY_MODE TARGET_AMOUNT or FIXED_AMOUNT
FIXED_BUY_AMOUNT Used when fixed buy mode is selected
COPY_SELL_MODE FULL or PROPORTIONAL for sell-copy mode
AUTO_SELL true to use TP/SL, false to copy target sells
TAKE_PROFIT_PCT TP threshold (%)
STOP_LOSS_PCT SL threshold (%)
PRICE_POLL_INTERVAL_MS Auto-sell polling interval
SLIPPAGE_BPS Swap slippage in bps
PRIORITY_FEE_MICRO_LAMPORTS Priority fee for trade txs
QUOTE_MINTS Comma list of quote mints for buy/sell inference
DEFAULT_SELL_QUOTE_MINT Quote mint used for bot sell actions
RAYDIUM_API_URL Raydium transaction API URL
CHILD_PRIVATE_KEYS Comma-separated base58 keys for gather script
TREASURY_WALLET Treasury address for gathered funds
MIN_SOL_RESERVE SOL kept in child wallet during gather

Fund Gathering

Gather SPL + SOL to treasury:

npm run gather:funds

Requirements:

  • CHILD_PRIVATE_KEYS configured
  • TREASURY_WALLET configured

Architecture

  • src/services/wallet-stream.ts - target wallet stream (onLogs).
  • src/raydium/tx-parser.ts - protocol detection + buy/sell signal extraction.
  • src/raydium/swap-executor.ts - swap execution via Raydium API.
  • src/services/copytrader.ts - copy logic + auto-sell engine.
  • src/scripts/gather-funds.ts - treasury fund consolidation.

Important Notes

  • Run on mainnet at your own risk. Start with tiny size.
  • Raydium APIs and program IDs can evolve; keep constants updated.
  • Copytrading can fail due to slippage, routing changes, and latency.
  • Always test on a funded dev wallet before larger usage.

📞 Support

Releases

No releases published

Packages

 
 
 

Contributors