2
0 Comments

Building a Polymarket TWAP Bot with Coinbase-Based Risk Management

I've been experimenting with automated trading infrastructure for Polymarket's short-duration crypto markets.

One problem I keep coming back to is risk management.

Finding an entry signal is relatively straightforward. The harder question is:

What happens when the market changes immediately after entering?

The Idea

My bot combines Polymarket market data with a real-time Coinbase price feed.

Polymarket Data
      +
Coinbase BTC Movement
      ↓
Risk Engine
      ↓
HOLD / REDUCE / EXIT

Polymarket provides information such as:

  • Token price
  • Order book
  • Liquidity
  • Time remaining
  • Position state

Coinbase provides another view of the underlying crypto market:

  • BTC price movement
  • Short-term momentum
  • Volatility
  • Rapid price changes

Coinbase isn't being used as a prediction oracle. It's an additional risk signal.

Example

Suppose the bot holds an UP position.

Then BTC suddenly moves sharply lower on Coinbase.

Instead of blindly waiting for the market to finish, the risk engine can reassess:

BTC moves
   ↓
Risk detected
   ↓
Check position + liquidity
   ↓
HOLD / REDUCE / EXIT

The goal is to make the bot continuously evaluate whether the conditions behind the original trade are still valid.

What I'm Working On

The interesting engineering challenge isn't only the trading strategy.

It's everything around it:

  • Real-time WebSocket data
  • Risk scoring
  • Position management
  • Low-latency execution
  • Stale-data detection
  • Partial fills
  • Liquidity checks
  • Failure handling

The broader architecture is:

Observe
  ↓
Analyze
  ↓
Enter
  ↓
Monitor
  ↓
Detect Risk
  ↓
Manage Position
  ↓
Exit

I'm continuing to experiment with this approach and improve the trading infrastructure.

Project

GitHub: Polymarket Trading Bot Python V2

Telegram: @BenjaminCup

If you're building trading bots, Web3 infrastructure, or real-time market systems, I'd be interested in hearing how you're approaching risk management.

Educational/research project. Automated trading involves significant risk and does not guarantee profits.

on September 17, 2026