A quick-order tool and automated strategy framework for Polymarket's BTC 5-minute up/down market.
Run it fully locally for fast manual trading with helper overlays, or deploy it to a cloud server for low-latency, 24/7 automated trading. It connects to multiple upstream WebSockets (Polymarket order book / Chainlink price / Binance reference price) and shows the live order book, price trends, positions, and an order panel β with a pluggable strategy system for automation.
Multi-market by design: the data layer supports BTC / ETH / SOL across 5m / 15m windows (6 markets, switchable from the UI), and adding a new symbol is a one-line config change. The bundled example strategies target BTC 5m; other markets are ready for your own strategies (thresholds differ a lot per coin, so they shouldn't be blindly reused).
Main dashboard (full mode): live order book, strategy tooltip, probability & price curves, and the order panel.
- Why this tool
- Features
- Quick Start
- Project Structure
- Strategies
- API
- Cloud Deployment
- Security
- Contributing
- Support this project
- License
| Polymarket Official | This Tool | |
|---|---|---|
| Order flow | Wallet signature required every time, easy to miss the moment | Credentials auto-cached after the first signature, one-click order |
| Price reference | Chainlink oracle price only | Also shows Binance real-time price, faster reaction |
| Data visualization | Probability numbers only | Probability curve + Binance price curve + diff comparison |
| Automated trading | None | Modular strategy framework, fully automated execution of custom strategies |
| Deployment | Browser only | Local run / cloud server, 24/7 unattended |
β οΈ Disclaimer: The built-in strategies are framework examples only and cannot guarantee profits. Develop and tune your own strategies based on your own analysis. Trading involves risk; you are solely responsible for any losses.
Multi-account monitor: track balance, PnL, win rate, and live status across multiple instances at a glance.
- After the first private-key signature, API credentials are auto-cached β no repeated signing
- FOK (fill-or-kill) market orders, avoiding resting-order risk
- One-click buy up / buy down from the panel, with slippage settings
- BTC / ETH / SOL Γ 5m / 15m = 6 markets, switchable from the UI
- Data-driven config (
market-configs.ts) β add a new symbol/period in one entry - Per-coin price precision handled automatically (BTC integer, SOL 4 decimals, etc.)
- Built-in strategies target BTC 5m; other markets are ready for your own strategies
- Four parallel WebSockets: Polymarket order book, Chainlink oracle, user fills, Binance real-time price
- Binance price reacts faster than the Chainlink oracle, providing a leading signal
- Automatic price-offset calibration (MAD outlier filtering + trimmed mean)
- Automatic market-window switch (every 5m / 15m depending on the market)
- Each strategy is a single file under
strategies/, implementing a unified interface - Add a strategy: drop in a file β restart, and the frontend shows it automatically
- Strategy parameters carry comments; frontend hover descriptions are generated automatically
- Supports both market and limit (maker) order strategies
- Multiple entries per round (count configurable, persisted)
- Trade records saved automatically, with entry/exit reasons and PnL details
- Full mode β Complete dashboard: order-book depth, probability/price curves, manual order panel, strategy controls, trade records β for manual trading and monitoring
- Low mode β Lean panel for automation: core data (probability/diff/countdown) + strategy status + trade records, low bandwidth β for unattended running and mobile viewing
- Toggle strategy switches, amounts, and per-round counts in real time
- Auto-claim of expired positions
- One-click backtest data collection from the frontend
- Records diff, probability, time remaining, and other key metrics every second
- Companion Python analysis script with parameter-sweep optimization (multi-core)
- Node.js 20+
npm installcp .env.example .envRequired:
POLYMARKET_PRIVATE_KEYβ Polygon private key (auto-generates API credentials on first run)POLYMARKET_PROXY_ADDRESSβ Polymarket proxy wallet address (not the deposit address; log in to polymarket.com β top-right avatar β Settings β Wallet β copy "Proxy Wallet", which maps one-to-one with the private key; a wrong value triggersinvalid signature)
Optional:
APP_MODEβfull(with panel) orheadless(API only)STRATEGY_<KEY>_ENABLED/STRATEGY_<KEY>_AMOUNTβ strategy switch and amount (KEY is the uppercase strategy name, e.g.D1,P1,P2)ORDER_DEFAULT_SLIPPAGEβ default slippageAUTO_CLAIM_ENABLEDβ auto-claim expired positions
# macOS / Linux
./start.sh
# Windows
start.bat
# or
npm startThen open http://localhost:3456
βββ server.ts # Backend service (Express + WebSocket, port 3456)
βββ index.html # Frontend panel
βββ strategies/ # Strategy modules (plugin-based: add/remove files, no registry edits)
β βββ types.ts # Shared types and the IStrategy interface
β βββ registry.ts # Strategy registry (driven by _runtime/loader)
β βββ _runtime/ # Dynamic loader
β βββ _core/ # Shared core logic (fair-prob / momentum factors)
β βββ d1.ts # Diff-based
β βββ p1.ts, p2.ts # Prob-chase
βββ backtest-data/ # Backtest data (generated at runtime)
βββ .env.example # Environment variable template
βββ start.sh # macOS/Linux launch script
βββ start.bat # Windows launch script
| Key | Name | Logic Summary |
|---|---|---|
| D1 | Diff 1 Β· Tail Sweep | large-diff entry at the window tail, diff-cross-0 stop-loss, holds to settlement |
| P1 | Prob-Chase 1 | fair-prob table lookup, entry when probability lags the diff, reverse Β±5 stop-loss |
| P2 | Prob-Chase 2 Β· End-Game Crossing | rem 90~30s crossing entry + bias/probability filter, reverse Β±5 stop-loss |
Each strategy file has full parameters and comments at the top; hover over the strategy name in the UI to see its detailed rules.
Create a file under strategies/ whose name matches <letter-prefix><number>.ts (e.g. d3.ts, x1.ts) and export a class implementing IStrategy. After restarting, the dynamic loader registers it automatically and the frontend generates the UI for it.
// strategies/x1.ts example
import type { IStrategy, StrategyTickContext, EntrySignal, ExitSignal } from "./types.js";
export default class X1 implements IStrategy {
readonly key = "x1";
readonly number = 1;
readonly name = "My Strategy";
getDescription() { return { key: this.key, number: this.number, name: this.name, title: "X1", lines: [] }; }
updateGuards(_ctx: StrategyTickContext) {}
checkEntry(_ctx: StrategyTickContext): EntrySignal | null { return null; }
checkExit(_ctx: StrategyTickContext): ExitSignal { return null; }
resetState() {}
getStatePayload() { return {}; }
}To remove a strategy, just delete its file β no registry changes needed.
Prefixes: d diff Β· p prob-chase Β· t trend Β· l limit-order (maker) Β· m momentum (reserved).
See strategies/STRATEGY-GUIDE.md for the full development guide, including how to build limit-order (maker) strategies.
| Method | Path | Description |
|---|---|---|
GET |
/api/state |
Full state snapshot |
GET |
/api/strategy/descriptions |
Strategy descriptions |
POST |
/api/strategy/config |
Update strategy config |
POST |
/api/order |
Manual order |
POST |
/api/claim |
Claim expired positions |
POST |
/api/backtest/toggle |
Toggle backtest data collection |
After uploading the project to your server, configure and start it as above. Keep it running in the background with screen:
screen -S btc5m
npm start
# press Ctrl+A then D to detachAccess the panel securely via an SSH tunnel (do not expose the port publicly):
ssh -L 3456:127.0.0.1:3456 username@server_ipThen open http://127.0.0.1:3456 in your local browser.
Private key & credentials
- The private key lives only in your local
.envand is never uploaded anywhere - API credentials are derived from it and cached to
.polymarket-creds.jsonfor reuse - Both are excluded via
.gitignore
Network access
- The service listens on
localhost:3456, accessible only from the local machine - Never expose the port directly to the public internet β anyone who can reach it can place orders via the API
- Always use an SSH tunnel for remote access
Fund safety
- Test with the smallest amount first; scale up only after confirming the behavior
- Strategy switches and amounts can be adjusted from the frontend at any time
- Built-in strategies are examples only and are not investment advice
Never share or commit these files:
| File | Contents |
|---|---|
.env |
Private key and wallet address |
.polymarket-creds.json |
API credentials |
.strategy-config.json |
Persisted config |
The tool provides a complete strategy framework and backtesting capability, but good strategies need continuous iteration. Contributions and ideas are very welcome β especially if you:
- Have better entry/exit ideas or have discovered new data patterns
- Want to do strategy backtesting and optimization together
- Want to build more powerful features on top of this project (forks encouraged!)
- Have any thoughts on the Polymarket BTC 5-minute market
Open an issue / PR, or reach out directly β let's achieve a 1+1 > 2 effect.
This project is free and open source. If you find it useful, here are a few ways to support it β all cost you nothing and mean a lot:
- β Star this repo β it helps more people discover the project and keeps me motivated to maintain it
- π Sign up for Polymarket via my referral link β directly supports continued development:
- π Build on top of it β fork it and create something more powerful; I'd love to see what you make
- π€ Prefer copy-trading? If you'd rather follow trades than run your own strategies, try Kreo β a copy-trading Telegram bot (@kreoapp). Tap to open it in Telegram: https://t.me/KreoPolyBot?start=ref-188888x
- π Trade crypto & RWAs? Check out Variational (Omni) (@variational_io) β a trading platform for crypto, RWAs, and more (recently raised $50M). Trade and earn points along the way: https://omni.variational.io/?ref=OMNI88888
- π¦ Get in touch β questions, ideas, or collaboration on X (Twitter): @x_188888_x
Thank you for supporting open source! π
MIT β for personal use and learning/research. The risk of using this tool for trading is borne solely by the user.

