Skip to content

TopTrenDev/openclaw-polymarket-betting-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦žπŸ“ˆ OpenClaw Polymarket Betting Bot

A TypeScript skeleton bot for 5-minute prediction markets on Polymarket, combining on-chain style signals with optional LLM contextβ€”built for paper trading and backtesting.

Telegram Twitter


✨ What It Does

  • 🎯 5m horizon β€” Predicts whether the YES price will be higher in 5 minutes using a lightweight ensemble (momentum, volatility, whale flow, optional LLM).
  • πŸ‹ Whale flow proxy β€” Uses recent large trades and volume/price metadata as a proxy for β€œsmart money” flow (no wallet-level fills yet).
  • πŸ“Š Market microstructure β€” Short-term price momentum (30s, 2m) and 2m volatility feed into the model.
  • πŸ€– Optional LLM scorer β€” You can plug in an OpenAI-compatible model to add a narrative/context bias to the score.
  • πŸ“ Paper-trading engine β€” Position sizing, edge threshold, and HOLD/BUY/SELL logic without real money until you’re ready.

πŸš€ Quick Start

cd openclaw-polymarket-betting-bot
npm i
cp .env.example .env
npm run dev

The bot will poll the configured market, compute features, run the predictor, and log actions (e.g. HOLD, BUY YES, SELL YES) with p5m and confidence in the console.


πŸ–₯️ Compare UI (before full trading)

See live predictions and compare them to what actually happened after 5 minutes:

npm run ui
# open http://localhost:8787

The UI lets you:

  • Fetch the latest bot prediction snapshot (market, current YES price, predicted side, P(UP 5m), confidence).
  • Enter the actual YES price after 5 minutes (or use the auto-compare delay).
  • Compare predicted side vs actual outcome (YES/NO).
  • Track running accuracy (correct predictions / total).

πŸ“ Project layout

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Bot entry point
β”‚   β”‚   └── index.ts         # Poll loop (npm run dev)
β”‚   β”œβ”€β”€ server/             # UI HTTP server
β”‚   β”‚   └── index.ts         # Serves ui/ + /api/prediction (npm run ui)
β”‚   └── lib/                # Shared core (used by app + server)
β”‚       β”œβ”€β”€ config.ts        # Env config
β”‚       β”œβ”€β”€ types/           # Shared types
β”‚       β”œβ”€β”€ connectors/      # Polymarket API
β”‚       β”œβ”€β”€ engine/          # Features, predictor, paper trader
β”‚       └── models/          # Optional LLM scorer
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ css/style.css
β”‚   └── js/app.js
β”œβ”€β”€ .env, .env.example
└── package.json
Part Role
app Bot entry: runs the prediction loop (connector β†’ features β†’ predictor β†’ paper trader).
server Serves ui/ and /api/prediction for the compare UI.
lib Shared code: config, types, connectors, engine (features, predictor, paper trader), models (LLM).

βš™οΈ Configuration (.env)

  • Polymarket β€” POLYMARKET_REST_BASE, POLYMARKET_MARKET_SLUG or POLYMARKET_MARKET_ID (optional; otherwise the bot picks an active BTC up/down market).
  • Loop β€” LOOP_SECONDS (how often to run the prediction loop).
  • Paper trading β€” MAX_POSITION_USD, EDGE_THRESHOLD.
  • LLM β€” OPENAI_API_KEY, optional OPENAI_BASE_URL, OPENAI_MODEL.

See .env.example for all variables.


πŸ“Œ Notes

  • Paper-trading by default β€” No real orders are placed; the connector pulls real market snapshots for a realistic test.
  • Whale flow is currently a proxy (volume/price-change metadata), not wallet-level fills.
  • You can pin a market with POLYMARKET_MARKET_SLUG or POLYMARKET_MARKET_ID.
  • No strategy guarantees profits β€” Use for learning and experimentation.

⭐ Like this project?

If the project is interesting for you, give it a star on GitHub. If you want to know the project in more detail or have questions, please contact me β€” I’d be happy to chat.

About

🦞 OpenClaw Polymarket Betting Bot: A TypeScript skeleton bot for 5-minute prediction markets on Polymarket, combining on-chain style signals with optional LLM context using openclaw 🦞 aiβ€”built for paper trading and backtesting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors