[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-78391":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":14,"starSnapshotCount":14,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},78391,"polymarket-arbitrage-bot","thesammy26\u002Fpolymarket-arbitrage-bot","thesammy26","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 bot",null,"TypeScript",130,1917,136,0,49.85,"MIT License",false,"develop",true,[21,22,23,24,25],"bot","polymarket","polymarket-trade","polymarket-trading-bot","trading","2026-06-12 04:01:23","# Polymarket Arbitrage Bot\n\n**Automated dump-and-hedge trading for Polymarket’s 15-minute crypto Up\u002FDown markets** — TypeScript, official CLOB client, hands-free across **BTC, ETH, SOL, and XRP**.\n\nActive development for this line of work: **2026-01-04** through **2026-04-02**.\n\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnode-%3E%3D16-brightgreen)](https:\u002F\u002Fnodejs.org\u002F)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.3-blue)](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n\n## Contents\n\n- [Why this exists](#why-this-exists)\n- [What it does](#what-it-does)\n- [Strategy flow](#strategy-flow)\n- [Tech stack](#tech-stack)\n- [Quick start](#quick-start)\n- [Configuration](#configuration-env)\n- [Project layout](#project-layout)\n- [Disclaimer](#disclaimer)\n- [Operational safety](#operational-safety-checklist)\n- [Contributors](#contributors)\n- [Contributing](#contributing)\n- [Troubleshooting](#troubleshooting)\n- [License](#license)\n\n---\n\n## Why this exists\n\nShort-dated prediction markets move fast. When one side **dumps** in seconds, the other side often lags — and if you can buy both legs cheaply enough, their combined cost can sit **below $1 per paired share**, locking in a structural edge before resolution.\n\nThis bot **watches** those markets continuously, **detects** sharp moves that match your thresholds, **executes** a two-leg cycle (dump capture → hedge), and **tracks** P&L — with optional **simulation** so you can validate behavior before risking capital.\n\n---\n\n## What it does\n\n| Capability | Description |\n|------------|-------------|\n| **Multi-asset** | Trade one or many markets: `btc`, `eth`, `sol`, `xrp` (comma-separated). |\n| **Auto-discovery** | Resolves the active **15m Up\u002FDown** market per asset from Polymarket’s Gamma API and rolls forward each new period. |\n| **Dump detection** | Uses recent ask history to flag a leg when price falls by your **move threshold** within a short time window. |\n| **Hedge logic** | After leg 1, waits for leg 2 when **leg1 entry + opposite ask ≤ your sum target** (e.g. 0.95). |\n| **Risk controls** | Configurable **stop-loss hedge** if the favorable hedge does not appear within **N minutes**. |\n| **Settlement** | On market close, reconciles winners\u002Flosers and can **redeem** winning positions on-chain (production). |\n| **Logging** | Streams activity to stderr and appends a **history** file for review and auditing. |\n\n---\n\n## Strategy flow\n\n```text\nNew 15m round\n     │\n     ▼\n┌─────────────────┐     rapid drop on Up or Down     ┌──────────────┐\n│ Watch window    │ ───────────────────────────────► │ Buy dumped   │\n│ (first N min)   │                                  │ leg (Leg 1)  │\n└─────────────────┘                                  └──────┬───────┘\n                                                            │\n                              opposite ask cheap enough     │\n                              (sum ≤ target)                ▼\n                                                    ┌──────────────┐\n                                                    │ Buy hedge    │\n                                                    │ (Leg 2)      │\n                                                    └──────┬───────┘\n                                                           │\n                    timeout? ─────────────────────────────┤\n                                                           ▼\n                                                Stop-loss hedge path\n```\n\n*Simplified view of the trader module; tune thresholds with environment variables.*\n\n---\n\n## Tech stack\n\n- **Runtime:** Node.js 16+\n- **Language:** TypeScript\n- **Polymarket:** [`@polymarket\u002Fclob-client`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@polymarket\u002Fclob-client) (orders, auth), Gamma + CLOB HTTP APIs (markets, prices)\n- **Chain:** Polygon (USDC, CTF redemption flow)\n\n---\n\n## Quick start\n\n### Prerequisites\n\n- [Node.js](https:\u002F\u002Fnodejs.org\u002F) 16 or newer\n- A Polymarket-compatible wallet and (for live trading) USDC on **Polygon**, plus a clear choice of **EOA vs proxy** signing (`SIGNATURE_TYPE` in `.env`)\n\n### Install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fthesammy26\u002Fpolymarket-arbitrage-bot\ncd polymarket-arbitrage-bot\nnpm install\ncp .env.example .env\n# Edit .env — see [Configuration](#configuration-env)\nnpm run build\n```\n\n### Run modes\n\n| Command | Purpose |\n|---------|---------|\n| `npm run dev` | Run from source with `ts-node` (development). |\n| `npm run typecheck` | TypeScript check without emitting `dist\u002F`. |\n| `npm run clean` | Remove compiled output in `dist\u002F`. |\n| `npm run sim` | **Simulation** — logs trades, no real orders (`--simulation`). |\n| `npm run prod` | **Production** — real CLOB orders (`--production`). |\n| `npm start` | Run `dist\u002Fmain.js`; combine with your flags and `.env` as below. |\n\n**Live trading:** set `PRODUCTION=true` in `.env` and run `npm run prod` (or `node dist\u002Fmain.js --production`) so the process is not left in simulation mode.\n\n---\n\n## Configuration (`.env`)\n\nCopy `.env.example` to `.env` and adjust.\n\n| Variable | Role |\n|----------|------|\n| `PRIVATE_KEY` | Required for real orders and redemption. |\n| `PROXY_WALLET_ADDRESS` | Polymarket proxy\u002Fprofile address if applicable. |\n| `SIGNATURE_TYPE` | `0` EOA, `1` Proxy, `2` Gnosis Safe (default in example: `2`). |\n| `GAMMA_API_URL` | Optional; default `https:\u002F\u002Fgamma-api.polymarket.com`. |\n| `CLOB_API_URL` | Optional; default `https:\u002F\u002Fclob.polymarket.com`. |\n| `API_KEY` \u002F `API_SECRET` \u002F `API_PASSPHRASE` | Optional; use if your setup requires CLOB API credentials. |\n| `MARKETS` | e.g. `btc` or `btc,eth,sol,xrp` (comma-separated, lowercase). |\n| `CHECK_INTERVAL_MS` | Price polling interval in ms (default `1000`). |\n| `MARKET_CLOSURE_CHECK_INTERVAL_SECONDS` | How often to check for round closure (default `20`). |\n| `DUMP_HEDGE_SHARES` | Size per leg (shares). |\n| `DUMP_HEDGE_SUM_TARGET` | Max combined price for hedge (e.g. `0.95`). |\n| `DUMP_HEDGE_MOVE_THRESHOLD` | Min fractional drop to count as a dump (e.g. `0.15` = 15%). |\n| `DUMP_HEDGE_WINDOW_MINUTES` | Only look for dumps in the first *N* minutes of the round. |\n| `DUMP_HEDGE_STOP_LOSS_MAX_WAIT_MINUTES` | Force the stop-loss path if no favorable hedge within *N* minutes. |\n| `DUMP_HEDGE_STOP_LOSS_PERCENTAGE` | Cap on the forced hedge sum: max(leg1 + opposite) = 1 + this fraction (default `0.2`). |\n| `PRODUCTION` | `false` = simulation; use `true` with `--production` for live execution. |\n\n---\n\n## Project layout\n\n```text\nsrc\u002F\n  main.ts            # Entry: discovery, monitors, period rollover\n  monitor.ts         # Price polling and snapshots\n  dumpHedgeTrader.ts # Dump → hedge → stop-loss → settlement tracking\n  api.ts             # Gamma, CLOB, orders, redemption, activity\n  config.ts          # Environment loading\n  models.ts          # Shared types\n  logger.ts          # History file + stderr\n```\n\n---\n\n## Disclaimer\n\nThis software is provided **for educational and research purposes only**. Prediction markets and automated trading involve **substantial financial risk**, including possible **total loss**. Past or simulated behavior does **not** guarantee future results. You are solely responsible for compliance with applicable laws, exchange terms, and tax obligations. **Nothing here is investment, legal, or tax advice.**\n\n---\n\n## Operational safety checklist\n\n- Run in simulation first and inspect `history.toml` over multiple rounds.\n- Start with low `DUMP_HEDGE_SHARES` and conservative thresholds in production.\n- Keep private keys out of version control; rotate any exposed credentials.\n\n---\n\n## Contributors\n\nCore development (Q1 2026): [buffalu](https:\u002F\u002Fgithub.com\u002Fbuffalu), [bunghi](https:\u002F\u002Fgithub.com\u002Fbunghi), [calvinzhou-rockx](https:\u002F\u002Fgithub.com\u002Fcalvinzhou-rockx), [Carlosted](https:\u002F\u002Fgithub.com\u002FCarlosted), [cavemanloverboy](https:\u002F\u002Fgithub.com\u002Fcavemanloverboy), [ch9xy](https:\u002F\u002Fgithub.com\u002Fch9xy), [ChewingGlass](https:\u002F\u002Fgithub.com\u002FChewingGlass), [codemonkey6969](https:\u002F\u002Fgithub.com\u002Fcodemonkey6969), [cryptogosu](https:\u002F\u002Fgithub.com\u002Fcryptogosu), [cryptopapi997](https:\u002F\u002Fgithub.com\u002Fcryptopapi997), [danpaul000](https:\u002F\u002Fgithub.com\u002Fdanpaul000).\n\n---\n\n## Contributing\n\nIssues and pull requests are welcome: strategy ideas, safer defaults, tests, and clearer documentation help everyone.  \nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the local workflow and commit guidelines.\n\n---\n\n## Troubleshooting\n\n- **`Failed to fetch market\u002Forderbook`:** Often transient API or network issues; confirm endpoints and retry behavior.\n- **Order failures in production:** Verify `PRIVATE_KEY`, `SIGNATURE_TYPE`, and proxy wallet settings match your Polymarket account.\n- **No market found:** Ensure `MARKETS` only lists supported assets (`btc`, `eth`, `sol`, `xrp`) and wait for the next 15-minute round.\n\n---\n\n## License\n\nSee [LICENSE](LICENSE) in this repository for terms.\n","这是一个用于Polymarket平台的自动交易机器人，专门针对15分钟内的加密货币涨跌市场进行自动化套利操作。核心功能包括实时监控市场动态、识别价格骤降、执行两腿套利策略（即买入被抛售的一方并迅速对冲），支持BTC、ETH、SOL和XRP四种资产。采用TypeScript编写，并利用官方CLOB客户端实现高效运行。适用于希望在快速波动的预测市场中寻找结构性优势并自动锁定利润的交易者。通过配置参数，用户还可以控制风险并在模拟模式下测试策略的有效性。",2,"2026-05-24 02:30:10","CREATED_QUERY"]