> For the complete documentation index, see [llms.txt](https://guide.traderevolution.com/traderevolution-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.traderevolution.com/traderevolution-api/traderevolution-apis/backoffice-api/cross-rates.md).

# 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.&#x20;

## Get cross rates

<mark style="color:blue;">`GET`</mark>`/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.&#x20;

**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**

{% code overflow="wrap" %}

```json
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"
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

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

{% endtab %}
{% endtabs %}

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.

{% hint style="success" %}
You can try this method by following the link:

<https://sandbox.traderevolution.com:8443/proftrading/rest/swagger-ui.html#/Cross_rates/getCrossRatesListUsingGET>
{% endhint %}

## Cross rates by asset

<mark style="color:blue;">`GET`</mark>`/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.&#x20;

**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**

{% code overflow="wrap" %}

```json
curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/4803/crossRates" -H "accept: application/json" -H "Authorization: Bearer eyI2ODc3MzA4NjMiOjY4NzczMDg2MywiLTE0NjEzMjUOi0xNDYxMzI1NzUxLCItMTUwMTg4NDUwNCI6LTE1MDE4ODQ1MDQsIjg0NTA4MDgwOCI6ODQ1MDgw...EBmNmJlZ7K3gbE9NA"
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
[
  {
    "fromCurrencyId": 21054,
    "toCurrencyId": 4803,
    "rate": 2,
    "rateBid": 2,
    "rateAsk": 2
  },
  {
    "fromCurrencyId": 4803,
    "toCurrencyId": 903,
    "rate": 1,
    "rateBid": 1,
    "rateAsk": 1
  }
]
```

{% endtab %}
{% endtabs %}

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.&#x20;

{% hint style="success" %}
You can find this method by the link:

<https://sandbox.traderevolution.com:8443/proftrading/rest/swagger-ui.html#/Cross_rates/getCrossRatesByAssetUsingGET>
{% endhint %}

## Get cross rate&#x20;

<mark style="color:blue;">`GET`</mark>`/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.&#x20;

**Path**

| Name       | Type   | Description                     |
| ---------- | ------ | ------------------------------- |
| `assets1*` | string | Identifier of the basic asset   |
| `assets2*` | string | Identifier of the quoting asset |

**CURL**

{% code overflow="wrap" %}

```json
curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/4803/crossRates/1303" -H "accept: application/json" -H "Authorization: Bearer eyI2ODc3MzA4NjMiOjY4NzczMDg2MywiLTE0NjEzMjU3NTEiOi0xNDYxMzI1NzUxLCItMTUwMTg4NDUwNCI6LTE1MDE4ODQ1MDQsIjg0NTA4MDgwOCI6ODQ1MDgwOD...BmNmJlZ7K3gbE9NA"
```

{% endcode %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "mode": 1,
  "priceType": 0,
  "routeId1": 8113,
  "instrumentId1": 7,
  "isReverseInstrument1": true,
  "routeId2": null,
  "instrumentId2": null,
  "isReverseInstrument2": null,
  "rate": 3
}
```

{% endtab %}
{% endtabs %}

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 <mark style="color:red;">`null`</mark> value will be received instead.&#x20;

{% hint style="success" %}
Detailed info about this method can be found at this link:

<https://sandbox.traderevolution.com:8443/proftrading/rest/swagger-ui.html#/Cross_rates/getCrossRateUsingGET>
{% endhint %}

## Update cross rate

<mark style="color:yellow;">`PATCH`</mark>`/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*. &#x20;

**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)**

{% code overflow="wrap" %}

```json
curl -X PATCH "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/903/crossRates/1603" -H "accept: application/json" -H "Authorization: Bearer eyI2ODc3MzA4NjMiOjY4NzczMDg2MywiLTE0NjEzMjU3N...GzgNVAgZxEXGTTTPZUCqSXnvU9_q_EXpLM5-HwBpteM--YAAAA.RZeIHG_X1F_gf0mSUdQ-iDtXQFEBmNmJlZ7K3gbE9NA" -H "Content-Type: application/json" -d "{ \"rate\": 2.5}"
```

{% endcode %}

**Response**

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

{% hint style="success" %}
You can try this method by following the link:

<https://sandbox.traderevolution.com:8443/proftrading/rest/swagger-ui.html#/Cross_rates/patchCrossRateUsingPATCH>
{% endhint %}

## Set default cross rate

<mark style="color:red;">`DELETE`</mark>`/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.&#x20;

**Path**

| Name       | Type   | Description                     |
| ---------- | ------ | ------------------------------- |
| `assets1*` | string | Identifier of the basic asset   |
| `assets2*` | string | Identifier of the quoting asset |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/903/crossRates/1603" -H "accept: application/json" -H "Authorization: Bearer eyI2ODc3MzA4NjMiOjY4NzczMDg2MywiLTE0NjEzMjU3NTEiOi0xNDYxMzI1NzUxLCItMTUwMTg4NDUwNCI6LTE1MDE4ODQ1MDQsIjg0NTA4MDgwO...SUdQ-iDtXQFEBmNmJlZ7K3gbE9NA"
```

{% endcode %}

**Response**

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

{% hint style="success" %}
You can try this method by following the link:

<https://sandbox.traderevolution.com:8443/proftrading/rest/swagger-ui.html#/Cross_rates/resetCrossRateUsingDELETE>
{% endhint %}
