polymarket-openclaw-ai-btc-arbitrage-trading-bot  by lorine93s

AI-powered prediction market trading bot for CLOB arbitrage

Created 6 months ago
327 stars

Top 83.4% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides an automated trading bot for Polymarket's BTC 5m/15m Up/Down markets, leveraging CLOB arbitrage. It targets developers building prediction market bots in TypeScript and traders experimenting with short-horizon strategies, offering automated execution with robust risk management and an optional AI-driven decision layer for signal exploration.

How It Works

The system is built in TypeScript/Node.js, polling Polymarket's CLOB for UP and DOWN token prices. Trades are executed based on deterministic rules defined in trade.toml (e.g., time/price exits, range entries) or an optional, pluggable OpenClaw-style decision module. This module can operate deterministically or via an HTTP endpoint for LLM integration. The architecture features a market loop that resolves market data, polls prices, makes trading decisions, and submits orders via a v2 CLOB client with built-in retry policies and error handling.

Quick Start & Requirements

  • Prerequisites: Node.js ≥ 20.6, a Polygon wallet with a private key and funder/proxy deposit address, and a small USDC balance for trading experiments.
  • Installation: Clone the repository, navigate into the directory, and run npm install.
  • Configuration: Copy .env.example to .env and populate required environment variables (e.g., POLYMARKET_PRIVATE_KEY, POLYMARKET_FUNDER_ADDRESS). Edit trade.toml to specify the market coin (e.g., btc), market period (e.g., 5 or 15), trading strategy (trade_1 or trade_2), notional trade size (trade_usd), and risk parameters like max_retries and entry_buy_cooldown_sec.
  • Running: Use npm run dev for development or npm run build followed by npm start for production-style execution.

Highlighted Details

  • Features an optional OpenClaw-style decision engine (deterministic or HTTP/LLM) that runs alongside rule-based logic.
  • Implements strict risk-management gates, including cooldowns, retries, and safety locks.
  • Provides operator-focused logging with structured output, emojiprint-logger, and console legends for trends and positions.
  • Supports configuration for various market coins (BTC, ETH, SOL, XRP) and time periods (5m, 15m, 60m, 240m, 1440m).

Maintenance & Community

No specific details regarding maintainers, community channels (like Discord or Slack), or project roadmap are provided in the README.

Licensing & Compatibility

The project is licensed under the ISC license. It is provided "as is" with no warranty, and users are advised to use it at their own risk. Compatibility for commercial use is not explicitly detailed beyond the permissive nature of the ISC license.

Limitations & Caveats

This is not a "risk-free" arbitrage bot; execution risks such as slippage, partial fills, API errors, and fast-moving markets can lead to financial losses. The bot trades one market window per configuration and does not implement synchronized dual-window arbitrage. Users should employ a dedicated wallet with funds they can afford to lose and ensure compliance with local laws and Polymarket's terms of service.

Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
1
Star History
268 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.