Exchanges
Use this method to make exchange operations in specified amounts.
POST[host]/api/v2/exchanges |
Exchange currencies
Use this method to exchange currencies in specified amounts.
Request
Header parameters:
Authorization: Bearer <access_token>
Body:
Specify the following parameters for an exchange operation:
- sourceId integer required
The identifier of a source account.
- destinationId integer required
The identifier of a destination account.
- type integer required
The type of an exchange operation. Possible values:
1
— Source & Rate (Sell): when selling a currency, the destination amount cannot be set.2
— Destination & Rate (Buy): when buying a currency, the source amount cannot be set.3
— Source & Destination (Direct): when making a direct transfer, the rates cannot be set.- amount string
The amount to be exchanged.
- destinationAmount string
The transaction amount in a currency of a destination account.
- rate string
The exchange rate at which a transaction was made.
- writeOff string
The percentage added to an exchange rate when selling a currency.
- enroll string
The percentage added to an exchange rate when buying a currency.
POST[host]/api/v2/exchanges
curl --location --request POST 'https://host.name/api/v2/exchanges' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"sourceId": 4427,
"destinationId": 4426,
"type": 1,
"amount": "0.01",
"destinationAmount": "191.1765",
"rate": "19117.65",
"writeOff": "50.07",
"enroll": "40.8"
}'
Response
A response includes a Transaction object providing information about the exchange operation that was made.