GitHub: https://github.com/abrownfox0/abrownfox001-twap60-prediction-trigger-system
YouTube walkthrough: https://www.youtube.com/watch?v=XzhugRL6BV4
Live profile: https://polymarket.com/@abrownfox001
Part 3 treated delay and quotas as a fill-quality problem.
Part 4 is reliability. After TWAP60 and the 150ms gate, the fastest remaining way to blow a 5m book is trading through bad data and calling it uptime.
1. September Already Made the Point
Recent venue noise was not theoretical:
- CLOB / open-order read delays
- brief trading pauses and degraded prediction APIs
- websocket / RTDS blips in the same incident windows
- scheduled CLOB periphery maintenance (API key create/delete degradation)
- goodwill credits after an earlier matching outage
A specialist bot that only models BTC direction is unfinished.
It also has to model “the venue is lying to me for 8 minutes.”
2. Connected ≠ Fresh
The dangerous state is not “disconnected.”
It is:
websocket = up
last_twap_ts = 12s ago
book = still printing
bot = still placing
For a TWAP60 engine that state is poison.
-
twap_nowis old -
P(up)is computed on a dead path - a scratch can be taken against a book that no longer matches the official series
- a 150ms delayed taker then lands on whatever is left
Heartbeat is not a price.
3. The Halt Rules I Want in Production
Hard fails, not retries-with-hope:
if twap feed_age_ms > max_stale:
halt new entries
halt path-based scratches
if clob open-orders read is lagged:
halt new size
do not invent local position state
if rate-limit backoff is active:
shrink, do not spray
if status incident / cancel-only:
flatten only if the book is real
otherwise sit on the existing cap
Gamma after resolution is a scoring fallback.
CEX mid is lead-lag.
Neither is a live official series.
4. What Must Stay in Memory vs What Must Be Re-Read
Local state that is allowed:
-
twap_openpinned at slot start - current clip inventory
- last decision log
Local state that is not allowed to outlive a lag:
- “I think my order is working”
- “I think I am flat”
- “I think the 50¢ ask is still there”
- a homemade TWAP from Binance while RTDS is quiet
After delayed open-order reads, reconcile from Data API / CLOB, then decide.
Do not let engine.ts win an argument with the venue.
5. Reconnect Without Double-Sending
Reliability work that belongs in the public shell:
- RTDS reconnect with backoff (
twapFeed.ts) - CLOB ws reconnect without duplicate client order ids (
clob.ts) - slot loop that can sit in
WAITinstead ofBUY - explicit
HALTreason in the slot log - no market-order panic after a blip
Idempotency is a reliability feature.
It is also how you survive maintenance windows that “expect no downtime” and still wobble.
6. Reliability Fields on the Slot Log
Add to the part 2 / part 3 record:
feed_age_ms
ws_reconnects
open_order_read_lag_ms
halt_reason # none | stale_twap | clob_lag | rate_limit | incident
position_reconciled # true | false
If halt_reason is always none, the bot is not detecting failures.
It is failing to notice them.
7. Expected Tech Change on This Layer
- Stale TWAP = no new risk
- Reconcile positions after any read lag
- Treat status.polymarket.com as an input, not a postmortem
- Keep Combos / agent connectors off the 5m halt path
- Prefer missed slots over invented prices
Missing one 5-minute market is cheap.
Trading four minutes of stale TWAP is not.
8. What Part 5 Covers
The last post is the patch list for @abrownfox001:
- what is already locked
- what gets changed after delay + incidents
- what stays private
- what I will not rebuild just to look current
Links
- Repo: https://github.com/abrownfox0/abrownfox001-twap60-prediction-trigger-system
- Video: https://www.youtube.com/watch?v=XzhugRL6BV4
- Live activity: https://polymarket.com/@abrownfox001?tab=activity
Not financial advice. Check live status before you assume the book and the TWAP feed agree.
If you have more questions, please feel free to contact me at any time: https://t.me/abrownfox001
My Polymarket Activity: https://polymarket.com/@abrownfox001?tab=activity
#Polymarket #RTDS #TWAP #TradingBot #BTC #AlgoTrading #PredictionMarkets
Top comments (0)