Cross rates

Cross rates refer to the exchange rate between two currencies that are not the official currencies of the country where the exchange rate is being quoted. Essentially, it is the rate at which two foreign currencies can be exchanged directly, without first converting them into a third currency. This section describes the process of setting up cross prices for all assets available in the system.

Get cross rates

GET/crossRates

This method is used to get all cross rates available on this server, note that results can be filtered in various ways, for example by instrument or route. To apply such filtering, you should add it to the request query, see the table below.

Body

Name
Type
Description

fromCurrencyId

string

Identifier of the basic asset.

instrumentId

string

Is used to filter results by the specified instrument used as a currency pair.

mode

string

Is used to filter results by the specified cross rate type. Valid value 0 - const rate, 1 - one cross pair, 2 - two cross pairs.

routeId

string

Is used to filter results by the specified route used for receiving current asset.

toCurrencyId

string

Identifier of the quoting asset.

CURL

curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/crossRates" -H "accept: application/json" -H "Authorization: Bearer eyI2ODc3MzA4NjMiOjY4NzczMDg2MywiLTE0NjEzM...RWSeWGzgNVAgZxEXGTTTPZUCqSXnvU9_q_EXpLM5-HwBpteM--YAAAA.RZeIHG_X1F_gf0mSUdQ-iDtXQFEBmNmJlZ7K3gbE9NA"

Response

[
  {
    "fromCurrencyId": 30103,
    "toCurrencyId": 4,
    "rate": 1,
    "rateBid": 1,
    "rateAsk": 1
  },
  {
    "fromCurrencyId": 17903,
    "toCurrencyId": 1603,
    "rate": 1,
    "rateBid": 1,
    "rateAsk": 1
  }
]

The 200 OK code will be returned in the case of a successful response. The following useful data is received in the response body as well:

  • rate - defines the cross rate. This parameter is used if mode = 0;

  • rateBid - current cross rate BID price;

  • rateAsk - current cross rate ASK price.

Cross rates by asset

GET/assets/{assetId}/crossRates

This method is used to get cross rates for the specified asset, which should be indicated in the request path. The request will contain all other assets available on this server with the indication of their rates in relation to the specified asset.

Path/Body

Name
Type
Description

assetId

string/path

Identifier of the asset for which cross rates qre requested

instrumentId

string/body

Is used to filter results by the specified instrument used as a currency pair.

mode

string/body

Is used to filter results by the specified cross rate type. Valid value 0 - const rate, 1 - one cross pair, 2 - two cross pairs.

routeId

string/body

Is used to filter results by the specified route used for receiving current asset.

CURL

Response

The 200 OK code will be returned in the case of a successful response with the indication of all other assets in relation to the requested one (id=4803). Response parameters are described in the previous point.

Get cross rate

GET/assets/{assets1}/crossRates/{assets2}

This method is used to get cross rate settings. For this purpose, both base and quoting currencies should be specified in the request path.

Path

Name
Type
Description

assets1*

string

Identifier of the basic asset

assets2*

string

Identifier of the quoting asset

CURL

Response

The successful response 200 OK will contain several parameters that are described above in this article. If some parameters are absent (for example they can be filled for two cross pairs only), the null value will be received instead.

Update cross rate

PATCH/assets/{assets1}/crossRates/{assets2}

This method is used to modify cross rates. Base/Quoting assets should be specified in the request path, while all parameters like mode, rate, etc. are specified in the body.

Path

Name
Type
Description

assets1*

string/path

Identifier of the basic asset

assets2*

string/path

Identifier of the quoting asset

instrumentId1

integer/body

Defines instrument identifier that consist the current asset in first currency pair. The parameter is used if mode = 1 or mode = 2

instrumentId2

integer/body

Defines instrument identifier that consist the current asset in second currency pair. The parameter is used if mode = 2

mode

integer/body

Defines cross type of assets. Valid value 0 - const rate, 1 - one cross pair, 2 - two cross pair

priceType

integer/body

Defines price type. The parameter is used if mode = 1 or mode=2. Valid value 0 - BID, 1 - ASK, 2 - (BID+ASK)/2

rate

double/body

Defines the cross rate. The parameter is used if mode = 0

routeId1

integer/body

Defines route identifier. The parameter is used if mode = 1 or mode = 2

routeId2

integer/body

Defines route identifier. The parameter is used if mode = 2

CURL example (only rate is changed)

Response

In the response, you will simply receive the 204 No content code, which means that the cross rate is changed successfully.

Set default cross rate

DELETE/assets/{assets1}/crossRates/{assets2}

This method is used to set up default cross rate settings. You should specify both base/quoting assets in the request path for this purpose.

Path

Name
Type
Description

assets1*

string

Identifier of the basic asset

assets2*

string

Identifier of the quoting asset

CURL

Response

In the response, you will simply receive the 204 No content code, which means that the cross rate is successfully reset.

Last updated