# 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.8.7"},"tags":[{"name":"Quotes","description":"Trade quote calculations."}],"servers":[{"url":"https://api.tradecraft.fi/v1","description":"Mainnet"}],"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"]}},"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"]}}},"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.8.7"},"tags":[{"name":"Quotes","description":"Trade quote calculations."}],"servers":[{"url":"https://api.tradecraft.fi/v1","description":"Mainnet"}],"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"]}},"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"]}}},"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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
