Convert
POST https://connect.cabital.com/api/v1/accounts/{account_id}/conversions
User Account Status¶
- Linked
- KYC Pass
Request Path Parameters¶
| Parameter | Required | Description |
|---|---|---|
account_id |
Yes | Customer account ID provided by Cabital. |
Request Body Parameters¶
Content Type: application/json
| Parameter | Required | Type | Description |
|---|---|---|---|
pair |
Yes | string | Trading pairs, format: buy_currency-sell_currency.e.g. USDT-EUR presents the quote information of Buy USDT and Sell EUR |
quote_id |
Yes | string | Quote ID, retrieve from request Quote API by parameter pair. |
quote |
Yes | string | Quote value, retrieve from request Quote API by parameter pair. |
buy_amount |
Yes | string | Buy amount, should follow the precision of buy currency. |
sell_amount |
Yes | string | Sell amount, should follow the precision of sell currency. |
major_ccy |
Yes | string | The currency customers enter on conversion UI, the system will check the corresponding amount meet the restriction. |
What affect the restriction of conversion?¶
The restriction follows the partner's configuration of the currency (config.conversion: min and max)
Calculation of sell amount or buy amount¶
major_ccy \ pair |
USDT-EUR | EUR-USDT |
|---|---|---|
| USDT | Buy USDT Sell EUR Buy amount multiply by the quote to calculate the sell amount. buy_amount*quote = sell_amount |
Sell USDT Buy EUR Sell amount divide by the quote to calculate the buy amount sell_amount*(1/quote) = buy_amount |
| EUR | Sell EUR Buy USDT Sell amount divide by the quote to calculate the buy amount sell_amount*(1/quote) = buy_amount |
Buy EUR Sell USDT Buy amount multiplied by the quote to calculate the sell amount. buy_amount*quote = sell_amount |
Response Parameters¶
| Parameter | Type | Description |
|---|---|---|
transaction_id |
string | Transaction ID |
status |
string | Transaction status |
Example¶
Request Data (Buy USDT Sell EUR)¶
The customer wants to buy 100 amount of USDT by selling EUR
-
Use pair
USDT-EURto get quote by Retrieve a quote by trading pair API -
Calculate the amount to sell:
100*1.011129 = 101.1129, use this as the value of parametersell_amount
Request Data (Sell EUR Buy USDT)¶
The customer wants to sell 100 amount of EUR by buying USDT
-
Use pair
USDT-EURto get quote by Retrieve a quote by trading pair API -
Calculate the amount to buy:
100*(1/1.011129) = 98.89934914, use this as the value of parameterbuy_amount
Request Data (Sell USDT Buy EUR)¶
The customer wants to sell 100 amount of USDT by buying EUR
-
Use pair
EUR-USDTto get quote by Retrieve a quote by trading pair API -
Calculate the amount to buy:
100*(1/1.0050453275) = 99.498, use this as the value of parameterbuy_amount
Request Data (Buy EUR Sell USDT)¶
The customer wants to buy 100 amount of EUR by selling USDT
-
Use pair
EUR-USDTto get quote by Retrieve a quote by trading pair API -
Calculate the amount to sell:
100*1.0050453275 = 100.50453275, use this as the value of parametersell_amount