Currencies
Use these methods to exchange currencies and obtain the current exchange rates.
GET[host]/api/v2/my/rates/{baseCurrency} |
|
GET[host]/api/v2/my/rates/{baseCurrency}/{quoteCurrency} |
|
POST[host]/api/v2/my/exchanges |
Get currency rates
Use this method to obtain a list of currencies available for exchange and their current rates.
Request
Header parameters:
Authorization: Bearer <access_token>
Path parameters:
- baseCurrency required
The alphabetic code of a base currency for which the exchange rates are retrieved.
GET[host]/api/v2/my/rates/{baseCurrency}
curl --location --request GET 'https://host.name/api/v2/my/rates/usd' \
--header 'Authorization: Bearer <token>'
Response
A response contains an array of objects providing information about the available quote currencies and their current exchange rates.
- quoteId string
The quote identifier.
- currency object
The details about the quote currency available for exchange. See the Currency object to learn more.
- expiredAt string
The date and time when the exchange rate data is due to expire.
- lifetime integer
The number of seconds the exchange rate data is valid.
- rate object
The details about a current exchange rate.
Show object fields- value string
The exchange rate.
- scale integer
The number of decimal places displayed when representing amounts in a currency.
{
"quoteId": "36f59381-5b54-48bd-a0c7-3b908c476732",
"сurrency": {
"alphabeticCode": "USD",
"minorUnit": 2,
"name": "US Dollar",
"numericCode": 840
},
"expiredAt": "2022-01-01T00:00:00+00:00",
"lifetime": 60,
"rate": {
"value": "1.000000000000000000",
"scale": 1
}
}
Get an exchange rate for a currency pair
Use this method to obtain a current exchange rate for a specified currency pair.
Request
Header parameters:
Authorization: Bearer <access_token>
Path parameters:
- baseCurrency required
The alphabetic code of a base currency.
- quoteCurrency required
The alphabetic code of a quote currency.
GET[host]/api/v2/my/rates/{baseCurrency}/{quoteCurrency}
curl --location --request GET 'https://host.name/api/v2/my/rates/btc/usd' \
--header 'Authorization: Bearer <token>'
Response
- quoteId string
The quote identifier.
- currency object
The details about a quote currency. See the Currency object to learn more.
- expiredAt string
The date and time when the exchange rate data is due to expire.
- lifetime integer
The number of seconds the exchange rate data is valid.
- rate object
The details about an exchange rate.
Show object fields- value string
The exchange rate.
- scale integer
The number of decimal places displayed when representing amounts in a currency.
{
"quoteId": "36f59381-5b54-48bd-a0c7-3b908c476732",
"сurrency": {
"alphabeticCode": "USD",
"minorUnit": 2,
"name": "US Dollar",
"numericCode": 840
},
"expiredAt": "2022-01-01T00:00:00+00:00",
"lifetime": 60,
"rate": {
"value": "1.000000000000000000",
"scale": 1
}
}
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:
- amount string required
The amount to be exchanged.
- destinationAccountId integer required
The identifier of a destination account.
- quoteId string required
The quote identifier.
- sourceAccountId integer required
The identifier of a source account.
POST[host]/api/v2/my/exchanges
curl --location --request POST 'https://host.name/api/v2/my/exchanges' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"amount": "1.000000000000000000",
"destinationAccountId": 1,
"quoteId": "36f59381-5b54-48bd-a0c7-3b908c476732",
"sourceAccountId": 1
}'
Response
A response includes a Transaction object providing information about the exchange operation that was made.