An AI-powered trading bot that autonomously discovers, buys, monitors, and sells memecoins on pump.fun. Uses xAI (Grok) for coin analysis, trade announcements, and as a reply bot on X.
| Subsystem | Description |
|---|---|
| AI Coin Scanner | Fetches newly launched pump.fun tokens, enriches them with Moralis analytics, and asks Grok to pick the best candidates |
| Buyer | Executes buys via pump.fun AMM, tracks positions, never buys the same token twice |
| Price Monitor | Polls Jupiter + pump.fun for live price, auto-sells at configurable +/- threshold |
| Fee Claimer | Claims creator fees for your own token on a loop |
| X Agent | AI-powered reply bot + trade announcements using the toasteragent persona |
| Metrics Tracker | Monitors your token's on-chain metrics and posts when things improve |
pip install -r requirements.txtCopy the example env file and fill in your keys:
cp .env.example .envRequired variables:
| Variable | Description |
|---|---|
PRIVATE_KEY |
Your Solana wallet private key (base58) |
RPC_URL |
Solana RPC endpoint (Helius, QuickNode, etc.) |
XAI_API_KEY |
xAI API key for Grok (powers the AI scanner + agent) |
Optional but recommended:
| Variable | Description |
|---|---|
MORALIS_API_KEY |
Moralis API key for token analytics |
FEE_CLAIM_CA |
Your token's contract address (for fee claiming) |
X_CONSUMER_KEY / X_CONSUMER_SECRET / X_ACCESS_TOKEN / X_ACCESS_TOKEN_SECRET |
X API credentials for posting tweets |
# Linux/Mac
export $(cat .env | xargs)
python app.py
# Windows (PowerShell)
Get-Content .env | ForEach-Object { if ($_ -match '^\s*([^#]\S+?)=(.*)$') { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } }
python app.py- Fetches the latest coins from pump.fun's live feed
- Enriches each coin with live price (Jupiter/pump.fun) and Moralis analytics (volume, buyers, momentum)
- Sends the data to Grok and asks it to pick the best candidates based on:
- Buy volume > sell volume (bullish pressure)
- Multiple unique buyers
- Market cap $2k–$100k (early but alive)
- Positive price momentum
- Winning picks go into the buy queue
AI Scanner picks coin → Buyer executes swap → Price Monitor tracks → Auto-sell at ±20%
→ Post tweet about trade
The bot saves state to JSON files so it survives restarts:
bought_cas.json— tokens already bought (never re-buys)trades.json— full trade historyreplied_ids.json— X tweet IDs already replied toown_metrics.json— last metrics snapshot for your token
All settings are configurable via environment variables. See .env.example for the full list. Key trading parameters:
| Setting | Default | Description |
|---|---|---|
BUY_AMOUNT_SOL |
0.01 | SOL per buy |
PRICE_CHANGE_THRESHOLD |
20 | Sell trigger (± percent) |
SCAN_INTERVAL |
90 | Seconds between AI scans |
MAX_BUYS_PER_SCAN |
2 | Max tokens to buy per scan cycle |
- pump.fun — token data + AMM swaps via fun-block API
- Jupiter — price feeds (v3 lite API)
- Moralis — token metadata + analytics
- xAI — Grok model for AI analysis + tweet generation
- X API v2 — posting tweets + reading mentions
This is experimental software. Trading memecoins is extremely risky. Use at your own risk. Never trade with more than you can afford to lose.