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 2 froze the live physics: 5-minute crypto now runs on a rolling 60s TWAP.
Part 3 is the matching layer that may change next. Public comments from Polymarket’s DeFi engineering side point at a from-scratch CLOB rewrite, targeted mid-to-late Q4, because the current engine accumulated debt while being scaled.
Treat that as a roadmap, not a live cutover date. Prepare like the cutover will still break implicit code.
1. What a Rewrite Can Change Without Changing the Market Question
The question can stay “BTC Up or Down for 5 minutes.”
These can still move:
| Assumption in old bots | Why it can break |
|---|---|
| Taker delay value | Delay has already moved more than once |
| Cancel-during-delay | Lock behavior is a matching rule, not a strategy rule |
| Ack / fill timing | Tail latency is the thing they say they are rewriting |
| Rate-limit shape | Volume tiers already exist; headers and burst math can change |
| Websocket snapshot vs delta | New engine often means new book events |
| Partial fill / reject codes | Status enums are where silent bugs live |
| Idempotent order identity | Duplicate sends become expensive on a faster book |
TWAP60 changed the target.
A new CLOB changes the hands that touch the target.
2. Make clob.ts an Adapter, Not the Strategy
The public shell already splits files. Keep that split sacred.
signal.ts → P(up) against TWAP60
engine.ts → enter / scratch / redeem
clob.ts → how an order becomes a fill
If engine.ts knows venue-specific delay folklore, reject strings, or raw websocket frames, the rewrite will rewrite your strategy by accident.
clob.ts should own:
- place / cancel
- client order id
- delay assumption
- retry / Retry-After
- normalize fills into one internal event
engine.ts should only see:
OrderAccepted | OrderFilled | OrderRejected | RateLimited | BookStale
3. The Minimum Hardening List
Do these before any engine cutover, not after the first rejected day.
Idempotent client order IDs
Reconnect must not double-buy the same idea.Explicit delay config
taker_delay_mslives in config. Not in a comment. Not in memory from August.Separate clocks
signal_ts,submit_ts,ack_ts,fill_ts. If you only log “I traded,” you cannot debug a faster or slower book.Cancel policy
Do not use cancel-spam as risk management. Assume some pending takers cannot be pulled.Rate-limit backoff
HonorRetry-After. A 5m slot loop that busy-retries will starve itself.Stale book = no trade
Missing RTDS or a dead CLOB socket is a skip, not a CEX-mid improvisation.Scratch needs depth
“Breakeven flatten” is a book condition. On a rewrite day, depth can vanish.
4. What I Am Measuring Now
I want a baseline before Q4, not a story after.
Per slot:
- quoted ask vs fill
- signal-to-fill lag
- scratch spread
- reject / 429 count
- reconnect count
- whether official TWAP was fresh
If the new engine lands and those series jump, I can tell matching changed.
If I have no baseline, I will blame the signal for a rail change.
5. What Not to Do While Waiting
- Freeze development and “wait for Rust”
- Rewrite the private
P(up)because matching might get faster - Port Combos RFQ into the 5m loop
- Assume lower p99 latency means mid-band 50¢ fills get cheaper automatically
- Delete idempotency because “the new book will be clean”
Faster matching can make sloppy bots lose cleaner and quicker.
6. Expected Cutover Posture
When a new matching path appears:
paper / shadow first
same TWAP60 target
same 45–55¢ gate
smaller clips
no new assets
compare fill stats to the September baseline
only then raise size
The strategy thesis does not get a vote on launch day. The adapter does.
7. What Part 4 Covers
While the rails move, product surface will keep expanding: Combos, agent connectors, DeFi unification talk.
Part 4 is the refusal list — what I will not graft onto a BTC 5m TWAP engine during a matching-engine year.
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. Roadmaps slip. Confirm live matching rules before you assume a delay or cancel path.
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 #CLOB #TWAP #TradingBot #BTC #AlgoTrading #PredictionMarkets
Top comments (0)