Skip to content

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

Open
raq0x wants to merge 2 commits into
mainfrom
claude/youthful-noether-1ad774
Open

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

Conversation

@raq0x

@raq0x raq0x commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Added a Displaying and Comparing Quotes section to the API integration guide:
    • Explains sellAmount, feeAmount, and buyAmount for sell quotes.
    • Provides plain JavaScript calculations using the API response for total input, before-gas output, and after-gas ranking.
    • Includes an illustrative 10 USDT → USDC comparison with another aggregator.
    • Covers partner fees, token decimals, buy orders, and why execution can improve on a quote.
    • Distinguishes display amounts from amounts used when signing an order.
  • Added prominent gas-cost warnings after the first quote example and above the embedded Swagger reference.
  • Fixed the quickstart to build from quoteResponse.quote, sign sellAmount + feeAmount with feeAmount: "0", apply slippage, handle appData, and submit quoteId and from.
  • Corrected the USDC address in the quote request.
  • Linked to the detailed amount formulas and an optional SDK helper; the API calculations require no SDK.

Why

Direct API integrators can mistake quote.buyAmount for a before-gas output. For sell orders, it already reflects network costs and the applicable protocol fee. Comparing it with another provider’s before-gas output makes CoW look worse even when its net price is better.

Ambire recently encountered this (AmbireTech/ambire-common#2779). These changes explain the returned amounts where API integrators first encounter them and show how to compare quotes on the same basis.

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 13, 2026 2:20pm 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: 2537aa8c-b3f4-437b-a071-d9ccbb3e88ac
  • Autofix · 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.

@raq0x
raq0x marked this pull request as ready for review October 13, 2026 14:22

This branch was successfully deployed

1 active deployment
Preview — 330dbeb9 Deployed Oct 13, 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