polymarket-arbitrage-bot:基于 Python 的 Polymarket 套利交易机器人项目

Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Bot

Branch1Tags0
FilesLast commitLast update
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago

Polymarket Arbitrage Bot

Production-ready Python trading bot for Polymarket with gasless transactions and real-time WebSocket orderbook streaming.

Features

  • Gasless Trading - Builder Program integration for zero gas fees
  • Real-time WebSocket - Live orderbook updates and market data
  • 15-Minute Markets - Built-in support for BTC/ETH/SOL/XRP markets
  • Flash Crash Strategy - Pre-built volatility trading strategy
  • Secure Storage - PBKDF2 + Fernet encrypted private key storage
  • Simple API - Clean, intuitive Python interface

Quick Start

Installation

git clone https://github.com/vladmeer/polymarket-arbitrage-bot.git
cd polymarket-arbitrage-bot
pip install -r requirements.txt

Configuration

Set environment variables:

export POLY_PRIVATE_KEY=your_private_key
export POLY_PROXY_WALLET=0xYourPolymarketProxyWallet

PROXY WALLET: Find at polymarket.com/settings

Quick Start - Orderbook Viewer

View real-time orderbook data (read-only, no trading):

# View ETH market orderbook
python apps/orderbook_viewer.py --coin ETH

image (1)

Note: Orderbook viewer doesn't require credentials - it's a read-only monitoring tool.

Quick Start - Flash Crash Strategy

Run the automated trading strategy:

# Run with default settings (ETH, $5 size, 30% drop threshold)
python apps/flash_crash_runner.py --coin ETH

image (2)

Note: Flash crash strategy requires POLY_PRIVATE_KEY and POLY_PROXY_WALLET environment variables.

Trading Strategies

Flash Crash Strategy

Monitors 15-minute markets for sudden probability drops and executes trades automatically.

# Default settings
python apps/flash_crash_runner.py --coin BTC

Parameters:

  • --coin - BTC, ETH, SOL, XRP (default: ETH)
  • --drop - Drop threshold (default: 0.30)
  • --size - Trade size in USDC (default: 5.0)
  • --lookback - Detection window in seconds (default: 10)
  • --take-profit - Take profit in dollars (default: 0.10)
  • --stop-loss - Stop loss in dollars (default: 0.05)

Orderbook Viewer

Real-time orderbook visualization:

python apps/orderbook_viewer.py --coin BTC

Usage Examples

Basic Usage

from src import create_bot_from_env
import asyncio

async def main():
    bot = create_bot_from_env()
    orders = await bot.get_open_orders()
    print(f"Open orders: {len(orders)}")

asyncio.run(main())

Place Order

from src import TradingBot, Config

bot = TradingBot(config=Config(safe_address="0x..."), private_key="0x...")
result = await bot.place_order(token_id="...", price=0.65, size=10.0, side="BUY")

WebSocket Streaming

from src.websocket_client import MarketWebSocket

ws = MarketWebSocket()
ws.on_book = lambda s: print(f"Price: {s.mid_price:.4f}")
await ws.subscribe(["token_id"])
await ws.run()

Configuration

Environment Variables

Variable Required Description
POLY_PRIVATE_KEY Yes Wallet private key
POLY_PROXY_WALLET Yes Polymarket Proxy wallet address
POLY_BUILDER_API_KEY Optional Builder Program API key (gasless)
POLY_BUILDER_API_SECRET Optional Builder Program API secret
POLY_BUILDER_API_PASSPHRASE Optional Builder Program passphrase

Gasless Trading

Enable gasless trading via Builder Program:

  1. Apply at polymarket.com/settings?tab=builder
  2. Set environment variables: POLY_BUILDER_API_KEY, POLY_BUILDER_API_SECRET, POLY_BUILDER_API_PASSPHRASE

The bot automatically uses gasless mode when credentials are present.

Security

Private keys are encrypted using PBKDF2 (480,000 iterations) + Fernet symmetric encryption. Best practices:

  • Never commit .env files
  • Use a dedicated trading wallet
  • Keep encrypted key files secure (permissions: 0600)

License

MIT License - see LICENSE file for details.

Trading tool

I've also developed a trading bot for Polymarket built with Rust.

image (21)

https://www.youtube.com/watch?v=4f6jHT4-DQs

Recommend VPS

Vps: @TradingVps 534038982-fb311b59-05a6-477a-a8f0-5e8291acf1eb

Version 2 - Dutch Book Arbitrage Tool

I built Polymarket Dutch Book Arbitrage Bot - An automated trading system that detects guaranteed-profit opportunities in Polymarket's binary markets. When UP + DOWN token prices sum to less than 1.0, the bot simultaneously buys both, locking in a risk-free profit. Real-time WebSocket monitoring with 5-40ms detection latency. image (3) image (4) image (3)

If you need this tool, contact me.

Disclaimer: This software is for educational purposes only. Trading involves risk of loss. The developers are not responsible for any financial losses incurred while using this bot.

Support: For questions or issues, contact via Telegram: @Vladmeer | Twitter: @Vladmeer

Introduction

Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Arbitrage Bot Polymarket trading bot Polymarket Bot

Customize your domain