Urgent.News

What's breaking now, across thousands of outlets.

Tech

Polymarket Execution Verification: When “Filled” Doesn’t Mean Settled

A Polymarket trading bot can receive a successful execution response and still not know enough to safely continue trading. That sounds like a small implementation detail. It isn't. In a production trading system, there is a big difference between: "I sent the order." "I received a fill." "The fill has a transaction." "The transaction is confirmed." "The execution is settled." "My position matches…

Polymarket, a cryptocurrency market prediction platform, uses a trading bot that can receive a successful execution response even when the trade hasn't been fully settled. This distinction between "filled" and "settled" is crucial for maintaining accurate position tracking in trading systems.

A naive approach treats "filled" as a boolean that indicates the trade is complete, and updates the position accordingly. However, this approach hides important details and leads to incorrect assumptions about the trade's status. The actual execution lifecycle involves multiple states, from submission to settlement, each with its own potential for failure or uncertainty.

Polymarket's current system distinguishes between trade completion and the availability of transaction information. For instance, an order may be matched and a fill observed, but transaction details may still be pending. In such cases, the system should indicate "tx_pending" or "unknown" rather than assuming the trade is complete.

Several scenarios can lead to incomplete execution information:

1. An order is matched, but transaction information is not yet available. In this case, the system should not assume the trade is finished.

2. Only a partial quantity of an intended trade is executed. The remaining quantity needs proper accounting and verification.

3. The transaction is confirmed, but the external position still doesn't match the expected result. The trade may have been successful, but the position reconciliation is incomplete.

4. A WebSocket event can be missed if the connection is dropped and re-established. Reconnecting the socket does not automatically reconstruct missed events.

To address these issues, the system should implement an explicit state machine that separates facts from assumptions. An example of such a state machine is provided, with states ranging from "intended" to "position_verified." This approach allows the system to react appropriately to each state and ensure accurate position tracking.

A comprehensive execution record should include relevant information such as the strategy decision ID, internal execution ID, Polymarket order ID, trade ID, market ID, token ID, side, requested quantity, matched quantity, timestamps, transaction hash, and confirmation timestamp. By explicitly managing execution states and verifying position consistency, trading systems can avoid dangerous assumptions and maintain accurate records.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Moving on-premises block storage to AWS? The "divide by 625 MBps" sizing approach comes out wrong

Moving on-premises block storage to AWS? The "divide by 625 MBps" sizing approach comes out wrong — measured session and queue counts What this article does and does not cover: it covers the measured…

  • Dividing throughput by 625 MBps to determine sessions is inaccurate.
  • Testing shows method fails to capture system's true potential.
  • Approach not recommended for AWS block storage sizing.

Resumv: a resume editor you can deploy as a static site

Resumv is an MIT-licensed resume editor built with Astro and React. Its deployment model is deliberately small: build the project, serve the static output, and let the browser handle resume editing…

  • Resumv is an open-source resume editor under MIT license
  • Uses Astro and React for static site deployment
  • Supports 15 templates, PDF rendering, and export formats

More from Wednesday 30 September →