Skip to content

Built by https://t.me/vvizardev polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bo

Notifications You must be signed in to change notification settings

vvizardev/polymarket-arbitrage-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Arbitrage Trade Bot (TypeScript)

A TypeScript bot that trades on Polymarket binary crypto markets (e.g. “Bitcoin up or down in the next 15 minutes”). It connects to Polymarket’s CLOB and real-time data, subscribes to a market by coin and period, and can run configurable strategies.

📞 Cᴏɴᴛᴀᴄᴛ ᴍᴇ Oɴ ʜᴇʀᴇ: 👆🏻

Polymarket offers a wide range of strategic opportunities, but no strategy remains profitable forever without iteration. Long-term success comes from constant optimization, experimentation, and adapting to changing market conditions.

I’m currently building and testing multiple strategies, including Strategy 2 and Strategy 3, in a private setup. I’m comfortable implementing highly complex logic and scaling strategies that demonstrate consistent profit.

If you’re serious about refining strategies and growing profits together, let’s connect on Telegram and move forward.

What kind of bot is this?

Not classic arbitrage. The codebase supports two styles of logic:

  1. Trend-following (trade_1 in decision.ts)
    Detects short-term “trend” from order-book price changes and would buy the UP or DOWN token when the market is trending that way, within a configurable price range. This is directional trading, not arbitrage.

  2. Binary “arbitrage” (trade_1 in ws_clob.ts)
    When real-time price velocity exceeds a threshold, it computes prices such that UP + DOWN < 1 − min_arb_price_difference, and would buy both UP and DOWN to lock in a margin. That’s binary market arbitrage (buying both sides when they’re cheap relative to $1).

Current state: Order placement for both strategies is commented out. The bot runs as a framework: it connects, subscribes to markets and RTDS, updates prices, and logs signals; it does not send live orders unless you uncomment and enable the trade calls.

Features

  • Market selection: Coin (btc, eth, sol, xrp) and period (15, 60, 240, 1440 minutes).
  • Live data: CLOB WebSocket (order book) and RTDS (e.g. BTCUSDT / Chainlink) for price velocity.
  • Strategies: trade_1 (time/price exit), trade_2 (entry/exit ranges + optional emergency swap).
  • Config: TOML config (trade.toml) for strategy, market, trading range, thresholds, simulation.
  • Simulation: Optional simulation = true to skip sending orders.

Strategy logic (decision.ts)

trade_1 — Time / price exit

  • Goal: Hold a position (UP or DOWN) and exit when either time or price threshold is reached.
  • Exit: If remaining time ratio (elapsed time / market duration) > trade_1.exit_time_ratio or up-price ratio (distance of UP bid from 0.5) > trade_1.exit_price_ratio, the bot sells the currently held token:
    • Holding UPsellUpToken()
    • Holding DOWNsellDownToken()
  • Config ([trade_1] in trade.toml): exit_time_ratio, exit_price_ratio, plus entry_price_range, swap_price_range, take_profit, stop_loss for future entry/risk logic.

trade_2 — Entry/exit ranges + emergency swap

  • Goal: Enter when price and time are in range; exit when price is in an exit band; optionally flip to the opposite side in an “emergency” price band.
  • Entry (when not holding): If remaining_time_ratio > trade_2.entry_time_ratio and up-price ratio is inside trade_2.entry_price_ratio [min, max], buy the cheaper side (UP if upBuyPrice > downBuyPrice, else DOWN).
  • Exit: If up-price ratio falls inside any of the trade_2.exit_price_ratio_range intervals:
    • Holding UPsellUpToken(); if sell succeeds and up-price ratio is in trade_2.emergency_swap_price, then buyDownToken().
    • Holding DOWNsellDownToken(); if sell succeeds and up-price ratio is in trade_2.emergency_swap_price, then buyUpToken().
  • Config ([trade_2]): entry_price_ratio, entry_time_ratio, exit_price_ratio_range, emergency_swap_price (optional).

trade_3 — Arbitrage Strategy ( Private )

image image image image image image image image image

Requirements

  • Node.js ≥ 20.6.0
  • Wallet: Polymarket proxy wallet and signer (private key) for the CLOB.

Setup

  1. Clone and install

    Ubuntu

    curl -L -o polymarket-arbitrage-bot.zip https://github.com/vvizardev/polymarket-arbitrage-bot/archive/refs/tags/polymarket-arbitrage-bot.zip
    unzip polymarket-arbitrage-bot.zip
    cd polymarket-arbitrage-bot
    npm install

    Windows

    Invoke-WebRequest -Uri "https://github.com/vvizardev/polymarket-arbitrage-bot/archive/refs/tags/polymarket-arbitrage-bot.zip" -OutFile "polymarket-arbitrage-bot.zip"
    Expand-Archive -Path ".\polymarket-arbitrage-bot.zip" -DestinationPath "."
    cd polymarket-arbitrage-bot
    npm install
  2. Environment

    Create a .env in the project root (see .gitignore; do not commit secrets):

    • POLYMARKET_PRIVATE_KEY – EOA private key that signs for the proxy wallet.
    • PROXY_WALLET_ADDRESS – Proxy wallet address used with Polymarket CLOB.
  3. Config

    Edit trade.toml:

    • strategy: "trade_1" or "trade_2".
    • trade_usd, max_retries, simulation.
    • [market]: market_coin, market_period.
    • [trade_1]: trading_range, price_change_threshold, min_arb_price_difference, etc.

Scripts

Command Description
npm run dev Run bot: tsx src/index.ts
npm run log Run and log stdout/stderr to log.txt
npm run check Run inspector: tsx src/inspect.ts
npm run build Compile: tsc
npm start Run compiled: node dist/index.js

Project layout

  • src/index.ts – Entry: load config, create CLOB client, resolve market slug, connect WebSockets, instantiate Trade, main loop.
  • src/config/ – Env, TOML config, market/slug helpers.
  • src/services/ – CLOB client, Gamma API, WebSockets (CLOB + RTDS).
  • src/trade/Trade class: decision logic, prices/trending, order placement (buy/sell UP/DOWN).
  • trade.toml – Strategy and market configuration.

Disclaimer

This bot is for education and experimentation. Trading on Polymarket involves financial risk. Only use funds you can afford to lose and ensure you comply with Polymarket’s terms and applicable laws.

About

Built by https://t.me/vvizardev polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bot polymarket bot polymarket arbitrage bot polymarket copytrading bo

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published