---
title: "Store buy / sell trade"
method: POST
path: "/v3/trade"
tags: ["Order Book"]
---

# Store buy / sell trade

`POST /v3/trade`

## Request

- Base URL: `https://api.tatum.io`
- URL: `https://api.tatum.io/v3/trade`
- Auth: API key in header `x-api-key`

/v3/trade

#### 2 credits for API call, 2 credits for each fill of the counter trade. 1 API call + 2 fills = 6 credits.

  

Store new buy / sell trade. If there is trade already available to fill, fill as much trades as possible.  
It is possible to charge fees for the trades. Fees are an extra amount on top of the trade amount and are paid in the currency that you going to block e.g.: - BUY BTC/USDT - fees will be paid in USDT - SELL BTC/ETH - fees will be paid in BTC

If you fill type of the trade with FUTURE\_BUY or FUTURE\_SELL the trade will behave as a trade future. The trade is concluded now but will be fulfilled in future. The date of fulfillment is by the “Seal Date” field. You can also block a percentage of the amount until the future trade has expired.

Futures can also penalize contracting parties if they don’t have the agreed balance available in their accounts. The penalty is calculated in the following way: Penalty amount = (Percentage of incomplete deal amount because of shortage from user) × (Maximum Penalty percentage of futures deal based on blocked amount and time interval) × (total blocked value).

Example of the BTC/USDT trade future:

The maker creates a sell with the following properties: 1 BTC at a price of 60000 USDT, with a blocking percentage of 22%, a penalty percentage of 45%, a system commision of 1% and with an expiration time of within 12 hours.

{
  "type": "FUTURE\_SELL",
  "price": "60000",
  "amount": "1",
  "pair": "BTC/USDT",
  "currency1AccountId": "60a236db1b57f60d62612bf3",
  "currency2AccountId": "609d0696bf835c241ac2920f",
  "fee": 1,
  "feeAccountId": "609d0696bf835c251ac2920a",
  "attr": {
    "sealDate": 1621990960631,
    "percentBlock": 22,
    "percentPenalty": 45
  }
}

The taker accepts the offer with a buy and blocks 13200 USDT (60000 USDT × 0.22) in their account.

{
  "type": "FUTURE\_BUY",
  "price": "60000",
  "amount": "1",
  "pair": "BTC/USDT",
  "currency1AccountId": "60a236db1b57f60d62612bf2",
  "currency2AccountId": "609d0696bf835c241ac2920a",
  "attr": {
    "sealDate": 1621990960631,
    "percentBlock": 22,
    "percentPenalty": 45
  }
}

At the time of the trade, the maker and taker have the following conditions. The maker has 0.65 BTC (35% deficit) in their account and the taker has 49200 USDT (18% deficit) in their account.

The maker penalty is equal to 0.35 × 0.22 × (0.45 × 1 BTC) = 0.03465 BTC. The taker penalty is equal to 0.18 × 0.22 × (0.45 × 60000 USDT) = 1069.2 USDT.

The system commission for the maker is 1 BTC × 1% = 0.01 BTC. The system commission for the taker is 60000 USDT × 1% = 600 USDT.

The maker’s assets after deducting penalties and commissions equals 0.65 - 0.03465 - 0.01 = 0.60535 BTC. The taker’s assets after deducting penalties and commissions equals 49200 - 1069.2 - 600 = 47530.8 USDT.

The amount received by the maker after the trade is (0.60535 × 60000) + 1069.2 = 37390.2 USDT and the taker receives 0.60535 + 0.03465 = 0.64 BTC.

## Request body

- union
  - CreateTrade
    - `type` 'BUY' | 'SELL', required: Type of the regular trade, BUY, SELL
    - `price` string, required: Price to buy / sell
    - `amount` string, required: Amount of the trade to be bought / sold
    - `pair` string, required: Trading pair
    - `currency1AccountId` string, required: ID of the account of the currency 1 trade currency
    - `currency2AccountId` string, required: ID of the account of the currency 2 trade currency
    - `feeAccountId` string: ID of the account where fee will be paid, if any. If trade is a BUY or FUTURE_BUY type, feeAccountId must have same currency as a currency of currency2AccountId, and vice versa if trade is a SELL or FUTURE_SELL type, feeAccountId must have same currency as a currency of currency1AccountId.
    - `fee` number: Percentage of the trade amount to be paid as a fee.
  - CreateFutureTrade
    - `type` 'FUTURE_BUY' | 'FUTURE_SELL', required: Type of future the trade, FUTURE_BUY, FUTURE_SELL
    - `price` string, required: Price to buy / sell
    - `amount` string, required: Amount of the trade to be bought / sold
    - `pair` string, required: Trading pair
    - `currency1AccountId` string, required: ID of the account of the currency 1 trade currency
    - `currency2AccountId` string, required: ID of the account of the currency 2 trade currency
    - `feeAccountId` string: ID of the account where fee will be paid, if any. If trade is a BUY or FUTURE_BUY type, feeAccountId must have same currency as a currency of currency2AccountId, and vice versa if trade is a SELL or FUTURE_SELL type, feeAccountId must have same currency as a currency of currency1AccountId.
    - `fee` number: Percentage of the trade amount to be paid as a fee.
    - `attr` object, required: Additional attributes for the future type.
      - `sealDate` number, required: Time in UTC when the future will be filled.
      - `percentBlock` unknown
      - `percentPenalty` unknown

## Response `200`

OK

- Id
  - `id` string: ID of the entity.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized. Not valid or inactive subscription key present in the HTTP Header.
- `403`: Forbidden. The request is authenticated, but it is not possible to required perform operation due to logical error or invalid permissions.
- `500`: Internal server error. There was an error on the server during the processing of the request.

---

[API](https://skmtc.dev/tatum/apis/virtual-accounts.md) - [All operations](https://skmtc.dev/tatum/apis/virtual-accounts/llms.txt) - [OpenAPI document](https://skmtc.dev/tatum/apis/virtual-accounts/revisions/ba220553084b?raw)
