- Use /markets/slug/{slug} direct endpoint (not /markets?slug=...&limit=1)
- Extract token IDs from clobTokenIds field with JSON string parsing fallback
- Read tick size from market.orderPriceMinTickSize (no separate API call)
- Prioritise endDate (full datetime) over endDateIso (date-only) to fix false expiry
- Slot formula matches sniperDetector/mmDetector exactly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Gamma API returns two date fields:
endDateIso = "2026-02-24" ← date only, no time
endDate = "2026-02-24T06:35:00Z" ← correct close datetime
_parseEndTs() was preferring endDateIso, which parsed to midnight UTC
and was already in the past by the time any market opened during the day.
Both current and next-slot markets were therefore rejected as "already expired".
Fix: prioritise endDate (full ISO datetime) over endDateIso (date-only).
Co-Authored-By: direkturcrypto <direkturcrypto.x@mail3.me>
Adds a debug flag (ONESHOT_DEBUG=true / --debug / npm run oneshot-debug)
that surfaces the engine's internal decision process at every key step.
Debug output tags
─────────────────
[DBG:FEED] — Market discovery: every slug probed, API response status,
token IDs extracted, tick size fetched.
Throttled poll summary every 10 ticks per market showing
bid/ask/spread/mid/depth for both UP and DOWN sides.
[DBG:GATE] — Hard gate result every 5 evaluations per market:
TTE range, spread width, depth thinness, stale flag.
Shows exact gate fail reason or PASS confirmation.
[DBG:FEAT] — Feature breakdown for each side every 5 evals:
slope, imbalance, spread, retrace raw values plus
per-component scores and weighted total.
[DBG:SCORE] — Per-side qualify check: score vs threshold,
trend confirm flag, and QUALIFY / skip verdict.
[DBG:SIGNAL] — Always logged (no throttle) when an ENTER signal fires.
[DBG:HEART] — 5-second heartbeat: active markets, per-market SM state,
dailyPnl, consecLosses, cooldownLeft, halted flag.
New script
──────────
npm run oneshot-debug → DRY_RUN=true ONESHOT_DEBUG=true node src/oneshot.js
Co-Authored-By: direkturcrypto <direkturcrypto.x@mail3.me>
- Rename project to polymarket-terminal
- Add Market Maker bot (src/mm.js) with on-chain CTF split/merge/redeem via Gnosis Safe
- Add Orderbook Sniper bot (src/sniper.js) with multi-asset GTC low-price orders
- Add WebSocket watcher (src/services/wsWatcher.js) for real-time RTDS trade events
- Add terminal dashboard UI (src/ui/dashboard.js) using blessed
- Add CTF contract helpers (src/services/ctf.js) for splitPosition, mergePositions, redeemPositions
- Add mmDetector, mmExecutor, sniperDetector, sniperExecutor services
- Add simStats utility for dry-run P&L tracking
- Translate all Indonesian-language strings to professional English across all files
- Rewrite README.md in English with full setup guide, configuration reference, and architecture overview
- Rewrite AGENT.MD in English as comprehensive AI agent and developer reference
- Update package.json name, description, scripts, and keywords
Co-Authored-By: direkturcrypto <direkturcrypto.x@mail3.me>