A Solana copy trading bot that monitors a target wallet and automatically executes trades on Meteora DEX (DBC, DAMM v1, v2, DLMM) when the target wallet makes transactions.
- Real-time Transaction Monitoring: Uses Yellowstone gRPC to stream transactions from target wallet
- Instant Copy Trading: Automatically buys/sells when target wallet executes trades
- Meteora DEX Support: Supports all Meteora pool types (DBC, DAMM v1, DAMM v2, DLMM)
- Stop Loss & Take Profit: Configurable stop loss and take profit logic (when own sell logic is enabled)
- Fast Execution: Uses Helius RPC for blockhash retrieval and Jito for transaction confirmation
- Position Management: Tracks positions and manages risk automatically
- Node.js 18+ and npm/yarn
- Solana wallet with SOL for trading and fees
- Yellowstone gRPC API access
- Helius RPC API key
- Jito access (optional but recommended for faster confirmations)
- Clone the repository:
git clone <repository-url>
cd Meteora-Copytrading-Bot- Install dependencies:
npm install- Copy
.env.exampleto.env:
cp .env.example .env-
Configure your
.envfile with your credentials (see Configuration section) -
Build the project:
npm run buildEdit the .env file with your configuration:
PRIVATE_KEY: Your wallet's private key (base58 encoded)TARGET_WALLET_ADDRESS: The wallet address you want to copy trades fromYELLOWSTONE_GRPC_URL: Your Yellowstone gRPC endpoint (e.g.,grpc://your-endpoint:10000)HELIUS_RPC_URL: Your Helius RPC URL with API key
YELLOWSTONE_API_KEY: API key for Yellowstone (if required)OWN_SELL_LOGIC_ENABLED: Enable stop loss/take profit (default:true)STOP_LOSS_PERCENTAGE: Stop loss percentage (default:5.0)TAKE_PROFIT_PERCENTAGE: Take profit percentage (default:10.0)MAX_POSITION_SIZE_SOL: Maximum position size in SOL (default:1.0)MIN_POSITION_SIZE_SOL: Minimum position size in SOL (default:0.01)
See .env.example for all available configuration options.
npm run devnpm run build
npm startnpm run watch- Transaction Monitoring: The bot subscribes to Yellowstone gRPC stream for the target wallet
- Trade Detection: When a transaction is detected, it parses the transaction to identify Meteora trades
- Copy Execution:
- On BUY: Executes a buy order for the same token/pool
- On SELL: Executes a sell order if we have a position
- Position Management:
- Tracks all open positions
- Monitors prices for stop loss/take profit (if enabled)
- Automatically sells when conditions are met
src/
├── index.ts # Main entry point
├── config.ts # Configuration loader
├── types.ts # TypeScript type definitions
├── clients/
│ ├── yellowstone.ts # Yellowstone gRPC client
│ ├── helius.ts # Helius RPC client
│ └── jito.ts # Jito transaction client
├── dex/
│ └── meteora.ts # Meteora DEX integration
├── trading/
│ ├── copyTrader.ts # Main copy trading logic
│ └── positionManager.ts # Position tracking and risk management
└── utils/
└── logger.ts # Logging utility
When OWN_SELL_LOGIC_ENABLED=true:
- Stop Loss: Automatically sells when price drops by the configured percentage from entry price
- Take Profit: Automatically sells when price increases by the configured percentage from entry price
The bot checks positions every 5 seconds and executes sells when conditions are met.
- Get latest blockhash from Helius RPC
- Create and sign transaction
- Send transaction via Solana RPC
- Confirm transaction via Jito (for faster confirmation)
- Update position tracking
- Never commit your
.envfile - it contains sensitive private keys - Use a dedicated trading wallet with limited funds
- Regularly monitor your positions and bot activity
- Set appropriate stop loss levels to limit risk
- Test on devnet first before using mainnet
- Verify Yellowstone gRPC connection is working
- Check that target wallet address is correct
- Ensure target wallet is making Meteora trades
- Check wallet has sufficient SOL for fees
- Verify RPC endpoints are accessible
- Check network congestion (may need higher priority fees)
- Ensure
OWN_SELL_LOGIC_ENABLED=true - Verify price fetching is working
- Check position tracking is correct
The bot is built with TypeScript and follows a modular architecture:
- Clients: External service integrations (Yellowstone, Helius, Jito)
- DEX: Meteora DEX integration and trade parsing
- Trading: Core trading logic and position management
- Utils: Shared utilities (logging, etc.)
The current implementation includes placeholder swap instructions in src/dex/meteora.ts. For production use, you need to:
- Install Meteora SDK: The package.json includes
@meteora-ag/sdkand@meteora-ag/dlmmdependencies - Implement Real Swaps: Replace the
createSwapInstructionmethod with actual Meteora SDK calls:- For DLMM pools: Use
@meteora-ag/dlmmSDK - For DAMM/DBC pools: Use
@meteora-ag/sdk - Fetch pool state and construct proper swap instructions
- For DLMM pools: Use
- Transaction Parsing: Enhance
parseTransactionForTradeto accurately parse Meteora swap transactions and extract:- Token mints
- Swap amounts
- Buy/sell direction
- Pool addresses
The transaction parsing logic in MeteoraDEX.parseTransactionForTrade() is simplified. For production:
- Analyze account balance changes to determine buy/sell
- Parse instruction data to extract exact amounts
- Validate pool addresses and program IDs
- Handle different Meteora pool types correctly
The getTokenPrice() method currently returns a placeholder. Implement:
- Fetch pool reserves from on-chain data
- Calculate price based on pool type (constant product, concentrated liquidity, etc.)
- Use a reliable price oracle service for accurate stop loss/take profit
- Meteora SDK Integration: Integrate official Meteora SDKs for proper swap execution
- Enhanced Transaction Parsing: Improve transaction parsing to accurately detect buy/sell signals
- Price Oracle: Add reliable price fetching for accurate stop loss/take profit
- Risk Management: Add position sizing, max drawdown limits, etc.
- Monitoring: Add webhook notifications, Telegram alerts, etc.
- telegram: https://t.me/trade_SEB
- twitter: https://x.com/TradeSEB_