Production-oriented trading bot template:
- Signal source: Hyperliquid short-term momentum (
BTC1m candles) - Execution venue: Polymarket CLOB (
py-clob-client) - Loop: market preview → guarded entry → managed exits (SL/TP/trailing/time-exit)
- Ops: heartbeat, reconcile snapshot, watchdog, graceful stop, runtime text dashboard
This repository is intentionally secret-free. You only need to copy
.env.exampleto.envand fill API credentials.
- Fetch active Polymarket 15m BTC market from Gamma API (
btc-updown-15m-*). - Fetch Hyperliquid 1m candles and compute short momentum + micro-volatility.
- Decide direction:
UPorDOWN. - Apply entry safety filters:
- price bounds
- spread bounds
- top-of-book liquidity
- Submit capped BUY order to Polymarket CLOB.
- Build open-position state and manage exits via:
- stop-loss
- take-profit
- trailing-stop
- time-exit
- degraded fallback with deferred retries
git clone https://github.com/Novals83/polymarket-hl-strategy.git
cd polymarket-hl-strategy
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env./scripts/pm_stack.sh upcp .env.example .env
# fill secrets in .env
docker compose up -d --build
curl http://localhost:8080/health./scripts/pm_stack.sh status
tail -n 200 runtime/pm_live_worker.log./scripts/pm_live_stop_graceful.sh
./scripts/pm_stack.sh downFill in .env:
PM_PRIVATE_KEYPM_FUNDER(orPM_ADDRESS)PM_API_KEYPM_API_SECRETPM_API_PASSPHRASE
Optional:
PM_CLOB_BASE(defaulthttps://clob.polymarket.com)GAMMA_BASE_URL(defaulthttps://gamma-api.polymarket.com)
runtime/pm_live_worker.log— main loop logruntime/trade_journal.jsonl— high-level entry/exit eventsruntime/pm_live_exits.log— close attempts and outcomesruntime/pm_reconcile_report.json— API snapshot (positions/orders/allowances)runtime/pm_exec_summary_today.json— daily summaryruntime/text_dashboard_pm.txt— plain-text dashboard
- Explicit max notional cap
- Entry filter gate (spread/liquidity/price)
- Close path supports deferred mode when orderbook is unavailable
- Manual escalation is debounced
- Graceful stop attempts forced close cycle before worker termination
A usage skill is included:
skills/polymarket-hl-live-trading/SKILL.md
It explains setup, operations, and troubleshooting commands.
This software is for educational and infrastructure purposes. You are solely responsible for trading decisions, key management, and compliance.