Currency pairs
Use these methods to manage currency pairs.
GET[host]/api/v2/currencies/pairs |
|
GET[host]/api/v2/currencies/pairs/{pairId} |
|
POST[host]/api/v2/currencies/pairs |
|
PUT[host]/api/v2/currencies/pairs/{pairId} PATCH[host]/api/v2/currencies/pairs/{pairId} |
|
DELETE[host]/api/v2//currencies/pairs/{pairId} |
Get a list of currency pairs
Use this method to obtain a list of the currency pairs available in the Back Office.
To obtain detailed information about a specific currency pair, use a separate method to get currency pair details.
Request
Header parameters:
Authorization: Bearer <token>
Query parameters:
The following filter parameters are available for this method:
- fromCurrency
The numeric code of a base currency.
- toCurrency
The numeric code of a quote currency.
- isEnabled
If
true
, a currency pair can be exchanged by clients in the B2Core UI; otherwise,false
.- isEnabledForAdmin
If
true
, a currency pair can be exchanged via the Back Office; otherwise,false
.- isHedgingEnabled
If
true
, exchange operations in this currency pair are hedged; otherwise,false
.- maxAmountFrom
The maximum allowed amount per exchange operation, specified for a base currency.
- maxAmountTo
The maximum allowed amount per exchange operation, specified for a quote currency.
- stepFrom
The minimum increment (specified for a base currency) by which an amount can be changed at a time.
- stepTo
The minimum increment (specified for a quote currency) by which an amount can be changed at a time.
The following sorting parameter is available for this method:
- createTime
The date and time when a currency pair was added.
Refer to the Query parameters section of the Overview for details on applying filter and sorting parameters.
GET[host]/api/v2/currencies/pairs
curl --location -g --request GET 'https://host.name/api/v2/currencies/pairs?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[fromCurrency]=840&filter[toCurrency]=826&filter[isEnabled]=true&filter[isEnabledForAdmin]=true&filter[isHedgingEnabled]=true&filter[maxAmountFrom]=0.1&filter[maxAmountTo]=4.1&filter[stepFrom]=0.1&filter[stepTo]=4.1' \
--header 'Authorization: Bearer <token>'
Response
A response includes an array of Currency Pair objects providing information about the currency pairs matching the request parameters.
Get currency pair details
Use this method to obtain detailed information about a specified currency pair.
To obtain a list of available currency pairs, use a separate method to get a list of currency pairs.
Request
Header parameters:
Authorization: Bearer <access_token>
Path parameters:
- pairId required
The currency pair identifier.
GET[host]/api/v2/currencies/pairs/{pairId}
curl --location --request GET 'https://host.name/api/v2/currencies/pairs/1' \
--header 'Authorization: Bearer <token>'
Response
A response includes a Currency Pair object providing information about the specified currency pair.
Add a currency pair
Use this method to define a new currency pair.
Request
Header parameters:
Authorization: Bearer <token>
Body:
Specify the following parameters for a currency pair:
- fromCurrency integer
The numeric code of a base currency.
- toCurrency integer
The numeric code of a quote currency.
- isEnabled boolean
If
true
, a currency pair can be exchanged by clients in the B2Core UI; otherwise,false
.- isHedgingEnabled boolean
If
true
, exchange operations in this currency pair are hedged; otherwise,false
.- isEnabledForAdmin boolean
If
true
, a currency pair can be exchanged via the Back Office; otherwise,false
- step number
The minimum increment by which an amount can be changed at a time.
- maxAmount number
The maximum allowed amount per exchange operation.
POST[host]/api/v2/currencies/pairs
curl --location --request POST 'https://host.name/api/v2/currencies/pairs' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"fromCurrency": 840,
"toCurrency": 826,
"isEnabled": false,
"isHedgingEnabled": false,
"isEnabledForAdmin": true,
"step": 55.55,
"maxAmount": 55.55
}'
Response
A response includes a Currency Pair object providing information about the added currency pair.
Update a currency pair
Use this method to update a specified currency pair.
Note
Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- pairId required
The currency pair identifier.
Body:
The following field values can be updated for a specified currency pair:
- fromCurrency integer
The numeric code of a base currency.
- toCurrency integer
The numeric code of a quote currency.
- isEnabled boolean
If
true
, a currency pair can be exchanged by clients in the B2Core UI; otherwise,false
.- step number
The minimum increment by which an amount can be changed at a time.
- isHedgingEnabled boolean
If
true
, exchange operations in this currency pair are hedged; otherwise,false
.- isEnabledForAdmin boolean
If
true
, a currency pair can be exchanged via the Back Office; otherwise,false
.- maxAmount number
The maximum allowed amount per exchange operation.
PUT[host]/api/v2/currencies/pairs/{pairId}
curl --location --request PUT 'https://host.name/api/v2/currencies/pairs/1' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"fromCurrency": 840,
"toCurrency": 826,
"isEnabled": true,
"step": 55.55,
"isHedgingEnabled": false,
"isEnabledForAdmin": false,
"maxAmount": 55.55
}'
Response
A response includes a Currency Pair object providing information about the updated currency pair.
Delete a currency pair
Use this method to remove a specified currency pair.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- pairId required
The currency pair identifier.
DELETE[host]/api/v2/currencies/pairs/{pairId}
curl --location --request DELETE 'https://host.name/api/v2/currencies/pairs/1' \
--header 'Authorization: Bearer <token>'
Response
In case of success, no response body is returned.