[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82262":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":14,"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":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},82262,"polymarket-momentum-last-minute-arbitrage-bot","PredictiveFlow-Labs\u002Fpolymarket-momentum-last-minute-arbitrage-bot","PredictiveFlow-Labs","polymarket momentum last minute sniper polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot polymarket bot ","",null,"TypeScript",67,1896,1,0,46.93,false,"main",true,[21,22,23,24,25,26,27],"polymarket-arbitrae-trading-bot","polymarket-arbitrage-bot","polymarket-bot","polymarket-btc-5min-arbitrage-bot","polymarket-btc-arbitrage-bot","polymarket-btc-arbitrage-trading-bot","polymarket-trading-bot","2026-06-12 04:01:37","# Polymarket Last-Minute Sniper\n\n**High-Frequency Endgame Bot** — exploits BTC fast-market mispricing on Polymarket during the final 60 seconds before expiry.\n\n## Live Output Sample\n\n![Bot startup and live trading output](assets\u002Fsample-output.png)\n\nWhen the bot runs you will see:\n- Wallet address and key status confirmed on startup\n- Live BTC price feed from Binance confirmed\n- Each new market detected with YES price, spread, and seconds remaining\n- `🎯 SIGNAL` lines when entry conditions are met (side, strength, move %, hold time)\n- `💰 TRADE` lines when an order is placed (side, size, entry price, market slug)\n\n---\n\n## Strategy Overview\n\n| Phase | Action |\n|-------|--------|\n| Detect | Find active BTC 5m\u002F15m Polymarket markets via Gamma API |\n| Track | Capture market-open BTC price; live-stream Binance BTCUSDT trades |\n| Wait | Do nothing until last **45 seconds** before expiry |\n| Signal | Trigger if BTC has moved ≥ 0.20% from open AND been sustained for ≥ 10 seconds |\n| Execute | Place limit order; cancel if stale after 2 seconds; aggressive fill for HIGH confidence |\n| Exit | Force-close 5 seconds before expiry OR settle naturally at expiry |\n\n### BUY YES conditions\n- BTC current ≥ open + 0.20%\n- YES price \u003C 0.72 (mispriced)\n- Move sustained ≥ 10 seconds\n\n### BUY NO conditions\n- BTC current ≤ open − 0.20%\n- YES price > 0.30 (mispriced)\n- Move sustained ≥ 10 seconds\n\n### Filters\n- Spread ≤ 3 cents\n- Minimum liquidity $50\n- No duplicate positions per market\n\n---\n\n## Project Structure\n\n```\npolymarket-last-minute-sniper\u002F\n├── src\u002F\n│   ├── index.ts              # Main entry point & event loop\n│   ├── types\u002F\n│   │   └── index.ts          # All TypeScript interfaces\n│   ├── config\u002F\n│   │   └── index.ts          # .env loading & config defaults\n│   ├── clients\u002F\n│   │   ├── gamma.ts          # Gamma API – market discovery\n│   │   ├── simmer.ts         # Simmer API – order execution\n│   │   └── binance.ts        # Binance WebSocket – live BTC price\n│   ├── strategies\u002F\n│   │   └── sniper.ts         # Core signal evaluation & execution logic\n│   ├── risk\u002F\n│   │   └── manager.ts        # Position sizing, daily stop, bankroll\n│   ├── analytics\u002F\n│   │   └── dashboard.ts      # Win rate, ROI, P&L by minute bucket\n│   └── utils\u002F\n│       └── logger.ts         # Pino structured logger\n└── tests\u002F\n    ├── risk.test.ts           # Risk manager unit tests\n    ├── sniper.test.ts         # Signal evaluation unit tests\n    └── analytics.test.ts     # Dashboard unit tests\n```\n\n---\n\n## Requirements\n\n- **Node.js** ≥ 18\n- **npm** ≥ 9\n- A **Simmer Markets** account with API key ([simmer.markets](https:\u002F\u002Fsimmer.markets))\n\n---\n\n## Installation\n\n```bash\n# 1. Enter the project directory\ncd polymarket-last-minute-sniper\n\n# 2. Install dependencies\nnpm install\n\n# 3. Copy and configure environment\ncp .env.example .env\n# Edit .env and set SIMMER_API_KEY\n\n# 4. Build TypeScript\nnpm run build\n```\n\n---\n\n## Running\n\n### Production (compiled)\n```bash\nnpm run build\nnpm start\n```\n\n### Development (hot-reload)\n```bash\nnpm run dev:watch\n```\n\n### Dry-run (paper trading, no real orders)\n```bash\nDRY_RUN=true npm run dev\n```\n\n---\n\n## Configuration\n\nAll settings are controlled via environment variables in `.env`.  \nSee `.env.example` for the full list with descriptions.\n\nKey variables:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `SIMMER_API_KEY` | **required** | Your Simmer Markets API key |\n| `DRY_RUN` | `false` | Simulate trades without execution |\n| `ENTRY_WINDOW_SECS` | `45` | Enter only in last N seconds |\n| `SUSTAINED_MOVE_SECS` | `10` | BTC move must hold for N seconds |\n| `MIN_MOVE_PCT` | `0.20` | Min BTC % move from open to trigger |\n| `MAX_OPEN_POSITIONS` | `1` | Maximum simultaneous positions |\n| `DAILY_STOP_LOSS_PCT` | `0.10` | Stop trading after 10% daily drawdown |\n| `BASE_BET_PCT` | `0.02` | Base position size (2% of bankroll) |\n| `MAX_BET_PCT` | `0.05` | Max position size (5% of bankroll) |\n| `MARKET_WINDOWS` | `5m,15m` | Market timeframes to monitor |\n| `LOG_LEVEL` | `info` | Pino log level |\n\n---\n\n## Testing\n\n```bash\n# Run all tests\nnpm test\n\n# With coverage report\nnpm run test:coverage\n\n# Watch mode\nnpm run test:watch\n```\n\nTest coverage:\n- **Risk Manager**: position sizing, daily stop, open\u002Fclose\u002Fexpire lifecycle, signal classification\n- **Sniper Strategy**: signal evaluation (all rejection paths + valid YES\u002FNO signals), price tracking\n- **Analytics Dashboard**: win rate, P&L, minute bucket grouping, signal strength breakdown, persistence\n\n---\n\n## Analytics Dashboard\n\nThe dashboard prints every 60 seconds and on shutdown:\n\n```\n────────────────────────────────────────────────────────────\n  📊  POLYMARKET LAST-MINUTE SNIPER  –  ANALYTICS\n────────────────────────────────────────────────────────────\n  As of          : 2026-04-29T16:30:00.000Z\n  Bankroll       : $1,048.23\n  Daily P&L      : $12.4500\n  Total P&L      : $48.2300\n  ROI            : 4.82%\n  Total Trades   : 27\n  Win Rate       : 63.0%  (17W \u002F 10L)\n  Avg Hold Time  : 18.4s\n\n  P&L by Minute Bucket:\n    min  0  ████       40% WR   5 trades  pnl $-2.1200\n    min  3  ████████   80% WR   5 trades  pnl $18.4400\n    min  4  ██████     60% WR  17 trades  pnl $31.9100\n\n  Signal Strength Breakdown:\n    HIGH      12 trades  75% WR  pnl $38.2100\n    MODERATE   9 trades  56% WR  pnl $12.0400\n    WEAK       6 trades  33% WR  pnl $-2.0200\n────────────────────────────────────────────────────────────\n```\n\nTrade history is persisted to `sniper-trades.jsonl` (configurable via `ANALYTICS_FILE`).\n\n---\n\n## Risk Model\n\n| Mechanism | Detail |\n|-----------|--------|\n| Max positions | 1 simultaneous (configurable) |\n| Daily stop loss | 10% of bankroll (configurable) |\n| Dynamic sizing | WEAK: 30% of base, MODERATE: 60%, HIGH: 100% max |\n| Stale order cancel | Auto-cancel limit orders after 2 seconds |\n| Pre-expiry exit | Force-close 5 seconds before expiry if position open |\n\n---\n\n## Architecture Notes\n\n- **Binance WebSocket** auto-reconnects on disconnect with 3-second backoff\n- **Market discovery** polls Gamma API every 10 seconds; expired markets are pruned\n- **Signal evaluation** runs every 2 seconds during the entry window\n- **Simmer API** is used for all order execution (handles Polymarket CLOB internally)\n- All trades are logged to JSONL for post-session analysis\n\n---\n\n## Disclaimer\n\nThis software is for educational purposes only. Prediction market trading carries significant financial risk. Past performance does not guarantee future results. Use at your own risk.\n","该项目是一款针对Polymarket平台的高频交易机器人，特别设计用于在市场到期前的最后一分钟内捕捉比特币价格变动带来的套利机会。其核心功能包括通过Gamma API自动发现活跃的5分钟或15分钟BTC市场、实时跟踪Binance上的BTC价格流，并在满足特定条件时执行快速买入或卖出操作。技术上采用TypeScript编写，确保了代码的类型安全性和可维护性；同时集成了风险管理和数据分析模块，帮助用户更好地控制交易风险并评估策略表现。适用于寻求利用短期市场价格错配进行快速套利的加密货币交易者。",2,"2026-06-01 03:57:43","CREATED_QUERY"]