[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83404":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":14,"stars30d":14,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":15,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":8,"pushedAt":8,"updatedAt":20,"readmeContent":21,"aiSummary":8,"trendingCount":13,"starSnapshotCount":13,"syncStatus":22,"lastSyncTime":23,"discoverSource":24},83404,"market-sniping-trading-bot","Trade-of-Economics-in-Warsaw\u002Fmarket-sniping-trading-bot","Trade-of-Economics-in-Warsaw",null,"TypeScript",164,3088,86,0,37,10,false,"main",true,[],"2026-06-12 02:04:34","# Polymarket Trading Bot — Open-Source TypeScript Polymarket Bot\n\n> **Production-ready Polymarket trading bot** for automated 5-minute crypto Up\u002FDown markets. Use it out of the box as a **Polymarket bot**, extend it as a **Polymarket arbitrage bot**, or plug in custom rules to build a **Polymarket signal bot** — all on CLOB v2 with simulation mode included.\n\n[![Polymarket trading bot demo — automated limit orders on Polymarket 5-minute markets](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002F1nF556ypGXM\u002F0.jpg)](https:\u002F\u002Fyoutu.be\u002F1nF556ypGXM?si=3d4zmY6lKVj4fVhO)\n\n**Watch the Polymarket trading bot in action** · [Demo on YouTube](https:\u002F\u002Fyoutu.be\u002F1nF556ypGXM?si=3d4zmY6lKVj4fVhO)\n\n---\n\n## Table of contents\n\n- [Polymarket trading bot at a glance](#polymarket-trading-bot-at-a-glance)\n- [Polymarket arbitrage bot strategy](#polymarket-arbitrage-bot-strategy)\n- [Polymarket signal bot extensibility](#polymarket-signal-bot-extensibility)\n- [Architecture](#architecture)\n- [Requirements](#requirements)\n- [Quick start](#quick-start)\n- [Configuration](#configuration)\n- [Features](#features)\n- [Security](#security)\n- [FAQ](#faq)\n- [Support](#support)\n\n---\n\n## Polymarket trading bot at a glance\n\nThis **Polymarket trading bot** automates limit-order execution on Polymarket’s **5-minute Up\u002FDown** prediction markets for **BTC**, **ETH**, **Solana**, and **XRP**. Unlike a bare API wrapper, this **Polymarket bot** ships with market discovery, batch CLOB orders, balance polling, and configurable exit logic — so you can run or fork a complete loop without rebuilding infrastructure.\n\n| Bot type | How this repo fits |\n|----------|-------------------|\n| **Polymarket trading bot** | Full cycle: discover slugs → batch limit buys → monitor fills → rule-based sells |\n| **Polymarket bot** | Lightweight TypeScript stack; simulation mode; proxy \u002F Gnosis Safe \u002F deposit wallet support |\n| **Polymarket arbitrage bot** | Paired Up + Down limits at period open; optional exit when the order book crosses your trigger |\n| **Polymarket signal bot** | Hook custom signals into `monitor` \u002F `trader`; default sell rule is already bid-triggered |\n\n---\n\n## Polymarket arbitrage bot strategy\n\nA common **Polymarket arbitrage bot** pattern on binary Up\u002FDown markets is to **enter both outcomes at period start** and **exit when price action favors one side**. This bot implements that structure in two phases:\n\n1. **Dual limit at period start** — At each 5-minute boundary, place **limit buy** orders for both **Up** and **Down** at a fixed price (e.g. **$0.45**) in a single CLOB batch.\n2. **Arbitrage-style exit** — If **exactly one side** fills and the **unfilled side’s best bid** crosses a trigger (default **$0.80**), place a **limit sell** on the **filled** token at a target price (default **$0.85**). No market buys and no stop-loss in the default path.\n\nMarkets resolve by slug (e.g. `btc-updown-5m-{timestamp}`). BTC is always enabled; ETH, Solana, and XRP are toggled in `config.json`.\n\n### Trading logic\n\n| Step | When | Action |\n|------|------|--------|\n| **1. Limit buys** | Start of each 5-minute period (or within 2s if the bot starts mid-period) | Batch limit buys: Up and Down at `dual_limit_price`, `dual_limit_shares` per side — one CLOB batch per period |\n| **2. Market refresh** | Period timestamp changes | Re-discover markets and refresh the order book snapshot |\n| **3. Limit sell** | Each poll after 2s elapsed (once per market per period) | If one side has balance, the other has none, and the unfilled side’s best bid ≥ `dual_limit_SL_sell_trigger_bid`, limit sell the filled token at `dual_limit_SL_sell_at_price` |\n\nThere is **no** hedge (no market buy on the unfilled side), **no** stop-loss, and **no** automatic redemption at market close in the default strategy — only period-start limits and the optional trigger-based sell.\n\n---\n\n## Polymarket signal bot extensibility\n\nTurn this **Polymarket bot** into a **Polymarket signal bot** by replacing or extending the default sell trigger:\n\n- **`dual_limit_SL_sell_trigger_bid`** — fire a sell when the unfilled side’s best bid crosses your threshold\n- **`dual_limit_SL_sell_at_price`** — set the limit sell price when the signal triggers\n- **Custom modules** — insert logic between `Monitor` and `Trader` (momentum, spread, external APIs, Telegram\u002FDiscord alerts)\n\nThe default path is order-book–driven; swap in any signal source without touching CLOB auth or batch order plumbing.\n\n---\n\n## Architecture\n\n```\n┌─────────────────┐\n│  Monitor        │  Snapshots, slug-based market discovery\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│  Main loop      │  Period start → batch limits; balances + trigger → sell\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│  Trader         │  executeLimitBuyBatch, executeLimitSell, getBalance\n└────────┬────────┘\n         ▼\n┌─────────────────┐\n│  CLOB \u002F Gamma   │  CLOB v2 (@polymarket\u002Fclob-client-v2 + viem), Gamma REST\n└─────────────────┘\n```\n\n---\n\n## Requirements\n\n- **Node.js ≥ 20.10** (required by `@polymarket\u002Fclob-client-v2`)\n- `config.json` with Polymarket `private_key`\n- For **proxy \u002F Gnosis Safe \u002F [deposit wallet](https:\u002F\u002Fdocs.polymarket.com\u002Ftrading\u002Fdeposit-wallets)** trading: set `proxy_wallet_address` and matching `signature_type` (`1`, `2`, or `3`). The bot **derives the CLOB L2 API key** from the signer — **do not** use the Builder attribution key from [polymarket.com\u002Fsettings?tab=builder](https:\u002F\u002Fpolymarket.com\u002Fsettings?tab=builder) as the trading credential.\n\nCollateral for buys is **pUSD**. See [Polymarket USD (pUSD)](https:\u002F\u002Fdocs.polymarket.com\u002Fconcepts\u002Fpusd) and the [trading quickstart](https:\u002F\u002Fdocs.polymarket.com\u002Ftrading\u002Fquickstart).\n\n---\n\n## Quick start\n\nRun this **Polymarket trading bot** locally in under a minute:\n\n```bash\nnpm install\ncp config.json.example config.json\n# Edit config.json: polymarket.private_key; proxy_wallet_address + signature_type if needed\n```\n\n### Run the Polymarket bot\n\n| Mode | Command |\n|------|---------|\n| **Simulation (default)** | `npm run dev` or `npx tsx src\u002Fmain-dual-limit-045.ts` |\n| **Live trading** | `npm run dev:live` or `npx tsx src\u002Fmain-dual-limit-045.ts --no-simulation` |\n| **Custom config** | `npx tsx src\u002Fmain-dual-limit-045.ts -c \u002Fpath\u002Fto\u002Fconfig.json` |\n\n### Production build\n\n```bash\nnpm run build\nnode dist\u002Fmain-dual-limit-045.js --no-simulation -c config.json\n```\n\n---\n\n## Configuration\n\nCreate or edit `config.json` in the project root.\n\n### Example `config.json`\n\n```json\n{\n  \"polymarket\": {\n    \"gamma_api_url\": \"https:\u002F\u002Fgamma-api.polymarket.com\",\n    \"clob_api_url\": \"https:\u002F\u002Fclob.polymarket.com\",\n    \"private_key\": \"your_private_key_hex\",\n    \"proxy_wallet_address\": \"0x...your_proxy_wallet\",\n    \"signature_type\": 2\n  },\n  \"trading\": {\n    \"check_interval_ms\": 1000,\n    \"enable_eth_trading\": false,\n    \"enable_solana_trading\": false,\n    \"enable_xrp_trading\": false,\n    \"dual_limit_price\": 0.45,\n    \"dual_limit_shares\": 5,\n    \"dual_limit_SL_sell_trigger_bid\": 0.8,\n    \"dual_limit_SL_sell_at_price\": 0.85\n  }\n}\n```\n\n### Polymarket API settings\n\n| Parameter | Description | Required |\n|-----------|-------------|----------|\n| `private_key` | Wallet private key (hex). CLOB trading API key is derived via L1 auth | Yes |\n| `proxy_wallet_address` | Funder for non-EOA modes (proxy \u002F Safe \u002F deposit wallet) | If `signature_type` is 1, 2, or 3 |\n| `signature_type` | `0` EOA · `1` POLY_PROXY · `2` POLY_GNOSIS_SAFE · `3` POLY_1271 (deposit) | Must match [signature types](https:\u002F\u002Fdocs.polymarket.com\u002Ftrading\u002Foverview#signature-types) |\n\nDo **not** use the Builder API key from polymarket.com\u002Fsettings?tab=builder for order placement — that key is for attribution only.\n\n### Trading settings\n\n| Parameter | Description | Default |\n|-----------|-------------|---------|\n| `check_interval_ms` | Poll interval for market snapshot (ms) | 1000 |\n| `dual_limit_price` | Limit buy price for Up\u002FDown at period start | 0.45 |\n| `dual_limit_shares` | Shares per limit order (each side) | 1 |\n| `dual_limit_SL_sell_trigger_bid` | Limit sell when unfilled side’s best bid ≥ this | 0.8 |\n| `dual_limit_SL_sell_at_price` | Limit sell price on filled token when triggered | 0.85 |\n| `enable_eth_trading` | ETH 5m Up\u002FDown market | false |\n| `enable_solana_trading` | Solana 5m Up\u002FDown market | false |\n| `enable_xrp_trading` | XRP 5m Up\u002FDown market | false |\n\n### Market discovery\n\nMarkets are discovered by slug (e.g. `btc-updown-5m-{period_timestamp}`). On each 5-minute rollover the bot refreshes markets for the new period — no manual condition IDs in config.\n\n---\n\n## Features\n\n- **Polymarket trading bot core** — End-to-end automation on 5m Up\u002FDown crypto markets\n- **Polymarket arbitrage bot pattern** — Dual-sided limit entries with trigger-based exits\n- **Polymarket signal bot ready** — Configurable bid trigger and sell target; extend with custom signals\n- **Multi-asset Polymarket bot** — BTC default; optional ETH, Solana, XRP\n- **Simulation mode** — Validate logic without sending orders\n- **Structured logging** — Stderr output for production monitoring\n\n---\n\n## Security\n\n- Never commit `config.json` with real keys or secrets\n- Use simulation and small sizes when testing\n- Monitor logs and balances in production\n\n---\n\n## FAQ\n\n### What is a Polymarket trading bot?\n\nA **Polymarket trading bot** connects to Polymarket’s CLOB API and executes orders automatically based on rules — market discovery, entries, exits, and balance checks — without manual clicks. This repo is a TypeScript **Polymarket trading bot** focused on 5-minute crypto Up\u002FDown markets.\n\n### Is this a Polymarket arbitrage bot?\n\nYes, in the structural sense: the default strategy places **paired limit buys** on both Up and Down at period open, then exits when the order book crosses your trigger — a common **Polymarket arbitrage bot** approach on binary markets. You can extend the trader layer for cross-market or cross-platform arbitrage.\n\n### Can I use this as a Polymarket signal bot?\n\nAbsolutely. The sell step is already **signal-driven** (best bid on the unfilled side). Replace or extend that rule in `main-dual-limit-045.ts`, or inject external signals between `Monitor` and `Trader` to run a full **Polymarket signal bot**.\n\n### How is this Polymarket bot different from DIY scripts?\n\nThis **Polymarket bot** includes slug-based discovery, CLOB v2 batch orders, proxy\u002FSafe wallet auth, and simulation mode — less boilerplate than wiring the CLOB from scratch.\n\n### Which assets does this Polymarket trading bot support?\n\nBTC 5m Up\u002FDown is always on. Enable ETH, Solana, or XRP 5m markets in `config.json`.\n\n---\n\n## Support\n\nQuestions, forks, or custom **Polymarket trading bot**, **Polymarket arbitrage bot**, or **Polymarket signal bot** work:\n\n- **Email:** [0xexomonk@gmail.com](mailto:0xexomonk@gmail.com)\n- **X:** [@0xExoMonk](https:\u002F\u002Ftwitter.com\u002F0xExoMonk)\n\n---\n\n\u003Cp align=\"center\">\n  \u003Csub>\n    Polymarket trading bot · Polymarket bot · Polymarket arbitrage bot · Polymarket signal bot · TypeScript · CLOB v2 · prediction markets\n  \u003C\u002Fsub>\n\u003C\u002Fp>\n",2,"2026-06-07 02:30:05","CREATED_QUERY"]