Prerequisites
pnpm package manager
Install pnpm for efficient dependency management:
You can also use
npm or yarn, but the project uses pnpm by default.Git
Installation
Install dependencies
- ws (v8.19.0+) - WebSocket client for Chainlink price feed
- chalk (v5.6.2+) - Terminal UI with colors
- @types/ws (v8.18.1+) - TypeScript definitions for WebSocket types
Project structure
After installation, your project structure will look like:Configuration
The bot works out of the box with default settings inconfig/default.json. Key parameters:
- Engine
- Data feeds
- Risk management
- lambda - EWMA decay factor (0.94 = standard)
- minTicks - Minimum data points before trading (50)
- deadZone - Abstain if base prob within ±10% of 50%
- minAccuracy - Suspend if rolling accuracy < 40%
- minEV - Minimum Expected Value (5%)
- minMargin - Minimum edge in pp (15pp)
You can modify
config/default.json to customize behavior. The bot loads this file at startup via src/config.js.Running the bot
Data sources
The bot connects to these external services:| Source | Purpose | Endpoint |
|---|---|---|
| Polymarket Chainlink | Live BTC/USD price | wss://ws-live-data.polymarket.com |
| Vatic Trading API | Strike prices | api.vatic.trading/api/v1/targets/timestamp |
| Polymarket Gamma API | Market discovery | gamma-api.polymarket.com/events |
| Polymarket CLOB | Market prices | clob.polymarket.com/price |
All data sources are public APIs. No authentication required.
Troubleshooting
WebSocket connection fails
WebSocket connection fails
If you see connection errors:
- Check your internet connection
- Verify Polymarket’s WebSocket is available:
wss://ws-live-data.polymarket.com - Check for firewall blocking WebSocket connections
- The bot automatically reconnects on disconnect
Module not found errors
Module not found errors
If you see ESM import errors:Ensure
package.json has "type": "module".No data directory
No data directory
The The bot will create
data/ directory is created automatically on first run. If missing:history.json and log files as needed.Strike price API errors
Strike price API errors
If Vatic Trading API is unavailable:
- The bot will retry automatically
- Check API status at
api.vatic.trading - Verify your system clock is synchronized (API uses timestamps)
Next steps
Quickstart
Get the bot running in 5 minutes
Configuration
Customize engine parameters and risk settings
How it works
Understanding Black-Scholes, EWMA, and momentum models
API reference
Data feeds, prediction engine, and risk management APIs