GitHub: https://github.com/abrownfox0/abrownfox001-twap60-prediction-trigger-system
YouTube walkthrough: https://www.youtube.com/watch?v=XzhugRL6BV4
Part 1 argued that BTC 5-minute Up/Down is a forecasting problem, not a last-tick casino.
This post covers the actual target variable: Chainlink TWAP, and how the signal layer should be built against it.
Live profile: @abrownfox001
1. Settlement Changed the Problem
Short-duration crypto markets on Polymarket no longer resolve on a single price snapshot.
They settle on a Chainlink Time-Weighted Average Price.
Current mapping:
| Market duration | Settlement window |
|---|---|
| 5-minute crypto | 60-second TWAP |
| 15-minute crypto | 60-second TWAP |
| 4-hour crypto | 60-second TWAP |
Important: 60 seconds is a lookback window, not an update frequency.
Chainlink computes the average over the last minute and signs that value. Reports can arrive more often than once per minute.
Both the price-to-beat at slot open and the final settlement price should come from the same TWAP series.
2. Why This Destroys Snapshot Bots
A snapshot bot asks:
Where will BTC print at the exact close?
A TWAP-aligned bot asks:
Where will the official 60-second average sit versus the open reference?
Those are different questions.
A 8-second wick can flip a snapshot market and barely move a 60s average.
A slow grind that holds for most of the final minute can decide settlement even if the last tick snaps back.
If your signal is trained on CEX last prices, you are forecasting a variable the market no longer pays.
3. The Only Clean State Variables
For each btc-updown-5m-* slot the engine cares about three things:
twap_open = 60s Chainlink TWAP at slot start
twap_now = latest 60s Chainlink TWAP
t_left = seconds remaining in the slot
Everything else is auxiliary.
Useful extras (not substitutes):
- CEX mid for short-horizon lead-lag
- book imbalance / flow
- realized path volatility inside the slot
Useless as a primary target:
- last Binance print
- Coinbase close guess
- leftover 30-second TWAP after the 5m markets moved to 60s
4. How the Signal Is Structured
The private layer outputs a continuous probability:
[
P(up)t = f(\text{TWAP path vs } twap{open},\ \text{lead-lag},\ \text{flow},\ t_{left})
]
Design rules:
Anchor to TWAP first.
Direction versus the open reference must come from the official series.Use CEX only as lead-lag.
CEX can move first. It should inform timing, not replace settlement.Make time-in-slot explicit.
A 52% read at t=20s is not the same as a 52% read at t=280s.Keep the output calibrated.
The number must mean probability, not “model excitement.”Never mix windows.
If settlement is 60s, open pinning and live scoring must also be 60s.
The exact formula stays private. That is the moat. The structure does not need to be secret.
5. Reference Code Map
In the public repo:
| Module | Job |
|---|---|
src/twapFeed.ts |
Stream official TWAP via Polymarket RTDS |
src/signal.ts |
Convert TWAP path vs open into P(up)
|
src/cexFeed.ts |
Auxiliary mid for lead-lag |
src/engine.ts |
Consume the probability and run the slot |
Production integration path:
- Polymarket RTDS topic for 60s TWAP
- exact filter form such as
{"symbol":"btc/usd"} - freshness checks on observation timestamps
- exact decimal / bigint handling — no sloppy floats for settlement math
6. Practical Signal Gates
The live engine does not trade every tick the model twitches.
A typical gate looks like:
if abs(P(up) - 0.5) < threshold:
wait
if ask not in 45–55¢:
wait
else:
accumulate small clip
Why both conditions?
- Edge without a fair price is just overpaying.
- A fair price without edge is just a coin flip.
7. What Changed After the 30s → 60s Move
When 5-minute markets moved from 30s TWAP to 60s TWAP:
- The target series got smoother
- Fast spike features lost power
- Open-reference mismatch became a silent killer
- Scratch thresholds needed retuning
- Any leftover 30s logic became research-only
This is why the repo is framed around a TWAP60 prediction-trigger system. The trigger is not “price moved.” The trigger is “the official average path now implies a tradeable probability.”
8. Failure Modes in the Signal Layer
- Pinning
twap_openfrom the wrong feed - Scoring live path on 60s while researching on 30s
- Treating update cadence as proof of freshness
- Letting CEX mid dominate the probability
- Using raw model output without a threshold
- Accepting stale TWAP because “the socket is still connected”
If the signal layer is wrong, no execution trick saves the book.
9. What Part 3 Will Cover
Once P(up) exists, the hard part becomes mechanical:
- when to enter
- how not to lift a thin book
- how often to re-score
- when to scratch
- when to let a ticket reach resolution
That is the slot lifecycle.
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. Verify the live market’s official resolution source before you trade it.
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 #TWAP #Chainlink #BTC #TradingBot #AlgoTrading #PredictionMarkets
Top comments (0)