Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

Building a Two-Sided Limit Order Bot for Polymarket BTC 5-Minute Markets

A systems guide to a two-sided limit order bot for Polymarket's BTC five-minute markets, covering market discovery, live order book state, post-only quoting, the 250 ms taker delay, and settlement reconciliation.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A two-sided Polymarket bot keeps a bid and an ask resting on an outcome of a BTC five-minute market, then tracks every acceptance, fill, cancel, and settlement that follows. Posting two orders is the easy part. The hard parts are knowing which market version and identifiers are current, keeping a local copy of the book accurate, pricing each quote against the live tick and minimum-size rules, and understanding that a fill changes your inventory and risk. A resting quote may never execute. A two-sided quote does not guarantee positive expected value, because that depends on your fair-value model, your costs, and who trades against you, and Polymarket’s documentation does not validate any pricing signal.

What a two-sided quote commits you to

A market maker posts a buy quote (the bid) and a sell quote (the ask) around its estimate of fair value. If the bid fills, the bot holds more of that outcome. If the ask fills, the bot’s holding in that outcome shrinks, and the platform’s balance requirements decide whether that sell is allowed. Every fill is a position the bot must carry until the market resolves. The main risks are:

As an Amazon Associate I earn from qualifying purchases.

  • Non-fills. A quote can be accepted and rest without trading. A correct fair-value estimate still earns nothing if nobody takes the price.
  • Adverse selection. Orders most likely to hit a quote are often those that move the price against you right afterwards. Fills tend to cluster when a quote is wrong.
  • Inventory risk. One-sided fills leave you holding an outcome whose price keeps moving until the window ends.
  • Stale quotes. If the book moves faster than your cancel loop, you can be filled at a price you would no longer choose.

How Polymarket orders work

Polymarket’s central limit order book (CLOB) is hybrid. Orders are created and matched offchain, and trade settlement happens onchain. Orders are signed messages, and the Order Lifecycle documentation describes settlement as non-custodial. Read the Order Lifecycle page before writing any signing or settlement code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The documentation states that “All orders on Polymarket are limit orders.” There is no separate market-order type to rely on. Immediate execution comes from the time-in-force and fill controls covered below, so a bot that wants to cross the spread has to choose one of those controls deliberately.

Step 1: Discover the active market at runtime

Identifiers, exchange route, and terms can change between market versions and intervals, so nothing from the previous window should carry over. At the start of each window, the bot should:

  1. Query the metadata for the active BTC five-minute interval and select the market by its interval and status, not by a cached identifier.
  2. Read the outcome identifiers returned for that market version. Polymarket’s Place Orders page distinguishes token IDs for CTF markets from position IDs for Protocol V2 markets, so branch on the market version instead of assuming one format.
  3. Confirm the market is open and accepting orders before subscribing or quoting. A market that is listed but closed, paused, or past its window should produce no quotes.
  4. Read the end time and the resolution rules printed on that market’s page. This guide does not describe how the BTC five-minute contract resolves or which price observation decides the result, and rules can differ by interval, so verify them on the live market for each window.

Step 2: Seed and maintain local book state

Seed from a snapshot

For each outcome, request the current order book. Load the bids, the asks, and the market’s min_order_size and tick_size, along with any market flags the response returns. Store the local receive time with every snapshot. Because the minimum size and tick belong to the market version, keep them per outcome and per window, not in a configuration file.

Apply the market stream

Subscribe to the market stream described in the Real-Time Data documentation for four event types: book (full book snapshots), price_change (incremental updates), last_trade_price, and tick_size_change. Treat a book event as a replacement for the local book on that outcome, and apply each price_change to the matching price level. When a tick_size_change arrives, hold or cancel quotes on that outcome, reload its constraints from the market, and resume only once rounding uses the new tick.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Freshness, gaps, and recovery

Treat the local book as a cache of changing market data, not as the authoritative record. The documentation shows which data is available but does not spell out a complete local-book recovery procedure, so the safeguards below are design choices you need to implement and test yourself:

  • Stamp every event with a local receive time and mark the book stale once its newest update is older than a threshold you set.
  • Detect gaps and out-of-order messages. If an incremental update cannot be applied cleanly, discard the local book and request a fresh snapshot.
  • On any disconnect, hold or cancel quotes on the affected outcomes, resubscribe, and re-seed from a snapshot before quoting again.
  • Compare your best bid and ask with a fresh snapshot at intervals. A persistent mismatch means the local book is wrong, and quoting should stop until it is rebuilt.

Choose the order type for each purpose

Five controls matter for a quoting bot. The behaviors below come from Polymarket’s Order Lifecycle and Place Orders pages.

Control Documented behavior What it means for a quote
GTC Rests until filled or canceled The usual persistent quote. The bot must update or cancel it itself.
GTD Expires at a specified time Lets a quote lapse on its own at a time you choose, such as before a market boundary.
FOK Fills entirely or cancels immediately Not a resting maker quote. Suited only to deliberate all-or-nothing taking.
FAK Fills what is available and cancels the remainder Allows an immediate partial execution. The unfilled quantity is cancelled, not left resting.
Post-only Rejected if it would immediately match Enforces maker-only quoting. A rejection is not a fill and needs a reprice rule.

Post-only controls how an order enters the book, not whether it trades later. A post-only order that rests can sit unfilled for the rest of its life.

Price both sides

Fair value is your model

A common design estimates fair value, places a bid below it and an ask above it, and limits both by inventory and a maximum spread. Where the estimate comes from is your decision. The API documentation covers order mechanics and does not validate any signal, so the model needs its own evaluation before it is trusted with capital.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Round to the tick and clear the minimum size

Before any quote is submitted, check the following against the live market values:

  • Round the bid down and the ask up to the outcome’s current tick size. Rounding this way never makes a quote more aggressive than your model.
  • Check the size against the live min_order_size. If the quote is below it, skip the quote or resize it within your limits. Never round the size below the minimum.
  • Check the balance the platform requires for that side, including funds reserved by resting orders.
  • Check that the quote does not cross the opposing best price. Post-only will reject it if it does, but the bot should not generate it in the first place.
# Illustrative logic only, not an SDK call
tick = market.tick_size              # read from the live market for this outcome
bid = floor(model_bid / tick) * tick
ask = ceil(model_ask / tick) * tick
if size < market.min_order_size: skip_or_resize
if bid >= best_ask or ask <= best_bid: do_not_submit

With a tick of 0.01 (an example only, not the value of any live market), a model bid of 0.5437 rounds to 0.54 and a model ask of 0.5612 rounds to 0.57.

Post as a maker, and handle rejections

Use post-only on quotes meant to add liquidity. Polymarket’s Order Lifecycle documentation states, “Post-only orders will only rest on the book.” An order that would execute immediately is rejected rather than taking liquidity. A rejection means the book has moved through your price. The retry rule should reprice from fresh book state and cap how many times it resubmits, so a fast-moving book cannot trap the bot in a submit loop.

Track order state, fills, and cancellations

Keep acceptance and match separate

Store each order’s returned status and update inventory only from confirmed fills. Log these events separately:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Acceptance: the platform accepted the order and it is live. Acceptance alone means no fill has occurred.
  • Match: part or all of the order has traded. Update inventory from the confirmed match quantity, including partial amounts.

Settlement is a third event and is covered in the reconciliation section below.

Partial fills and reserved balances

A resting order can fill in pieces. Each partial fill changes inventory and moves reserved balance, so the bot should recompute the remaining size from the platform’s reported state rather than from the original quote. After any partial fill, check whether the remaining quote still fits the limits and the current fair value.

Cancellation is a request, not an undo

A cancel request cannot reverse a fill that has already matched. Cancel and replace quotes when fair value, the book, the market phase, or a risk limit changes. On delayed markets (next section), an order may be uncancelable during its pending window, so keep treating it as live until the platform confirms its state.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Marketable orders and the 250 ms taker delay

The Order Lifecycle documentation says selected crypto and finance up/down markets apply a 250 ms taker delay before final matching or resting behavior. Whether a market applies it is set per market by a flag named itode, which you can read from the public CLOB market endpoint. Do not assume every BTC five-minute market has the delay. Query each market.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When the delay applies, a marketable order does not behave like an instant taker. A strategy that assumes it can fill and cancel immediately will misstate its exposure. Handle it this way:

  • Read itode before the window starts and store it with the market version.
  • Mark a marketable order as pending, not as filled or cancelled, until the platform reports its state.
  • Keep the exposure estimate conservative during the pending period, and do not submit further marketable orders against it.

Risk limits, monitoring, and the emergency stop

Define hard limits in code before the bot quotes anything. Polymarket does not supply these values, and appropriate levels depend on your capital and model. Set limits for:

  • Total inventory across outcomes
  • Per-outcome exposure
  • Maximum feed age before quotes are pulled
  • Maximum quoted spread
  • Number of open orders
  • Loss per window and per session

Add an emergency cancel path that cancels all open orders and blocks new submissions. Trigger it on a limit breach, a feed failure, a reconciliation mismatch, or an unhandled error. Fail closed: if the bot cannot confirm its open orders or balances after a reconnect, it should not quote until it can. Log each state transition with a timestamp, and watch feed age, the local open-order count against the platform’s count, and inventory against reconciled balances.

Where the bot runs is an operational choice, not a platform requirement. A restart is a reconnect, so the recovery rules above apply to it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Settlement reconciliation

Polymarket matches offchain and settles onchain. A match your bot recorded is not final until settlement is confirmed, and the settled position must agree with the bot’s inventory. Before each window and after every reconnect:

  1. Fetch open orders and compare them with the local set of live orders.
  2. Fetch fills for the market and compare them with local inventory.
  3. Fetch balances and positions and compare them with reconciled inventory.
  4. If any count or quantity disagrees, cancel open quotes on that market and rebuild state before quoting again.

After resolution, reconcile final positions against the outcome stated in that market’s resolution rules, not against an assumption about how a different interval resolved.

Liquidity rewards: what is and is not established

Polymarket’s Liquidity Rewards page describes reward scoring for eligible resting orders. Two details matter for planning:

  • The page lists a $1 minimum reward payout as a general program detail. Eligibility and scoring configuration are market-specific, so check the settings for each market you quote.
  • The page states that the special crypto TWAP reward allocation, a $1 million allocation through August, has ended. Do not model it as active.

The page does not show a publication date, so confirm current terms on the day you deploy. Treat any reward as an uncertain bonus that is verified against current market terms, not as part of the quote’s expected value.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pre-window checklist

  • Market version, interval, and status confirmed from metadata; no identifiers carried over from the previous window.
  • Outcome identifiers read for the market version (token ID or position ID).
  • End time and resolution rules read on the live market page.
  • tick_size and min_order_size read for each outcome from the live market.
  • itode read and delay handling set to match.
  • Market stream connected, snapshot seeded, feed age under your threshold.
  • Open orders, fills, balances, and inventory reconciled with the platform.
  • Risk limits and the emergency cancel path loaded and tested.
  • Reward terms confirmed on the market’s current settings, if rewards are part of the plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.