Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Pumpfun Trading Contest

Build a trading algorithm that maximizes profit on historical Pumpfun token trades.

Quick Start

# Install dependencies
pip install -r requirements.txt

# Run evaluation (uses pre-built trades.duckdb)
python eval.py --db trades.duckdb

How It Works

  1. The evaluation engine streams historical trades to your algorithm one at a time
  2. For each trade, your algorithm decides: BUY or NO_ACTION
  3. When you BUY, you spend 1 SOL to acquire tokens at the current AMM price
  4. Your position auto-sells after 1500 slots (~10 minutes) at the prevailing price
  5. Your profit/loss is calculated and aggregated across all trades

What to Edit

algo.py - This is the ONLY file you should modify.

def algo(trade: Dict[str, Any], state: Dict[str, Any]) -> Action:
    # Your strategy here
    return Action.NO_ACTION  # or Action.BUY

Trade Data Available

Each trade dict contains:

Field Description
mint Token address
slot Solana slot number
sol_amount SOL amount in lamports (1 SOL = 1e9)
token_amount Token amount
is_buy 1 for buy, 0 for sell
virtual_sol_reserves AMM virtual SOL reserves
virtual_token_reserves AMM virtual token reserves
user Wallet address
signature Transaction signature

State Management

  • state is a mutable dict persisted across calls for the same token
  • Each token gets a fresh state dict - no cross-token state
  • Use it to track patterns, count trades, store indicators, etc.

What NOT to Edit

  • eval.py - The evaluation engine
  • requirements.txt - Dependencies
  • trades.duckdb - Pre-built database (optional, for faster loading)

Running the Evaluation

# Using pre-built database (recommended)
python eval.py --db trades.duckdb

# With more workers for parallel processing
python eval.py --db trades.duckdb --workers 8

Output

The evaluation produces:

  1. Console summary - Total trades, win rate, profit/loss
  2. trades.csv - Detailed log of all executed trades

Example output:

==================================================
EVALUATION RESULTS
==================================================
Total trades executed: 74
  Profitable: 22 (29.7%)
  Losing: 52 (70.3%)
  Breakeven: 0 (0.0%)

Total profit: +7.117070 SOL
Average profit/trade: +0.096176623 SOL

Best trade: +7.721855 SOL (mint: 7RpskwFd...)
Worst trade: -0.738114 SOL (mint: Cc4qkHkh...)

Trades excluded (no exit within 1500 slots): 326
==================================================

Scoring

Your algorithm is scored by Total Profit in SOL.

Files

File Description
algo.py Your trading algorithm (EDIT THIS)
eval.py Evaluation engine (DO NOT EDIT)
requirements.txt Python dependencies
trades.duckdb Pre-built database (200K trades, 7,953 tokens)

Good luck!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages