> For the complete documentation index, see [llms.txt](https://xpansionchain-1.gitbook.io/xpansionchain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xpansionchain-1.gitbook.io/xpansionchain/guides/basic-guides/creating-trades.md).

# Creating trades

## Creating trades

Creating a trade is also known as filling an order, or buying an asset. A user executes a trade by agreeing to purchase an asset at the terms specified in the order and then becomes the new owner of the asset.

📝GUIDES

* <mark style="color:blue;">Core SDK</mark>
* <mark style="color:blue;">Link SDK</mark>

### Core SDK[​](https://docs.x.immutable.com/docs/x/how-to-create-trades#core-sdk) <a href="#core-sdk" id="core-sdk"></a>

#### 1. Initialize the Core SDK[​](https://docs.x.immutable.com/docs/x/how-to-create-trades#1-initialize-the-core-sdk) <a href="#id-1-initialize-the-core-sdk" id="id-1-initialize-the-core-sdk"></a>

In order to use the Core SDK, you need to <mark style="color:blue;">initialize it</mark>.

#### 2. Generate signers[​](https://docs.x.immutable.com/docs/x/how-to-create-trades#2-generate-signers) <a href="#id-2-generate-signers" id="id-2-generate-signers"></a>

Creating a trade for a user requires a user's signature, so your application will need to create signers. See the guide on how to <mark style="color:blue;">generate signers</mark>.

#### 3. Create the trade[​](https://docs.x.immutable.com/docs/x/how-to-create-trades#3-create-the-trade) <a href="#id-3-create-the-trade" id="id-3-create-the-trade"></a>

WHEN SETTING <mark style="color:blue;">TAKER FEES</mark> IN THE TRADE PARAMS

* You cannot set more than 3 recipients

* You cannot set the same recipient more than once

* The combined fee percentage can’t exceed 100%

* Individual percentage fees can’t be <= 0%

* Typescript Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createTrade</mark>

Creating a trade for the order with ID `7232`:

```
const createTrade = async (wallet: WalletConnection, orderId: number) => {
  const ethAddress = await wallet.ethSigner.getAddress();
  const tradeData = {
    order_id: orderId,
    user: ethAddress
  } as GetSignableTradeRequest;

  const response = await client.createTrade(wallet, tradeData);
  return response;
}

createTrade(wallet, 7232)
  .then((result) => {
    console.log(result)
  })
  .catch((e) => {
    console.log(e)
  })
```

**Example response:**[**​**](https://docs.x.immutable.com/docs/x/how-to-create-trades#example-response)

```
{ 
  trade_id: 226892, // ID of trade within XpansionChain 
  status: '' // Current status of trade
}
```

* Kotlin (JVM) Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">buy</mark>

* Swift Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createTrade</mark>

* Golang Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">CreateTrade</mark>

💻EXAMPLE

* <mark style="color:blue;">CreateTrade</mark>
