A market making bot for Polymarket prediction markets. This bot automates the process of providing liquidity to markets on Polymarket by maintaining orders on both sides of the book with configurable parameters. A summary of my experience running this bot is available here
Poly-Maker is a comprehensive solution for automated market making on Polymarket. It includes:
- Real-time order book monitoring via WebSockets
- Position management with risk controls
- Customizable trade parameters fetched from Google Sheets
- Automated position merging functionality
- Sophisticated spread and price management
The repository consists of several interconnected modules:
poly_data: Core data management and market making logicpoly_merger: Utility for merging positions (based on open-source Polymarket code)poly_stats: Account statistics trackingpoly_utils: Shared utility functionsdata_updater: Separate module for collecting market information
- Python 3.9.10 or higher
- Node.js (for poly_merger)
- Google Sheets API credentials
- Polymarket account and API credentials
This project uses UV for fast, reliable package management.
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or with pip
pip install uv# Install all dependencies
uv sync
# Install with development dependencies (black, pytest)
uv sync --extra dev# Run the market maker (recommended)
uv run python main.py
# Update market data
uv run python update_markets.py
# Update statistics
uv run python update_stats.pygit clone https://github.com/yourusername/poly-maker.git
cd poly-makeruv synccd poly_merger
npm install
cd ..cp .env.example .envEdit the .env file with your credentials:
PK: Your private key for PolymarketBROWSER_ADDRESS: Your wallet address
Important: Make sure your wallet has done at least one trade through the UI so that the permissions are proper.
- Create a Google Service Account and download credentials to the main directory
- Copy the sample Google Sheet
- Add your Google service account to the sheet with edit permissions
- Update
SPREADSHEET_URLin your.envfile
Run the market data updater to fetch all available markets:
uv run python update_markets.pyThis should run continuously in the background (preferably on a different IP than your trading bot).
- Add markets you want to trade to the "Selected Markets" sheet
- Select markets from the "Volatility Markets" sheet
- Configure parameters in the "Hyperparameters" sheet (default parameters that worked well in November are included)
uv run python main.pyThe bot is configured via a Google Spreadsheet with several worksheets:
- Selected Markets: Markets you want to trade
- All Markets: Database of all markets on Polymarket
- Hyperparameters: Configuration parameters for the trading logic
The poly_merger module is a particularly powerful utility that handles position merging on Polymarket. It's built on open-source Polymarket code and provides a smooth way to consolidate positions, reducing gas fees and improving capital efficiency.
- This code interacts with real markets and can potentially lose real money
- Test thoroughly with small amounts before deploying with significant capital
- The
data_updateris technically a separate repository but is included here for convenience
MIT