> 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/assets-management.md).

# Assets management

Various assets can be created on the server and then assigned to trading instruments. This page describes methods intended for working with assets, you can create, modify, or delete such assets as *currencies*, *shares*, *commodities*, and *crypto CCY*.&#x20;

## Add new asset

<mark style="color:green;">`POST`</mark> `/assets`

This method is used to add a new asset to the server. All required parameters of the new asset should be specified in the request body.&#x20;

**Body**

| Name            | Type    | Description                                                                                          |
| --------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `creditForSell` | double  | Defines the credit for sell of asset. Set as a percentage. Parameter is used only if type=1 (Shares) |
| `description`   | string  | Comment for an object                                                                                |
| `instrumentId`  | integer | Defines the instrument for asset pricing. Parameter is used if type=1                                |
| `isin`          | string  | International securities identification number. Parameter is used and is mandatory if type=1         |
| `liquidityRate` | double  | The liquidity rate of the asset. Set as a percentage. Parameter is used if type=1                    |
| `minChange*`    | double  | The smallest indivisible part of the asset, required parameter                                       |
| `name*`         | string  | Defines the name of the object, required                                                             |
| `routeId`       | integer | Defines the route of instrument (by id) for asset pricing                                            |
| `type*`         | integer | Defines the type of asset. Valid value: 0 - Currency, 1 - Shares, 2 - Commodities, 3 - Crypto CCY    |

**Body example**

```json
{
  "creditForSell": 80,
  "description": "asset",
  "instrumentId": 25358,
  "isin": "US38150K1034",
  "liquidityRate": 30,
  "minChange": 1,
  "name": "AAPL1",
  "routeId": 353266,
  "type": 1
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X POST "http://sandbox.traderevolution.com:8443/proftrading/rest/assets" -H "accept: application/json" -H "Authorization: Bearer eyItMTQwMjU0MzMwIjotMTQwMjU0MzMwLCIxNjk0M...zQjrxRXqzR3vOTKMwx6jiRzJxAoQifhzQ" -H "Content-Type: application/json" -d "{ \"creditForSell\": 80, \"description\": \"asset\", \"instrumentId\": 25358, \"isin\": \"US38150K1034\", \"liquidityRate\": 30, \"minChange\": 1, \"name\": \"AAPL1\", \"routeId\": 353266, \"type\": 1}"
```

{% endcode %}

**Response**

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

```json
{
  "id": 31504,
  "name": "AAPL1"
}
```

{% endtab %}
{% endtabs %}

The response body will contain the name of the newly created asset and its ID.

{% hint style="success" %}
You can play with this BO REST API method here:

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

## Get all assets

<mark style="color:blue;">`GET`</mark>`/assets`

This method is used to get all assets added to this server. You can filter them by type or by name (several names can be specified in the filter) by adding these parameters to the request query.&#x20;

**Query**

| Name   | Type   | Description                                                                                                                                  |
| ------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | string | Filter by name. Several names can be specified using comma separator. By default this parameter is empty and response contains all entities. |
| `type` | string | Specifies the type of asset. Valid values: 0 - Currency, 1 - Shares, 2 - Commodities, 3 - Crypto CCY                                         |

**CURL**

{% code overflow="wrap" %}

```json
curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/assets" -H "accept: application/json" -H "Authorization: Bearer eyItMTQwMjU0MzMwIjotMTQwMjU0MzMwLCIxNjk0MjQxOTU0IjoxNjk0MjQxOTU0LCIxNTk1Nzk3ODEiOjE1OTU3OTc4MSwiMTMxMjQ2NTYzNiI6MTMxMjQ2NTYz...N3PKvhzQjrxRXqzR3vOTKMwx6jiRzJxAoQifhzQ"
```

{% endcode %}

**Response**

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

```json
[
  {
    "id": 30604,
    "name": "AAPL"
  },
  {
    "id": 25453,
    "name": "ABNB"
  },
  {
    "id": 19853,
    "name": "XAU"
  }
]
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

In the response, you will receive all assets (if the filtering is not applied) added to this server with an indication of their names and IDs.&#x20;

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

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

## Get asset (by its ID)

<mark style="color:blue;">`GET`</mark>`/assets/{assetId}`

This method allows to request of one required asset by its ID. The ID of the required asset should be specified in the request path.&#x20;

**Path**

| Name      | Type   | Description                                                   |
| --------- | ------ | ------------------------------------------------------------- |
| `assetId` | string | Unique identifier of the asset for which the info is required |

**CURL**

{% code overflow="wrap" %}

```json
curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/17903" -H "accept: application/json" -H "Authorization: Bearer eyItMTQwMjU0MzMwIjotMTQwMjU0MzMwLCIxNjk0MjQxOTU0IjoxNjk0MjQxOTU0LCIxNTk1Nzk3ODEiOjE1OTU3OTc4MSwiMTMxMjQ2NTYzNiI6MTMxMjQ2NTY...laehBdLtaVqEc5hdOMH2-n67klXORWDM_fpwTXlvi5xeI1E4o9gEAAA.GFtGN3PKvhzQjrxRXqzR3vOTKMwx6jiRzJxAoQifhzQ"
```

{% endcode %}

**Response**

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

```json
{
  "type": 3,
  "minChange": 1e-8,
  "description": "Test Crypto",
  "name": "Bitc_test",
  "isin": null,
  "instrumentId": null,
  "routeId": null,
  "liquidityRate": null,
  "creditForSell": null
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

In the response, you will receive full info on the required asset. If some parameters are absent (not available for this type), they will be stated as <mark style="color:red;">`null`</mark>.&#x20;

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

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

## Remove asset from the server

<mark style="color:green;">`DELETE`</mark>`/assets/{assetId}`

This method is used to delete an asset from the serve by its IDr. Please note that an asset will be deleted completely. The ID of the required asset should be specified in the request path.&#x20;

**Path**

| Name      | Type   | Description                                           |
| --------- | ------ | ----------------------------------------------------- |
| `assetId` | string | Unique identifier of the asset that should be removed |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "http://analyst-server.traderevolution.lan/proftrading/rest/assets/31504" -H "accept: application/json" -H "Authorization: Bearer eyIxMzg0ODcwOTczIjoxMzg0ODcwOTczLCI5OTQyNjU0Mzk...nOFBPo3bMx24MHApc6LhU2VTg6d6U"
```

{% endcode %}

**Response**

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

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

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

## Modify asset

<mark style="color:green;">`PATCH`</mark>`/assets/{assetId}`

This method is used to modify an asset that exists on the server. The request path should contain the ID of the asset that will be modified while the body should contain all parameters similar to the POST request.&#x20;

**Path/Body**

| Name            | Type         | Description                                                                                          |
| --------------- | ------------ | ---------------------------------------------------------------------------------------------------- |
| `assetId`       | string/path  | Unique identifier of the asset that should be modified                                               |
| `creditForSell` | double/body  | Defines the credit for sell of asset. Set as a percentage. Parameter is used only if type=1 (Shares) |
| `description`   | string/body  | Comment for an object                                                                                |
| `instrumentId`  | integer/body | Defines the instrument for asset pricing. Parameter is used if type=1                                |
| `isin`          | string/body  | International securities identification number. Parameter is used and is mandatory if type=1         |
| `liquidityRate` | double/body  | The liquidity rate of the asset. Set as a percentage. Parameter is used if type=1                    |
| `minChange*`    | double/body  | The smallest indivisible part of the asset, required parameter                                       |
| `name*`         | string/body  | Defines the name of the object, required                                                             |
| `routeId`       | integer/body | Defines the route of instrument (by id) for asset pricing                                            |
| `type*`         | integer/body | Defines the type of asset. Valid value: 0 - Currency, 1 - Shares, 2 - Commodities, 3 - Crypto CCY    |

**CURL**

{% code overflow="wrap" %}

```json
curl -X PATCH "http://sandbox.traderevolution.com:8443/proftrading/rest/assets/31506" -H "accept: application/json" -H "Authorization: Bearer eyIxMzg0ODcwOTczIjoxMzg0ODcwOTczLCI5OTQyNjU0MzkiOjk5NDI2NTQzOSwiMjQxOTkwMzY1IjoyNDE5OTAzNjUsIjgwNDExMTgzNyI6ODA0MTExODM3LCIt...H2aSInOFBPo3bMx24MHApc6LhU2VTg6d6U" -H "Content-Type: application/json" -d "{ \"creditForSell\": 81, \"description\": \"asset\", \"instrumentId\": 25358, \"isin\": \"US38150K1034\", \"liquidityRate\": 30, \"minChange\": 1, \"name\": \"AAPL1\", \"routeId\": 353266, \"type\": 1}"
```

{% endcode %}

**Response**

In the response you will receive the `200 OK` code, which means that update is performed successfully.&#x20;

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

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