How This Bot Works

Architecture, strategy, and execution flow

Paper Mode

Overview

This bot is a Solana memecoin copy-trading & momentum-scanning bot that runs two strategies in parallel on the Solana mainnet:

  • Wallet Copy-Trade — Monitor a curated list of smart-money wallets and mirror their buys/sells in real time via WebSocket and RPC polling.
  • Momentum Scanner — Scan DexScreener and GeckoTerminal every ~60s for early trending tokens with strong buy pressure, then enter positions automatically.

Both strategies share the same RiskManager and TradeExecutor, so position limits, exposure caps, and circuit breakers apply globally.

Core Components

1
main.py
Entry point. Initializes all components, manages the async event loop, runs wallet monitoring + scanner + position monitor concurrently.
2
trade_executor.py
Handles all on-chain swaps via Jupiter API. Includes circuit breaker (blocks buys after too many failures but never blocks sells), balance checks (paper/live), position monitoring with TP/SL/trailing, and atomic transaction handling.
3
risk_manager.py
Enforces daily limits (max trades/day, max concurrent positions, max SOL exposure). Tracks per-token cooldowns and manages open position state with persistence to positions.json.
4
wallet_intelligence.py
Cross-process scoring system for tracked wallets. Uses fcntl file locking for safe concurrent access. Tracks win rate, fast flips, PnL, and produces ranked wallet leaderboard.
5
wallet_monitor.py
Monitors target wallets for new transactions via WebSocket (pump.fun program subscription) + HTTP polling. Extracts mint addresses and triggers copy-trade entry/exit signals.

Scoring & Filtering

A
Wallet Score (0-100)
Each tracked wallet is scored based on win rate, total PnL, fast-flip frequency, profit factor, and recency. Only wallets above MIN_WALLET_SCORE (default 40) are copied.
B
Momentum Score (0-100+)
Scanned tokens are scored on: 5m price action (+15-30pts), buy/sell ratio (+15-25pts), volume acceleration (+10pts), 1H momentum sweet spot (+10-20pts), liquidity quality (+10pts). Penalties for late pumps, rug risk, and negative 5m momentum.
C
On-Chain PnL Verification
Before copying a wallet's trade, the bot fetches the wallet's last 100 transactions and computes FIFO PnL. Wallets below MIN_WALLET_PNL_SOL (0.05 SOL) or with fewer than MIN_WALLET_CLOSED_TRADES (5) are skipped.
D
Token Safety
Each token passes multiple gates: minimum liquidity ($2K), maximum mcap ($15M), minimum 1H change (5%), net positive buy pressure, rug risk scoring (creator behavior, LP burn, honeypot checks), and token state cooldown (failed tokens are blocked for 24h).

Trade Execution Flow

Both strategies
1
Signal Detection
Wallet-monitor detects a new buy/sell tx from a tracked wallet, OR momentum scanner finds a high-scoring token via DexScreener API.
2
Risk Checks
RiskManager validates: daily trade limit, concurrent position cap, total SOL exposure, per-token cooldown, and market conditions (circuit breaker).
3
Token Validation
Token-level filters: minimum liquidity, maximum mcap, rug check, buy pressure ratio, momentum score threshold, and safety checks (honeypot, top-holder concentration).
4
Balance & Duplicate Check
Verifies wallet has sufficient SOL (or uses simulated balance in paper mode). Prevents duplicate buys for the same mint (idempotency via trade key).
5
Execute Buy
Submits swap via Jupiter API. In paper mode, records a simulated position. In live mode, sends a real VersionedTransaction to the Solana network with configured slippage.
6
Position Monitoring & Exit
Every 1.5s, the position monitor checks: take-profit (sell 50% at TP1, remaining at TP2), stop-loss (-12%), trailing stop (15% drop from peak), max hold time (120s), and wallet-sell signals (if the copied wallet exits, the bot follows).

Current Configuration

Trade Size
0.5 SOL
Max Concurrent
2
Max/Day
5 trades
Max Exposure
1.0 SOL
Take Profit
+30% / +130%
Stop Loss
-12%
Trailing Drop
15%
Max Hold
120s
Slippage
15%
Min Wallet Score
40
Min Liq (Momentum)
$2,000
Min PnL (Copy)
0.05 SOL