> 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/integrations/integrate-tradecraft/guide-building-a-trading-interface.md).

# Guide: Building a Trading Interface

## Token Support

If your wallet fully supports CIP-56 tokens you can freely integrate all Tradecraft pools for trading, along with add and remove liquidity options (which return CIP-56 compliant Tradecraft LP tokens).

If your wallet supports only a whitelist of Canton tokens you will need to manually limit your interface to only allow trading of your wallet's supported tokens.

## Pools API

To build a trading interface that supports all pools listed on Tradecraft, start by using the [Pools](/api/routes/pools.md#get-pools) API to fetch a list of all pools. Note that multi-hop trades are not yet supported.&#x20;

To get a list of tradable token pairs for a given token, run a reduce function on the list of pools and construct a mapping of each unique token to a list of other tokens. Every time a token appears in a pool entry, add its paired token to its list of tradable tokens. With the two pools we have online now, your output would look like this:

```javascript
const tradableTokens = {
    'CC': ['USDCx', 'CBTC'],
    'USDCx': ['CC'],
    'CBTC': ['CC']
}
```

Now you can create a widget with token drop-downs similar to a standard swap widget that looks something like the below image. Each entry in `tradableTokens` can be added to the first drop-down, and the second drop-down can be populated with the array value for that token.

<figure><img src="/files/1o84PIyXFIZioJ7nGbGG" alt=""><figcaption></figcaption></figure>

## Quote API

{% hint style="warning" %}
**Important**

While the API is currently named "quote", these quotes should be presented to users as *estimates*. Since the on-chain portion of a trade is only initiated after the user sends funds and after Tradecraft gets to their order and begins execution, the price returned from the quote API may not be the price the user receives, unless a limit is specified for the trade.
{% endhint %}

There are two API's for getting trade quotes–one to specify amount in, and one to specify amount out. Use either or both as your interface requires. For example in the widget above, the API for amount in would be used when the user types in the first input, showing response in the second, and when the user types in the second input, the response would be shown in the first input. Both APIs can be found on the [Quotes](/api/routes/quotes.md) API page.

## Initiating a Trade

There are two options for executing trades, both introduced on the [Integration](/integrations/integrate-tradecraft/integration.md) page.&#x20;

For the Daml package integration option, see [Guide: DAR Integration](/integrations/integrate-tradecraft/guide-dar-integration.md).

For Pool Addresses, see [Using Tradecraft](https://docs.tradecraft.fi/using-tradecraft/).


---

# 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/integrations/integrate-tradecraft/guide-building-a-trading-interface.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.
