DEX essentials

What order surplus means after an intent is filled

Calculate the improvement over a signed limit for sell and buy orders while keeping surplus separate from investment profit.

Order surplus measures how much an execution improves on the order's minimum acceptable terms. It is a comparison with the signed limit, not necessarily a gain against the wider market or the user's original purchase cost.

A sell-order example

Assume a hypothetical order sells 100 A and requires at least 250 B. If the settled receipt is 258 B under the same accounting convention, output-denominated surplus is 8 B. The reference point is the 250 B limit.

That does not establish that A was sold above its current market value. If another route could have delivered 260 B, the order still has positive surplus relative to its own limit while underperforming that alternative.

A buy-order example

Now assume an order requires exactly 250 B and permits spending at most 105 A. If it spends 101 A, the improvement relative to the cap is 4 A. Its natural denomination is the saved input asset rather than extra output.

These are simplified calculations. Fees, partial fills and protocol scoring can change the precise accounting needed for a real order.

CoW's limit-order documentation discusses improvements over signed limits. Its auction description uses surplus in proposal selection. A protocol's scoring convention must be read before comparing its numbers with a hand calculation.

A loose limit can make surplus look large

If two otherwise identical orders settle at the same rate but have different limits, they report different surplus relative to those limits. The looser order can show more surplus without receiving more tokens.

For this reason, surplus alone is an incomplete execution-quality metric. Preserve the actual input and output, signed boundary, fee treatment and benchmark. Those fields show whether a large surplus represents exceptional execution or merely a permissive starting constraint.

Do not confuse order surplus with portfolio profit. Portfolio profit needs a separate cost basis and valuation method; the order's acceptable minimum supplies neither.

Sources & verification (3)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Limit orders

    Limit price, expiration and partial fill concepts.

    https://docs.cow.fi/cow-protocol/concepts/order-types/limit-orders
  2. Fair Combinatorial Batch Auction

    Current CoW auction model, aggregation and fairness filtering.

    https://docs.cow.fi/cow-protocol/concepts/introduction/fair-combinatorial-auction
  3. GPv2Settlement

    Settlement checks, partial order constraints and clearing-price mechanics.

    https://docs.cow.fi/cow-protocol/reference/contracts/core/settlement

Continue reading

What a settlement contract does after a quote is selected What an intent means in decentralized trading What a solver does for a swap order