Skip to content

soenasynder/copy-trader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔱 Solana MEV Bot (Copy Trader) (Raydium + Jito + gRPC)

A Solana trading bot that listens to transaction events, identifies buy transactions, evaluates profit/loss conditions, and performs automated trading using Raydium SDK, Jito block engine bundles, and gRPC stream subscription.


📦 Features

  • Detects buy transactions across multiple wallet addresses via gRPC
  • Automatically places buy orders on new mints if profit conditions are met
  • Monitors token price via Raydium liquidity pool
  • Evaluates take-profit, stop-loss, and expiry conditions
  • Sends sell transactions via Jito bundles for MEV inclusion
  • Uses PriceListenerMint to reactively listen to token price changes
  • Built-in position manager for active trades

🛠️ Tech Stack


🚀 Quick Start

1. Clone the Repository

git clone https://github.com/Sandwich-Co/copy-trader.git cd copy-trader

2. Install Dependencies

npm install

3. Environment Setup

Replace the private key and RPC/grpc endpoints as needed in main.ts:

let botKp = Keypair.fromSecretKey(bs58.decode("<YOUR_PRIVATE_KEY>")); let rpcUrl = "https://mainnet.helius-rpc.com/?api-key=<YOUR-API-KEY>"; let grpcUrl = "https://your.grpc.endpoint";

You can toggle isVps to switch between local and production endpoints.

4. Run the Bot

npx ts-node src/main.ts

🧠 Bot Logic Overview

  1. Initialization:

    • Initializes Raydium SDK and Jito client.
    • Fetches LP info and sets up gRPC subscription.
  2. Buy Logic:

    • On detecting a buy transaction (from external wallets), it checks if the mint is new and not seen before.
    • Builds a buy transaction using Raydium SDK.
    • Signs and sends the transaction through Jito bundles.
  3. Position Tracking:

    • Each buy initializes a Position with stop-loss, take-profit, and expiry conditions.
    • Uses PriceListenerMint to track price updates.
  4. Sell Logic:

    • If position value exceeds thresholds or expires, the bot builds a sell transaction and submits it via Jito.
  5. Cleanup:

    • If a sell is detected from own wallet, it removes position and stops listener.

🧾 Wallet Management

List of wallet addresses to monitor can be modified via the wallets array in main.ts. These addresses will be included in the gRPC transaction stream filter.


⚠️ Security Notice

  • Keep your bot private key secure.
  • Do not commit or share your private key.
  • Monitor Jito and gRPC endpoints for rate limits or access issues.

📄 License

MIT License

About

Solana Trading Bot (Whale Strategic Copy Trader)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%