> For the complete documentation index, see [llms.txt](https://docs.tradecraft.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tradecraft.fi/api/routes/quotes.md).

# Quotes

Trade quote calculations.

## Get trade quote for fixed input

> Calculate how much of token B the user will receive when providing a fixed amount of token A.\
> Uses the constant product formula with double-sided fees.\
> &#x20;Note that token A and token B do not always correlate to the first and second tokens in the pool name.<br>

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.13"},"tags":[{"name":"Quotes","description":"Trade quote calculations."}],"servers":[{"url":"https://api.tradecraft.fi/v1","description":"Mainnet"},{"url":"https://tradecraft.validator.dev.canton.obsidian.systems/amm-http-api","description":"Devnet"}],"paths":{"/quoteForFixedInput/{tokenA}/{tokenB}":{"get":{"summary":"Get trade quote for fixed input","description":"Calculate how much of token B the user will receive when providing a fixed amount of token A.\nUses the constant product formula with double-sided fees.\n Note that token A and token B do not always correlate to the first and second tokens in the pool name.\n","operationId":"getQuoteTradeFixedInput","tags":["Quotes"],"parameters":[{"$ref":"#/components/parameters/tokenA"},{"$ref":"#/components/parameters/tokenB"},{"name":"givingAmount","in":"query","required":true,"description":"The amount of token A the user is giving","schema":{"type":"number","format":"double","minimum":0,"exclusiveMinimum":true}}],"responses":{"200":{"description":"Trade quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteTradeFixedInputResponse"}}}},"400":{"description":"Invalid parameters or AMM not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"parameters":{"tokenA":{"name":"tokenA","in":"path","required":true,"description":"The name/symbol of the first token (URL encoded).","schema":{"type":"string","enum":["CC","USDCx","CBTC","cETH","HANDL","EDELx","SBC"]}},"tokenB":{"name":"tokenB","in":"path","required":true,"description":"The name/symbol of the second token (URL encoded).","schema":{"type":"string","enum":["CC","USDCx","CBTC","cETH","HANDL","EDELx","SBC"]}}},"schemas":{"QuoteTradeFixedInputResponse":{"type":"object","required":["user_gets"],"properties":{"user_gets":{"type":"number","format":"double","description":"The amount of output token the user will receive."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message"}}}}}}
```

## Get trade quote for fixed output

> Calculate how much of token A the user must provide to receive a fixed amount of token B.\
> Uses the constant product formula with double-sided fees.\
> &#x20;Note that token A and token B do not always correlate to the first and second tokens in the pool name.<br>

```json
{"openapi":"3.0.3","info":{"title":"Tradecraft AMM HTTP API","version":"0.1.13"},"tags":[{"name":"Quotes","description":"Trade quote calculations."}],"servers":[{"url":"https://api.tradecraft.fi/v1","description":"Mainnet"},{"url":"https://tradecraft.validator.dev.canton.obsidian.systems/amm-http-api","description":"Devnet"}],"paths":{"/quoteForFixedOutput/{tokenA}/{tokenB}":{"get":{"summary":"Get trade quote for fixed output","description":"Calculate how much of token A the user must provide to receive a fixed amount of token B.\nUses the constant product formula with double-sided fees.\n Note that token A and token B do not always correlate to the first and second tokens in the pool name.\n","operationId":"getQuoteTradeFixedOutput","tags":["Quotes"],"parameters":[{"$ref":"#/components/parameters/tokenA"},{"$ref":"#/components/parameters/tokenB"},{"name":"gettingAmount","in":"query","required":true,"description":"The amount of token B the user wants to receive","schema":{"type":"number","format":"double","minimum":0,"exclusiveMinimum":true}}],"responses":{"200":{"description":"Trade quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteTradeFixedOutputResponse"}}}},"400":{"description":"Invalid parameters or AMM not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"parameters":{"tokenA":{"name":"tokenA","in":"path","required":true,"description":"The name/symbol of the first token (URL encoded).","schema":{"type":"string","enum":["CC","USDCx","CBTC","cETH","HANDL","EDELx","SBC"]}},"tokenB":{"name":"tokenB","in":"path","required":true,"description":"The name/symbol of the second token (URL encoded).","schema":{"type":"string","enum":["CC","USDCx","CBTC","cETH","HANDL","EDELx","SBC"]}}},"schemas":{"QuoteTradeFixedOutputResponse":{"type":"object","required":["user_gives"],"properties":{"user_gives":{"type":"number","format":"double","description":"The amount of input token the user must provide."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tradecraft.fi/api/routes/quotes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
