[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82071":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},82071,"polymarket-btc-5min-15min-arbitrage-trading-bot","PolyMomentum-Labs\u002Fpolymarket-btc-5min-15min-arbitrage-trading-bot","PolyMomentum-Labs","polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot polymarket trading bot","",null,"TypeScript",110,6864,31,0,10,false,"main",true,[21,22,23,24,25,26],"polymarket-arbitrage-bot","polymarket-arbitrage-trading-bot","polymarket-bot","polymarket-btc-5min-arbitrage-bot","polymarket-btc-arbitrage-bot","polymarket-trading-bot-strategies","2026-06-12 02:04:22","# Polymarket BTC 5m \u002F 15m Arbitrage Trading Bot\n\n**Production-oriented TypeScript bot for Polymarket short-horizon Up\u002FDown markets**\n\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnode-%3E%3D20.6-brightgreen)](https:\u002F\u002Fnodejs.org\u002F)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.x-blue)](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-ISC-lightgrey)](#license)\n\n[Quick Start](#quick-start) · [Documentation](#documentation) · [Architecture](#architecture) · [Configuration](#configuration) · [FAQ](#faq)\n\n---\n\nOpen-source **Polymarket trading bot** for **BTC (and multi-asset) Up\u002FDown** windows on the **Polymarket CLOB** — rule-based strategies, automated execution, and operator-friendly logging. Automation around **5-minute** and **15-minute** prediction markets with configurable entry\u002Fexit logic. **Not** a guaranteed-profit or risk-free arbitrage system; configure, fund, and operate at your own risk.\n\n---\n\n## What This Bot Does\n\n| Layer | Purpose |\n|-------|---------|\n| **Market discovery** | Resolves Polymarket slugs from `trade.toml` (`market_coin` + `market_period`, e.g. BTC + 5m or 15m) |\n| **Pricing** | Polls Gamma \u002F CLOB-backed **UP** and **DOWN** outcome quotes |\n| **Strategy** | Runs `trade_1` or `trade_2` rules — time\u002Fprice exits, range entries, optional emergency swap |\n| **Execution** | Market-style orders via `@polymarket\u002Fclob-client-v2`, transient retries, entry cooldowns |\n| **Auth** | L1 wallet signing → derive\u002Fcreate API credentials → L2 authenticated trading client |\n| **Operations** | Startup banner, structured console logging, trend\u002Fposition legends |\n\n**One window per process** — e.g. BTC 5m **or** BTC 15m. For experimentation and extension, not promised arbitrage edge.\n\n---\n\n## Who This Is For\n\n- Developers building or extending a **Polymarket CLOB trading bot** in **TypeScript**\n- Traders experimenting with **short-duration Up\u002FDown markets** (5m \u002F 15m) with small size and strict risk controls\n- Anyone evaluating **arbitrage-adjacent** or **rule-based** automation on **Polymarket prediction markets**\n\n---\n\n## Polymarket Arbitrage Bot vs. This Repo\n\nMany guides describe **cross-window** setups (e.g. comparing **5-minute** and **15-minute** BTC markets simultaneously with paired legs). **This Polymarket bot** instead:\n\n| Classic dual-window arbitrage | This repository |\n|------------------------------|-----------------|\n| Single orchestrator across 5m + 15m | **One `market_period` per running config** |\n| Hard-coded paired-leg engine | **Transparent `trade.toml` thresholds** |\n| Synchronized `endTime` logic | **Per-window slug loop** (Gamma → prices → decision → orders) |\n\nYou may run **two processes** (e.g. `market_period = \"5\"` and `\"15\"`) as an operational pattern; that orchestration is **not** bundled as one binary today.\n\n---\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                    index.ts (bootstrap + banner)                 │\n│  CLOB L1 → derive\u002Fcreate API key → CLOB L2 client               │\n└────────────────────────────┬────────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────────┐\n│  Market loop (per window slug)                                   │\n│  • Gamma: resolve market + token IDs                             │\n│  • Prices: poll quotes for UP \u002F DOWN                             │\n│  • Trade.updatePrices → make_trading_decision                    │\n└────────────────────────────┬────────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────────┐\n│  Strategy (trade_1 | trade_2)              trade\u002Fdecision.ts    │\n│  • Entry gates, exits, optional emergency swap                   │\n└────────────────────────────┬────────────────────────────────────┘\n                             │\n                             ▼\n┌─────────────────────────────────────────────────────────────────┐\n│  Orders + balances                         trade\u002Ftrade.ts        │\n│  • createAndPostMarketOrder (FAK)                                │\n│  • Retry policy + human-readable trading errors                  │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n## Repository Map\n\n| Area | Path | Role |\n|------|------|------|\n| Entry | `src\u002Findex.ts` | Banner, CLOB auth, market loop, `Trade` lifecycle |\n| CLOB \u002F wallet | `src\u002Fservices\u002Fclob.ts` | Host, chain, signer, funder, signature type |\n| Gamma API | `src\u002Fservices\u002Fgamma.ts` | Market metadata by slug |\n| Config | `src\u002Fconfig\u002F` | Zod-validated `trade.toml`, `.env`, slug builder |\n| Decision | `src\u002Ftrade\u002Fdecision.ts` | `trade_1` \u002F `trade_2` branching |\n| Prices | `src\u002Ftrade\u002Fprices.ts` | Quote polling and status lines |\n| Execution | `src\u002Ftrade\u002Ftrade.ts` | Buys\u002Fsells, cooldowns, balance waits |\n| Errors | `src\u002Futils\u002FtradingErrorMessage.ts`, `retry.ts` | Operator-friendly messages |\n| Strategy config | `trade.toml` | Market coin\u002Fperiod, strategy params, risk knobs |\n\n---\n\n## Documentation\n\n| Section | Description |\n|---------|-------------|\n| [Quick Start](docs\u002FQUICK_START.md) | Install, env setup, first run |\n| [Funding](docs\u002FFUNDING.md) | Wallet, USDC, and Polymarket account setup |\n| [Position Tracking](docs\u002FPOSITION_TRACKING.md) | How the bot tracks exposure |\n| [Simulation](docs\u002FSIMULATION.md) | Dry-run and experimentation notes |\n| [Troubleshooting](docs\u002FTROUBLESHOOTING.md) | Common errors and fixes |\n| [Contact](docs\u002Fcontact.md) | Maintainer contact |\n\n---\n\n## Quick Start\n\n### Prerequisites\n\n- **Node.js ≥ 20.6**\n- **Polygon** wallet with Polymarket-compatible setup (private key + funder \u002F proxy deposit address)\n- Small **USDC** balance appropriate for `trade_usd` experiments\n\n### Install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Florine93s\u002Fpolymarket-btc-5min-15min-arbitrage-bot.git\ncd polymarket-btc-5min-15min-arbitrage-bot\nnpm install\n```\n\n### Configure\n\n1. Copy `.env.example` → `.env` (never commit secrets).\n2. Edit **`trade.toml`**:\n   - `[market].market_period` → `\"5\"` or `\"15\"` for **Polymarket BTC 5 minute** or **15 minute** windows\n   - `strategy` → `trade_1` or `trade_2`\n   - `trade_usd`, `max_retries`, `entry_buy_cooldown_sec`\n\n### Run\n\n```bash\nnpm run dev          # development (tsx)\nnpm run build && npm start   # production build\n```\n\n---\n\n## Configuration\n\n### Environment variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `POLYMARKET_PRIVATE_KEY` | Yes | Wallet private key for CLOB L1 \u002F L2 signing |\n| `POLYMARKET_FUNDER_ADDRESS` | Yes | Funder \u002F deposit (proxy) address for collateral |\n| `PROXY_WALLET_ADDRESS` | Alternate | Alias if `POLYMARKET_FUNDER_ADDRESS` is unset |\n| `POLYMARKET_SIGNATURE_TYPE` | No | `EOA` · `POLY_PROXY` · `POLY_GNOSIS_SAFE` · `POLY_1271` |\n\nSee [`.env.example`](.env.example) for templates.\n\n### `trade.toml` reference\n\n| Key | Meaning |\n|-----|--------|\n| `strategy` | `trade_1` or `trade_2` |\n| `trade_usd` | Notional per buy (USD) |\n| `max_retries` | Retries for transient errors (network \u002F 5xx \u002F 429) |\n| `entry_buy_cooldown_sec` | Pause before retrying entry after a failed buy |\n| `[market].market_coin` | `btc`, `eth`, `sol`, `xrp` |\n| `[market].market_period` | `5`, `15`, `60`, `240`, `1440` |\n| `[trade_1]`, `[trade_2]` | Strategy parameters (see `src\u002Fconfig\u002Ftoml.ts`) |\n\nFor a **Polymarket BTC 5 minute bot**, set `market_coin = \"btc\"` and `market_period = \"5\"`. For **15 minute**, use `\"15\"`.\n\n---\n\n## Operations & Risk\n\n- Start with **low `trade_usd`**; verify fills, balances, and logs before scaling.\n- **Execution risk** remains: partial fills, API errors, and fast 5m \u002F 15m books can move against you between signal and fill.\n- **`entry_buy_cooldown_sec`** limits tight retry loops on non-transient failures (e.g. signing \u002F credential issues).\n- Use a **dedicated wallet** and only capital you can afford to lose.\n\n---\n\n## Troubleshooting\n\n| Symptom | What to check |\n|---------|----------------|\n| `Could not derive api key` | Often normal on first run; bot should create a key next. If both fail: wallet, signature type, Polymarket account. |\n| L2 \u002F HMAC \u002F `ERR_INVALID_ARG_TYPE` | Incomplete API credentials on client. Re-run auth; ensure full `creds` after L1. |\n| No trades | `trade_2` entry gates; `hasBought`; `entryBuyCooldownUntil` after failures. |\n| Auth \u002F 401 | Funder vs signer mismatch, wrong `POLYMARKET_SIGNATURE_TYPE`, or blocked API access. |\n\nFull guide: [docs\u002FTROUBLESHOOTING.md](docs\u002FTROUBLESHOOTING.md).\n\n---\n\n## Safety & Compliance\n\n- This **Polymarket trading bot** places **real orders** when live keys and a funded account are configured.\n- **No warranty.** Hypothetical or past **arbitrage** edges do not guarantee future results.\n- Comply with **local laws**, **Polymarket Terms of Service**, and eligibility in your jurisdiction.\n- **Never** commit private keys or share them in support channels.\n\n---\n\n## FAQ\n\n**Is this a risk-free Polymarket arbitrage bot?**  \nNo. It automates rules and execution; slippage, failed legs, and bugs can lose money.\n\n**Is this a Polymarket BTC 5 minute market bot?**  \nSet `market_period = \"5\"` and `market_coin = \"btc\"`. The same code path supports **15m** and other periods.\n\n**Does it use Polymarket WebSocket feeds?**  \nThe core loop uses **price polling**. Check `src\u002F` for any WebSocket usage in your checkout.\n\n**ETH \u002F SOL \u002F XRP Polymarket markets?**  \nYes — set `market_coin` in `trade.toml`.\n\n---\n\n## Keywords\n\nCommon search terms this repo targets:\n\n`polymarket trading bot`, `polymarket bot`, `polymarket arbitrage bot`, `polymarket btc arbitrage bot`, `polymarket btc 5min arbitrage bot`, `polymarket btc 15min arbitrage bot`, `polymarket btc trading bot`, `polymarket clob bot`, `polymarket clob trading bot`, `polymarket orderbook bot`, `@polymarket\u002Fclob-client-v2`, `polymarket api key`, `polymarket market making bot`, `polymarket up down bot`, `polymarket 5 minute bot`, `polymarket 5m btc`, `polymarket 15 minute bot`, `polymarket 15m btc`, `polymarket typescript bot`, `polymarket nodejs bot`, `prediction market trading bot`, `crypto prediction market bot`\n\n---\n\n## License\n\nISC — see [`package.json`](package.json). Use at your own risk.\n","这是一个用于Polymarket平台的比特币5分钟\u002F15分钟套利交易机器人，使用TypeScript编写。其核心功能包括市场发现、定价、基于规则的策略执行、自动下单以及友好的操作日志记录，特别针对5分钟和15分钟的涨跌预测市场设计了可配置的进入退出逻辑。技术特点上，它利用了@polymarket\u002Fclob-client-v2进行市价订单提交，并支持L1钱包签名认证来创建L2交易客户端。适用于希望在TypeScript环境中构建或扩展Polymarket CLOB交易机器人的开发者，以及想要在严格风险管理下探索短期涨跌市场的交易者。请注意，该项目不保证盈利或无风险。",2,"2026-06-01 03:57:12","CREATED_QUERY"]