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.
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.8+
- Node.js (for poly_merger)
- Google Sheets API credentials
- Polymarket account and API credentials
- Clone the repository:
git clone https://github.com/yourusername/poly-maker.git
cd poly-maker
- Install Python dependencies:
pip install -r requirements.txt
- Install Node.js dependencies for the merger:
cd poly_merger
npm install
cd ..
- Set up your environment variables by copying the example file:
cp .env.example .env
- Edit the
.envfile with your credentials:
PK: Your private key for PolymarketBROWSER_ADDRESS: Your wallet addressSPREADSHEET_URL: URL to your Google Sheets configuration
- Create a Google Service Account and download credentials:
cp data_updater/credentials.json.example credentials.json
Edit the credentials.json with your Google service account details.
The 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
Before running the main bot, you need to gather market data:
cd data_updater
python find_markets.py
This will populate your Google Sheet with available markets.
Start the market maker:
python main.py
The bot will:
- Connect to Polymarket API
- Subscribe to market data via WebSockets
- Place and manage orders according to your configuration
- Monitor and merge positions when beneficial
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 - The
find_markets.pyscript in the data_updater is essential for the bot to get market information
MIT