- Demo
- Strategy: Momentum into Close
- Trading Profiles
- Realistic Expectations
- Repository Structure
- Getting Started
- Usage
- Live Safety (Post-Audit)
- Tooling & Validation
- Tests & CI
- Execution Checklist
- Risk Controls
- Risk Notice
- Support & Contributing
Resolve BTC 5m market → confirm impulse + skew + edge → enter with momentum → managed exit before close.
A short-horizon momentum-into-close stack — this is not a reversal system:
- Trade Polymarket BTC 5m Up/Down markets near expiry.
- Time entries around ~120 seconds left (tolerance / hard window configurable).
- Impulse — require a signed BTC move on the active 5m candle (
close − open), with an optional 1m agreement (anti-wick). - Skew — follow the market: stronger CLOB ask over threshold; optional
min_skew_gapandmax_entry_price. - Edge gate — require
est_win_prob − entry ≥ min_edge; optional UTC session hours. - Size — fixed or edge-scaled stake (profile caps), with optional loss-streak soft size-down.
- Exit — hard stop on CLOB bid, hold-to-resolve when nearly certain, early-cut if underwater or BTC reverses near expiry, else time exit.
- Hedge — optional micro-hedge on extreme near-close skew (e.g. 95/5).
All profile parameters live only in config/polybtc_profiles.yaml.
| Profile | Intent |
|---|---|
conservative |
Default live path: stricter filters, edge gate, session blocks, edge-scaled size |
aggressive |
Higher frequency / risk, looser edge & session |
high_confidence |
Selective mid-high threshold band, harder impulse, more confirm polls |
micro_10 |
Tiny live test — ~10 USDT bankroll, $1/trade, max 5 trades/day |
observe |
Research only — looser gates for polybtc_live_logger / dry-run; not for live money |
Use profile micro_10 and set equity to your bankroll so the daily loss % is meaningful:
# 1) Dry-run first (no orders)
export POLYBTC_EQUITY=10
python scripts/test_polybtc_session_exit_sl.py --profile micro_10
# or via ctl:
scripts/polybtc_ctl.sh start --profile micro_10
# 2) Only after the dry-run looks sane — REAL $1 orders (wallet must hold ~10 USDT):
export POLYBTC_EQUITY=10
scripts/polybtc_ctl.sh start --profile micro_10 --live
# equivalent:
python scripts/test_polybtc_session_exit_sl.py --profile micro_10 --equity 10 --executemicro_10 caps: stake $1, max notional $1, max 5 trades/day, stop after 2 consecutive losses, daily max loss 20% of equity (≈$2 if equity=10). Hedge disabled. You can still lose the full stack over multiple days.
No guaranteed profit. This is a high-variance speculative strategy. No setup can guarantee profit, and anyone promising a "99% win rate" is misleading you. The payoff is asymmetric — you buy a side at price
p, so your break-even win-rate equalsp: you must be right more thanp% of the time just to avoid losing money.
| Entry price | Win payoff ($5 stake) | Loss | Break-even win-rate |
|---|---|---|---|
| 0.71 | +$2.04 | −$5.00 | > 71% |
| 0.90 | +$0.56 | −$5.00 | > 90% |
| 0.95 | +$0.26 | −$5.00 | > 95% |
At 0.71 a single loss erases ~2.4 wins. The realistic objective is a measured, positive edge with strict capital protection — not guaranteed wins. Use the analytics, edge, exit, and fill tools (see Tooling & Validation) to verify real expectancy before sizing up.
| Path | Purpose |
|---|---|
SKILL.md |
Skill definition and operating rules |
CONTOUR.md |
Canonical execution path + post-audit safety notes |
BACKTESTING.md |
CSV historical backtest + calibrator guide |
config/polybtc_profiles.yaml |
Single source of truth for profiles / risk |
scripts/ |
Runners, preflight, analytics, live logger, reports (_psr_impl.py is the live-session implementation) |
examples/ |
Command examples + sample backtest CSV |
assets/ |
Logo and demo GIFs |
tests/ |
pytest (config, preflight, edge, guardrails, analytics, dry-run, summary, live safety, backtest, calibrate, exit/fill reports, logger CSV) |
.github/workflows/ |
CI (lint, compile, config validation, tests) |
- OpenClaw environment (optional for pure Python tooling)
- Polymarket execution stack for real orders (e.g.
pm-hl-conservative-plus-repo) - Python 3.12+ venv:
pip install -r requirements.txt(andrequirements-live.txtfor the CLOB client) - API credentials only outside this repo (via env / external
.env)
git clone https://github.com/0xgetz/polymarket-btc-5m.git
cd polymarket-btc-5m
pip install -r requirements.txtThen read:
SKILL.mdconfig/polybtc_profiles.yaml
python scripts/polybtc_live_logger.py --profile observe --minutes 60 --poll-sec 5
# JSONL + CSV land in ./runtime/python scripts/test_polybtc_session_exit_sl.py --profile conservative
# or:
scripts/polybtc_ctl.sh start --profile conservative
scripts/polybtc_ctl.sh start --profile high_confidence # selectivepython scripts/test_polybtc_session_exit_sl.py --profile conservative --execute
scripts/polybtc_ctl.sh start --profile conservative --livescripts/polybtc_ctl.sh start --profile conservative # dry-run
scripts/polybtc_ctl.sh start --profile conservative --live # real orders
scripts/polybtc_ctl.sh status
scripts/polybtc_ctl.sh report --limit 20
scripts/polybtc_ctl.sh stop # SIGTERM first; may leave open positions if killed mid-tradescripts/polybtc_docker.sh up
scripts/polybtc_docker.sh status
scripts/polybtc_docker.sh downDefaults keep real money hard to enable by accident:
| Control | Behavior |
|---|---|
| Default mode | Dry-run (no orders). Live needs --execute / polybtc_ctl.sh --live. |
| Preflight gate | Time, signed BTC 5m impulse (+ max cap), optional 1m align, quote age, spread, liquidity, threshold / max_entry, skew gap, multi-poll confirm, EV gate, session hour — before any open. |
| Sizing | Base stake + optional edge-scale + loss-streak soft scale, hard max_notional_usd. |
| Capital guardrails | Consecutive-loss kill switch, daily max-loss %, max trades/day. |
| Profile source | config/polybtc_profiles.yaml only (polybtc_config). |
| Managed exit | Stop on CLOB best bid; hold-to-resolve; early-cut; time exit (decide_exit). |
| Close limit floor | Force/GTC close cannot dump below entry * (1 - max_close_slippage). |
| Open-order env | Spread / top-ask notional from profile (PM_MAX_SPREAD, PM_MIN_TOP_ASK_NOTIONAL_USD). |
| Stop semantics | polybtc_ctl.sh stop: SIGTERM → wait → SIGKILL; lockfile + open-position warning. |
| Watcher | watch_polybtc_threshold_and_enter.sh defaults dry-run; lockfile; stops on guardrail block. |
Helpers: scripts/polybtc_live_safety.py (unit-tested). Live CLOB deps: requirements-live.txt.
Runtime isolation:
- skill runtime dir:
./runtime - auth/env source (default):
<your-workspace>/pm-hl-conservative-plus-repo/.env - overrides:
POLYBTC_REPO,POLYBTC_ENV_FILE,POLYBTC_RUNNER,POLYBTC_RUNTIME_DIR,POLYBTC_PY
Most helpers are pure / deterministic (or public-API observe-only). Prefer them before live size-up.
pip install -r requirements.txt
python scripts/polybtc_config.py --validate
python scripts/polybtc_config.py --profile conservative --show
python scripts/polybtc_config.py --profile observe --showGO / NO-GO engine: side, stake (edge + streak scaled), stop, hedge plan, checks, edge.
python scripts/polybtc_preflight.py --profile conservative \
--seconds-left 118 --btc-move-usd 110 --btc-move-1m-usd 12 \
--up-ask 0.74 --dn-ask 0.28 --spread 0.02 --top-ask-notional 50 \
--hour-utc 14Example GO (shape; values depend on profile):
{
"ok": true,
"side": "UP",
"entry_price": 0.74,
"stake_usd": 6.25,
"edge": 0.08,
"estimated_win_prob": 0.82,
"stake_scale": 1.25,
"streak_scale": 1.0,
"checks": {
"session_hour": true,
"time_to_close": true,
"impulse_move": true,
"impulse_max": true,
"quote_fresh": true,
"spread": true,
"liquidity": true,
"threshold_side": true,
"move_aligned": true,
"move_1m_aligned": true,
"skew_confirm": true,
"ev_gate": true
}
}python scripts/polybtc_live_logger.py --profile observe --minutes 60 --poll-sec 5
python scripts/polybtc_live_logger.py --export-jsonl runtime/polybtc_live_obs_....jsonlpython scripts/polybtc_calibrate.py \
--csv examples/polybtc_backtest_sample_data.csv \
--profile conservative --top 10 --min-trades 2Details: BACKTESTING.md.
python scripts/polybtc_backtest.py \
--csv examples/polybtc_backtest_sample_data.csv \
--profile conservativepython scripts/polybtc_analytics.py --runtime-dir ./runtime --limit 200
python scripts/polybtc_exit_report.py --runtime-dir ./runtime --limit 200
python scripts/polybtc_fill_report.py --runtime-dir ./runtime --limit 200
python scripts/polybtc_daily_summary.py --profile conservative --equity 200python scripts/polybtc_guardrails.py --profile conservative \
--equity 200 --pnls=-5,-5,-5 --entry 0.71 --win-prob 0.80
python scripts/polybtc_edge.py --entry 0.71 --win-prob 0.80 --stake 5
python scripts/polybtc_edge.py --table
python scripts/polybtc_dryrun.py --profile conservative \
--seconds-left 118 --btc-move-usd 84 --btc-move-1m-usd 10 \
--up-ask 0.71 --dn-ask 0.29 --spread 0.02 --top-ask-notional 41 \
--hour-utc 14 --market-slug btc-updown-5m-demo --outcome UPpip install -r requirements-dev.txt
pytest -qCI runs bash/Python syntax checks, config validation, and the full test suite.
Before live trade.
- Market validity — active BTC 5m slot, not already closed.
- Time window — enough
min_entry_seconds_left; prefer ~120s target window. - Impulse — signed 5m move ≥
btc_move_usd_min, ≤btc_move_usd_maxif set; side aligned. - 1m confirm — if
require_1m_aligned, current 1m candle agrees with side. - Skew / price band — threshold side, optional
min_skew_gapandmax_entry_price. - EV gate — heuristic edge ≥
min_edgewhenrequire_ev_gateis on. - Session hour — UTC hour not blocked (or on allow-list) if session filter enabled.
- Multi-poll —
confirm_pollssame-side GO streak before open. - Liquidity / spread / quote age — pass profile execution safety.
- Sizing — stake, edge-scale, loss-streak scale, max notional, daily caps.
- Exit policy — stop-loss, hold-to-resolve, early-cut,
exit_before_sec. - Mode — dry-run / observe logger first;
--executeonly after validation.
Defaults live in config/polybtc_profiles.yaml and are enforced on the live path:
- Per-trade stake base + edge-scaled size + loss-streak soft size
- Hard max notional / trade
- Daily max loss % and max trades / day
- Max consecutive losses (hard kill switch)
- Quote staleness, spread, and top-of-book liquidity guards
- Stop-loss on executable CLOB best bid
- Close limit floor (no 0.01 fire-sale by default)
- Managed exit: hold-to-resolve / early-cut / time exit
- Optional extreme-skew micro-hedge
- Session hour allow/block (UTC)
- Graceful process stop: SIGTERM → wait → SIGKILL
This repository is educational/operational infrastructure, not financial advice. Use your own risk limits, daily loss caps, and capital controls.
observe is for research logging only — do not enable live money on it.
If this skill is useful for your trading or research, you can support its development:
Donations help with:
- 🖥️ Server & data-feed costs for strategy testing
- ✨ New features (impulse filters, multi-market, dashboard)
- 📚 Better documentation & examples
- 🐛 Bug fixes and routine maintenance
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request to
main
PRs are welcome.


