Skip to content

Explain /quote amounts and how to compare them in the API guide - #667

Draft
raq0x wants to merge 1 commit into
mainfrom
claude/youthful-noether-1ad774
Draft

raq0x wants to merge 1 commit into
mainfrom
claude/youthful-noether-1ad774

Conversation

@raq0x

@raq0x raq0x commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Why

Partners that integrate /quote directly keep putting quote.buyAmount into their generic toAmount. Ambire did this most recently (fixed in AmbireTech/ambire-common#2779). For sell orders that value is after network costs and the protocol fee. Other aggregators usually return output before gas, and the user pays gas separately. As a result, comparison UIs rank CoW last even when its price is the same.

The math is already on the How Intents Are Formed concepts page, but no other page links to it. The API guide says nothing about fees, and its quickstart spreads the whole quote response into the order.

Changes (docs/cow-protocol/integrate/api.mdx)

  • New Displaying and Comparing Quotes section:
    • what sellAmount, feeAmount and buyAmount mean for a sell order
    • how to get the before-network-costs amount (buyAmount + buyAmount * feeAmount / sellAmount - partnerFee) for comparison with other aggregators, and the after-network-costs amount for after-gas ranking
    • a warning not to rank on beforeAllFees, because it also adds back the protocol fee and leaves out the partner fee
    • why executed amounts are often better than quoted
    • a short note on buy orders
    • an example (10 USDT → USDC, based on a live mainnet quote and marked as illustrative)
    • an SDK pointer to getQuoteAmountsAndCosts / beforeNetworkCosts
  • Quickstart step 2 now builds the order from quoteResponse.quote. It signs sellAmount + feeAmount with feeAmount: "0", reduces buyAmount by slippage, and passes quoteId and from. This matches "Forming the Final Order" on the concepts page.
  • Links to the concepts page (amount stages, partner fee, buy-order flow, final order), plus a Resources entry.

yarn build passes (onBrokenLinks / onBrokenAnchors: throw).

🤖 Generated with Claude Code

Integrators keep using quote.buyAmount (after network costs) as a generic
toAmount next to other aggregators' before-gas amounts, so CoW ranks last
even at an equal price. Add a "Displaying and Comparing Quotes" section,
fix the quickstart to build the order from quoteResponse.quote, and link
the amount-stage math on the concepts page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raq0x
raq0x requested a review from a team as a code owner October 8, 2026 21:27
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 8, 2026 9:28pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a6f84b3-5c0e-44b6-abdb-bc2c27353e37
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch was successfully deployed

1 active deployment
Preview — f8b85546 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant