1
0 Comments

I Built a Dynamic TWAP Momentum Strategy for Polymarket

I've been experimenting with automated trading strategies for short-duration Polymarket crypto markets, and one problem kept appearing:

A good signal doesn't necessarily mean I should keep buying.

In fast BTC markets, the underlying price can move before the prediction-market order book fully adjusts.

That creates a potential edge.

But the edge can disappear just as quickly.

So instead of building another bot that blindly follows a TWAP schedule, I started working on a Dynamic TWAP Momentum strategy.

The basic idea:

Keep executing while the edge exists. Stop when it disappears.

The Problem With Fixed TWAP

Imagine the bot wants to buy 600 UP shares.

A basic TWAP might do:

50 → 50 → 50 → 50 → 50 → ...

It doesn't really care whether the original signal is still valid.

That's a problem in a 5-minute BTC market.

BTC might move strongly, the Polymarket price starts catching up, and the original edge disappears.

But the bot keeps buying because the schedule says it should.

I wanted execution to react to the market instead.

My Approach

The strategy combines:

  • BTC short-term momentum
  • A probability model
  • Polymarket market price
  • Dynamic position sizing
  • An edge-based stop condition

The basic calculation is:

Edge = Model Probability - Market Price

For example:

BTC reference = $100,000

UP = $0.48
DOWN = $0.52

A few seconds later, BTC starts moving upward:

10s return = +0.05%
30s return = +0.11%
60s return = +0.18%

I can combine these into a momentum signal:

Momentum =
    0.25 × Return10s
  + 0.35 × Return30s
  + 0.40 × Return60s

Suppose the probability model estimates:

P(UP) = 71%

while UP is trading at:

$0.58

The theoretical edge is:

71% - 58% = +13%

That's where the bot starts executing.

The Important Part: It Keeps Recalculating

Suppose the bot wants 600 shares.

Instead of immediately buying everything, it executes in slices.

| Slice | UP Price | Model P(UP) | Edge | Action |
| ----- | -------: | ----------: | ---: | ------ |
| 1 | $0.58 | 71% | +13% | Buy 50 |
| 2 | $0.59 | 70% | +11% | Buy 50 |
| 3 | $0.61 | 66% | +5% | Buy 50 |
| 4 | $0.64 | 60% | -4% | Stop |

The target was 600 shares.

The bot only bought 150.

And that's intentional.

The strategy isn't trying to maximize the number of filled shares.

It's trying to maximize the amount of good exposure it takes.

This Changed How I Think About TWAP

I used to think of TWAP mainly as an execution schedule.

Now I think about it more like a feedback loop:

Market Data
     ↓
Momentum
     ↓
Probability
     ↓
Market Price
     ↓
Calculate Edge
     ↓
Execute Small Slice
     ↓
Recalculate
     ↓
Repeat or Stop

Every slice gives the bot another opportunity to reconsider the trade.

That's particularly useful in short-duration markets where conditions can change within seconds.

The Interesting Trade-Off

There is a difficult balance here.

If the bot executes too slowly:

Wait too long
     ↓
Market catches up
     ↓
Opportunity disappears

But if it executes too aggressively:

Buy too much
     ↓
Price moves against you
     ↓
Edge disappears
     ↓
Large position remains

So the execution speed itself should depend on the current conditions.

Strong edge → larger/faster slices.

Weakening edge → smaller/slower slices.

No edge → stop.

What I Would Test

The interesting part isn't just whether the strategy makes money.

I'd want to compare Dynamic TWAP against a fixed TWAP using the same signals.

I'd measure:

  • PnL
  • average entry price
  • fill rate
  • slippage
  • average position size
  • maximum position
  • number of early stops
  • average edge at entry
  • average edge at execution
  • drawdown

One metric I'm particularly interested in is:

How much bad exposure does Dynamic TWAP avoid compared with fixed TWAP?

A lower fill rate isn't necessarily bad.

If the bot refuses to complete trades after the edge disappears, fewer fills may actually be the desired behavior.

What I'm Learning

The biggest lesson so far is that signal generation and execution should not be treated as the same problem.

A model can correctly identify an opportunity.

That doesn't mean the bot should immediately take the entire position.

The market is changing while you're executing.

So the execution layer needs to continuously ask:

Is this trade still worth taking?

That question can be more important than the original entry signal.

Where I Want to Take It

There are several things I'd like to experiment with next:

  • volatility-adjusted edge thresholds
  • order-book imbalance
  • adaptive slice sizes
  • time-to-expiration adjustments
  • execution latency
  • probability calibration
  • fill probability
  • dynamic TWAP intervals
  • transaction costs and slippage

The long-term goal isn't to build a more complicated bot.

It's to build a bot that is better at knowing when not to trade.

For short-duration prediction markets, I think that's a surprisingly important part of automated execution.

The goal isn't to finish the order.

The goal is to finish the order only while the opportunity is still there.

🤝 Collaboration & Contact
If you’re interested in building trading bots, buy trading bots, collaborating, exploring strategy improvements, or discussing about this system, feel free to reach out.

I’m especially open to connecting with:

Quant traders
Engineers building trading infrastructure
Researchers in prediction markets
Investors interested in market inefficiencies

📌 GitHub Repository
This repo has some Polymarket several bots in this system.
You can explore the full implementation, strategy logic, and ongoing updates about 5 min crypto market here:

https://github.com/Benjam1nCup/Polymarket-trading-bot-python-V2

💬 Get in Touch

If you have ideas, questions, or would like to collaborate or want these trading bots, don’t hesitate to reach out directly.
Feedback on your repo (based on your description & strategy)

Contact Info
Telegram
https://t.me/BenjaminCup

tags: #polymarket,#trading,#bot,#architecture,#tutorial,#TWAP

on August 27, 2026