> For the complete documentation index, see [llms.txt](https://docs.bancor.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bancor.network/developer-guides/write-functions/trading.md).

# Trading

Trading tokens on Bancor is as easy as calling a single function.&#x20;

Bancor allows trading of native ETH tokens, wrapped ETH (wETH) and any other supported ERC20 tokens such as LINK, USDC, USDT, WBTC and many more.

{% hint style="info" %}
As a developer, you can simulate the trading function call with the tokens you wish to trade to see if the transaction can be completed as is, or if there are unexpected issues. If the trade can't be completed it returns an error indicating the issue, such as un-supported tokens, permissions, etc, and includes a clear way to resolve them.
{% endhint %}

Bancor now supports 2 different “trade” functions that enable greater flexibility:  &#x20;

1. [tradeBySourceAmount](#tradebysourceamount) - \
   this is the “normal” trade function where you indicate the amount you wish to trade out and receive the max possible of the selected token based on the current pool rate.&#x20;
2. [tradeByTargetAmount](#tradebytargetamount) - \
   this function allows you to indicate exactly how much you wish to receive at the end of the trade. Meaning you indicate the amount you wish to receive, and the trade will use the required amount in order to fulfill your request. The benefit of using this function is that you will know exactly how much you receive at the end. &#x20;


---

# 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.bancor.network/developer-guides/write-functions/trading.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.
