> 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/client-api/trading.md).

# Trading

This API part grants access to trading operations

This section includes a description of several endpoints that serve trading purposes, for example submitting an order, modifying it, etc.

{% hint style="success" %}
A full list of available methods and their parameters can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading>
{% endhint %}

## Submit order

<mark style="color:green;">`POST`</mark>`/traderevolution/v1/accounts/{accountId}/orders`

This method is used to place a new order. Note that the request includes a body in the JSON format. The table below describes a set of parameters required for this process, where required parameters are marked with an asterisk `*`. The request body example is included as well.

**Path/Body/Query**

<table><thead><tr><th width="263">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>accountId*</code></td><td>integer/path</td><td>This parameter specifies the identifier of the account for which the order is submitted.</td></tr><tr><td><code>expireDate</code></td><td>integer/body</td><td>Timestamp in milliseconds for the order's expiration date.</td></tr><tr><td><code>price*</code></td><td>float/body</td><td>Price at which the order should be placed.</td></tr><tr><td><code>qty*</code></td><td>float/body</td><td>Quantity of the order. </td></tr><tr><td><code>side*</code></td><td>string/body</td><td>Side of the order: <code>buy</code> / <code>sell</code></td></tr><tr><td><code>cashOrderQty</code></td><td>float/body</td><td>Cash quantity of the order.</td></tr><tr><td><code>stopLoss</code></td><td>float/body</td><td>Stop loss price.</td></tr><tr><td><code>stopLossType</code></td><td>string/body</td><td><p>Type of the stop loss. Possible values: </p><p><code>absolute</code>, <code>offset in ticks</code>, <code>tr. offset</code>, <code>offset in %</code></p></td></tr><tr><td><code>stopPrice</code></td><td>float/body</td><td>Stop price for the order.</td></tr><tr><td><code>strategyId</code></td><td>string/body</td><td>Strategy identifier (if used).</td></tr><tr><td><code>takeProfit</code></td><td>float/body</td><td>Take profit price.</td></tr><tr><td><code>takeProfitType</code></td><td>string/body</td><td>Type of the take profit. Possible values are: <code>absolute</code>, <code>offset in ticks</code>, <code>offset in %</code></td></tr><tr><td><code>trStopOffset</code></td><td>float/body</td><td>Trailing stop offset.</td></tr><tr><td><code>tradableInstrumentId*</code></td><td>integer/body</td><td>Identifier of the instrument.</td></tr><tr><td><code>type*</code></td><td>string/body</td><td><p>Type of the order. Possible values are: </p><p><code>Market</code>, <code>Stop</code>, <code>Limit</code>, <code>Stop limit</code>, <code>Trailing stop</code>, <code>Care</code></p></td></tr><tr><td><code>userComment</code></td><td>string/body</td><td>Any useful information on the order. Available only for Care orders.</td></tr><tr><td><code>validity*</code></td><td>string/body</td><td>Validity of the order (e.g., <code>DAY</code>, <code>GTC</code>).</td></tr><tr><td><code>requestId</code></td><td>string/query</td><td>Identifier of a request (optional).</td></tr><tr><td><code>overnightExecution</code></td><td>bool/body</td><td>If true, the order can be placed and filled during overnight trading.</td></tr></tbody></table>

**Request body example**

```json
{
  "expireDate": 1714780800000,  
  "price": 1.1050,
  "qty": 1,
  "side": "buy",
  "stopLoss": 1.1000,
  "stopLossType": "absolute",
  "stopPrice": 1.1000,
  "strategyId": "basic_strategy",
  "takeProfit": 1.1100,
  "takeProfitType": "absolute",
  "trStopOffset": 0.0050,
  "tradableInstrumentId": 922,
  "type": "Limit",
  "validity": "DAY",
  "overnightExecution": true
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X POST "https://sandbox-api.traderevolution.com/traderevolution/v1/accounts/3243563/orders" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYW…wTx7Zz1TOMYgm9eH5vahBRc7gmaj9W1KiXHptp12t6ljQ" -H "Content-Type: application/json" -d "{ \"expireDate\": 1714780800000, \"price\": 1.1050, \"qty\": 1, \"side\": \"buy\", \"stopLoss\": 1.1000, \"stopLossType\": \"absolute\", \"stopPrice\": 1.1000, \"strategyId\": \"basic_strategy\", \"takeProfit\": 1.1100, \"takeProfitType\": \"absolute\", \"trStopOffset\": 0.0050, \"tradableInstrumentId\": 922, \"type\": \"Limit\", \"validity\": \"DAY\", \"overnightExecution\": true}"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok",
  "d": {
    "orderId": "3188861"
  }
}
```

{% endtab %}
{% endtabs %}

**Note:** When submitting a market order you will receive the `orderId` as well (instead of `positionId`). To get the information on the position, use the <mark style="color:blue;">`GET`</mark>`/accounts/{accountId}/positions` request.

{% hint style="danger" %}
It is strongly recommended that the **same types** be used for **stopLoss** and **takeProfit** - both are either **absolute** or **offset**.
{% endhint %}

Standard errors can also be received.

Note that if the order is rejected, you will receive an error response with a message explaining the reason for rejection.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/placeOrder>
{% endhint %}

## Cancel all orders for account

<mark style="color:red;">`DELETE`</mark>`/traderevolution/v1/accounts/{accountId}/orders`

This method is used to cancel *all* orders for a specified account. Note that orders can also be canceled by the specified instrument (by its `tradableInstrumentId`).

**Path/Query**

| Name                   | Type          | Description                                                                                                          |
| ---------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------- |
| `accountId*`           | integer/path  | Identifier of the account for which orders should be canceled.                                                       |
| `tradableInstrumentId` | integer/query | Identifier of the instrument in case orders should be canceled by the required instrument only (optional parameter). |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "https://sandbox-api.traderevolution.com/traderevolution/v1/accounts/3243563/orders" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1l…v-5zScTPDbRldFtsG5yp72ZvBtYc07bKA1bbdrVjtd1VQJyZyQnz-pcp77TgIVOBRc_2Tw4A"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful, and `error` if there was an issue. If an error occurs, a description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/cancelAllOrders>
{% endhint %}

## Close all positions for account

<mark style="color:red;">`DELETE`</mark>`/traderevolution/v1/accounts/{accountId}/positions`

This method is used to close all positions for a specified account. Please note that you can choose to close either all positions or only the positions for the specified instrument.

**Path/Query**

| Name                   | Type          | Description                                                                                                            |
| ---------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `accountId*`           | integer/path  | This parameter specifies the identifier of the account for which positions will be closed.                             |
| `tradableInstrumentId` | integer/query | Allows specifying the identifier of the instrument in case positions should be closed by the specific instrument only. |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "https://sandbox-api.traderevolution.com/traderevolution/v1/accounts/3243563/positions" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5N…Tv-5zScTPDbRldFtsG5yp72ZvBtYc07bKA1bbdrVjtd1VQJyZyQnz-pcp77TgIVOBRc_2Tw4A"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful, and `error` if there was an issue. If an error occurs, the description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/closeAllPositions>
{% endhint %}

## Cancel single order (by its ID)

<mark style="color:red;">`DELETE`</mark>`/traderevolution/v1/orders/{orderId}`

This method is used to cancel an existing order. Note that this method requires only one parameter - order id.  The`Order ID` can be found in the response received to the [request ](/traderevolution-api/traderevolution-apis/client-api/trading.md#submit-order)for submitting the order.&#x20;

**Path**

| Name       | Type    | Description                                                                   |
| ---------- | ------- | ----------------------------------------------------------------------------- |
| `orderId*` | integer | This parameter specifies the identifier of the order that should be canceled. |

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "https://sandbox-api.traderevolution.com/traderevolution/v1/orders/3185804" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1lMD…618vKtM7A8Qr0j7b72pkzNdCX8YUHM5B_tAawecFcEz7fw6GTYvLi_BdafQ1kR9acEQLNMA"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful, and `error` if there was an issue. If an error occurs, the description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/cancelOrder>
{% endhint %}

## Modify order (by its ID)

<mark style="color:yellow;">`PATCH`</mark>`/traderevolution/v1/orders/{orderId}`

This method is used to modify an existing order. Note that the request includes a body in the JSON format, the same as for the order submitting. The table below describes a set of parameters required for this process, where *required* parameters are marked with an asterisk `*`. The request body example is included as well.

**Path/Body/Query**

<table><thead><tr><th width="263">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>orderId*</code></td><td>integer/path</td><td>This parameter specifies the identifier of the account for which the order is submitted.</td></tr><tr><td><code>expireDate</code></td><td>integer/body</td><td>Timestamp in milliseconds for the order's expiration date.</td></tr><tr><td><code>price*</code></td><td>float/body</td><td>Price at which the order should be placed.</td></tr><tr><td><code>qty*</code></td><td>float/body</td><td>Quantity of the order. </td></tr><tr><td><code>stopLoss</code></td><td>float/body</td><td>Stop loss price.</td></tr><tr><td><code>stopLossType</code></td><td>string/body</td><td><p>Type of the stop loss. Available values: </p><p><code>absolute</code>, <code>offset</code>, <code>tr. offset</code></p></td></tr><tr><td><code>stopPrice</code></td><td>float/body</td><td>Stop price for the order.</td></tr><tr><td><code>takeProfit</code></td><td>float/body</td><td>Take profit price.</td></tr><tr><td><code>takeProfitType</code></td><td>string/body</td><td>Type of the take profit. <code>absolute</code> /  <code>offset</code></td></tr><tr><td><code>trStopOffset</code></td><td>float/body</td><td>Trailing stop offset.</td></tr><tr><td><code>userComment</code></td><td>string/body</td><td>Any useful information on the order. Available only for Care orders.</td></tr><tr><td><code>validity*</code></td><td>string/body</td><td>Validity of the order (<code>DAY</code>, <code>GTC</code>, <code>FOK</code>, <code>GTD</code>, <code>IOC</code>).</td></tr><tr><td><code>overnightExecutrion</code></td><td>bool/body</td><td>If true, the order can be placed and filled during overnight trading.</td></tr></tbody></table>

**Request body example**

```json
{
  "expireDate": 1714780800000,
  "price": 1.1050,
  "qty": 1.0,
  "stopLoss": 1.1000,
  "stopLossType": "absolute",
  "stopPrice": 1.1000,
  "takeProfit": 1.1100,
  "takeProfitType": "absolute",
  "trStopOffset": 0.0050,
  "userComment": "comment",
  "validity": "DAY",
  "overnightExecution": true
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X PATCH "https://sandbox-api.traderevolution.com/traderevolution/v1/orders/3187794" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0Ym…YVMqlZvox9oBCIPTD960tJfCA2rMYNrG-oGEgxK6BAugs3VJQXaC8mNnlSXXESj49618vKtM7A8Qr0j7b72pkzNdCX8YUHM5B_tAawecFcEz7fw6GTYvLi_BdafQ1kR9acEQLNMA" -H "Content-Type: application/json" -d "{ \"expireDate\": 1714780800000, \"price\": 1.1050, \"qty\": 1.0, \"stopLoss\": 1.1000, \"stopLossType\": \"absolute\", \"stopPrice\": 1.1000, \"takeProfit\": 1.1100, \"takeProfitType\": \"absolute\", \"trStopOffset\": 0.0050, \"validity\": \"DAY\", \"overnightExecution\": true}"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
It is strongly recommended that the **same types** be used for **stopLoss** and **takeProfit** - both are either **absolute** or **offset**.
{% endhint %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful, and `error` if there was an issue. If an error occurs, the description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/modifyOrder>
{% endhint %}

## Close single position (by its ID)

<mark style="color:red;">`DELETE`</mark>`/traderevolution/v1/positions/{positionId}`

This method is used to close an existing position by its ID. To get the information on the position, please use the <mark style="color:blue;">`GET`</mark>`/accounts/{accountId}/positions` request, the ID will be included in the response. An optional parameter qty can be specified in the request body for partial closing the position.

**Path/Body**

| Name          | Type         | Description                                                                    |
| ------------- | ------------ | ------------------------------------------------------------------------------ |
| `positionId*` | integer/path | This parameter specifies the identifier of the position that should be closed. |
| `qty`         | float/body   | Request body allows one possible parameter - qty. This parameter is optional.  |

**Example of the request body**

```json
{
  "qty": 0.5
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X DELETE "https://sandbox-api.traderevolution.com/traderevolution/v1/positions/3149344" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1lMDM4LTRlNmYtOT…Q1kR9acEQLNMA" -H "Content-Type: application/json" -d "{ \"qty\": 0.5}"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the operation was successful, and `error` if there was an issue. If an error occurs, a description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/closePosition>
{% endhint %}

## Modify single position (by its ID)

<mark style="color:yellow;">`PATCH`</mark>`/traderevolution/v1/positions/{positionId}`

This method is used to modify an existing position's Stop Loss, Take Profit, or both (including the Trailing offset), the request should contain a body with the appropriate parameters in the JSON format.&#x20;

{% hint style="warning" %}
Please note that SL/TP for the existing position are real orders, so when modifying it, you can specify SL/TP in price only (not in ticks or points)! See example below.&#x20;
{% endhint %}

To get the information on the position, please use the <mark style="color:blue;">`GET`</mark>`/accounts/{accountId}/positions` request, the ID will be included in the response. The table below describes a set of parameters required for this process:

**Path/Body**

| Name          | Type         | Description                                                                                                          |
| ------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| `positionId*` | integer/path | This parameter specifies the identifier of the position parameters of which should be modified.                      |
| `body`        | object/body  | Request body with following parameters: `stopLoss`*,* `takeProfit`*,* and `trailingOffset` (see body example below). |

**Request body**

```json
{
  "stopLoss": 1.1000,  
  "takeProfit": 1.1100,
  "trailingOffset": 0.0050
}
```

**CURL**

{% code overflow="wrap" %}

```json
curl -X PATCH "https://sandbox-api.traderevolution.com/traderevolution/v1/positions/234423" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiIxYWU0YmM5NS1l…HiUlHObxhve-LXKAiOODuVnPyeUrle9IXoF-kRxDitjlx239F3PpFiItQ" -H "Content-Type: application/json" -d "{ \"stopLoss\": 1.1000, \"takeProfit\": 1.1100, \"trailingOffset\": 0.0050}"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok"
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive a status indicating the outcome of the request. The status will be `ok` if the parameters were changed successfully, and `error` if there was an issue. If an error occurs, the description of the error will be provided in the `errmsg` field.

{% hint style="success" %}
A detailed description of this method can be found here:

<https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Trading/modifySlTpOnPosition>
{% endhint %}

## Risk and fee information

<mark style="color:blue;">`GET`</mark>`/traderevolution/v1/accounts/{accountId}/riskDetails`

This method returns risk and fee information associated with placing a new order for a specific instrument on a specified account. The call triggers a margin check and returns the expected margin and commission impact.

**Query/Path**

| Name                   | Type          | Description                                                                                      |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
| `accountId*`           | integer/path  | Identifier of the account.                                                                       |
| `tradableInstrumentId` | integer/query | Specify the instrument ID here.                                                                  |
| `qty*`                 | integer/query | Quantity in lots for the order.                                                                  |
| `type*`                | string/query  | Order type with possible values: `limit`, `market`, `stop`, `stoplimit`, `trailingstop`, `care`. |
| `side*`                | string/query  | Order side: `buy`, `sell`.                                                                       |

**CURL**

{% code overflow="wrap" %}

```json
curl -X GET "https://sandbox-api.traderevolution.com/traderevolution/v1/accounts/3243563/riskDetails?tradableInstrumentId=11681&qty=1&type=market&side=sell" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mYTNlLTRmYjAtOWQyYy1kYzBhNgE3ZjZjZmEiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJpcnluYW0iLC…JsHYjPIj5PAuFXlzyiFJmw3IPkVU9vZozv5l_KVkEUpTDhfgARcghbgStPXkB1Ij81CN5b0twVV-re1bXQ"
```

{% endcode %}

**Response**

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

```json
{
  "s": "ok",
  "d": {
    "risks": {
      "balance": 130000.00,
      "availableFunds": 130000.00,
      "incomingFunds": null,
      "marginAvailable": 130000.00,
      "impactOnFunds": -195.57,
      "afterTradeFunds": 128826.33,
      "blockedForStocks": null,
      "allowShortPositions": true,
      "impactOnMargin": -97.78,
      "afterTradeMargin": 129902.21
    },
    "fees": {
      "swapBuy": null,
      "swapSell": 0.00,
      "fillPerLot": 0.28,
      "orderPerLot": null,
      "fillVolume": 195.56,
      "orderVolume": 782.24,
      "perFill": null,
      "perTransaction": null,
      "fillVolumePercentWithMinPerDay": null,
      "orderPerLotWithFixedPart": null,
      "totalFee": 978.08,
      "freeCommission": null
    }
  }
}
```

{% endtab %}
{% endtabs %}

As a result, you will receive detailed information about risks and fees associated with placing an order for the specified instrument and account. The response includes the potential impact on available funds and margin, as well as a breakdown of applicable commissions.

Standard errors can be received as well. If some value is absent (for example, the Price is not configured), the <mark style="color:red;">`null`</mark> value will be returned.

## Trading via Webhook

<mark style="color:green;">`POST`</mark>`/webhook/{apiKey}/{secretKey}`

This method is used to perform some trading actions via the Trading webhook mechanism. Read more about generating Trading webhook keys in the following article.

It allows **placing**, **modifying** and **canceling** orders via webhook requests. Webhook requests are sent by external systems to the TE server and trigger one of the actions. The action that will be performed depends on a JSON message body sent within the request.

The method uses API key authentication, where the API key and secret key are generated in the client terminal and must be included in the request URL. Make sure the external system webhook settings are configured to send requests to the correct URL with your credentials included in the path.

**Path parameters**

| Name         | Type         | Description                                     |
| ------------ | ------------ | ----------------------------------------------- |
| `apiKey*`    | string/path  | API key generated in the terminal.              |
| `secretKey*` | string/query | Secret key generated together with the API key. |

#### **Body**

Depending on the request body parameters, orders can be Placed, Modified or Canceled. Examples of all 3 are below.

**Place order**

<table><thead><tr><th width="249">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>action*</code></td><td>string/body</td><td>Action type. Must be "place".</td></tr><tr><td><code>accountName*</code></td><td>string/body</td><td>Identifier of the account for which the order is submitted.</td></tr><tr><td><code>symbol*</code></td><td>string/body</td><td>Instrument name (uppercase).</td></tr><tr><td><code>symbolType</code></td><td>string/body</td><td>Instrument type. Possible values: CRYPTO, EQUITY, EQUITY_CFD, ETF, FIXED_INCOME, FOREX, FUTURES, FUTURES_CFD, OPTIONS, SPREADBET</td></tr><tr><td><code>contractMonth</code></td><td>string/body</td><td>Final delivery date. Required for FUTURES, FUTURES_CFD, OPTIONS.</td></tr><tr><td><code>strikePrice</code></td><td>number/body</td><td>Strike price. Required for OPTIONS.</td></tr><tr><td><code>strikeType</code></td><td>string/body</td><td>Put or Call. Required for OPTIONS.</td></tr><tr><td><code>isin</code></td><td>string/body</td><td>ISIN identifier.</td></tr><tr><td><code>type*</code></td><td>string/body</td><td>Order type: Market, Stop, Limit, Stop limit, Trailing stop, Care.</td></tr><tr><td><code>price</code></td><td>float/body</td><td>Price at which the order should be placed.</td></tr><tr><td><code>stopPrice</code></td><td>float/body</td><td>Stop price for the order.</td></tr><tr><td><code>qty*</code></td><td>float/body</td><td>Quantity of the order.</td></tr><tr><td><code>side*</code></td><td>string/body</td><td>Order side: buy / sell.</td></tr><tr><td><code>cashOrderQty</code></td><td>float/body</td><td>Cash quantity of the order.</td></tr><tr><td><code>validity</code></td><td>string/body</td><td>Validity type (DAY, GTC, IOC, GTD, FOK, GTS).</td></tr><tr><td><code>expireDate</code></td><td>integer/body</td><td>Expiration timestamp in milliseconds (used with GTD).</td></tr><tr><td><code>stopLoss</code></td><td>float/body</td><td>Stop loss price.</td></tr><tr><td><code>stopLossType</code></td><td>string/body</td><td>Stop loss type (absolute, offset in ticks, tr. offset, offset in %).</td></tr><tr><td><code>takeProfit</code></td><td>float/body</td><td>Take profit price.</td></tr><tr><td><code>takeProfitType</code></td><td>string/body</td><td>Take profit type (absolute, offset in ticks, offset in %).</td></tr><tr><td><code>trStopOffset</code></td><td>float/body</td><td>Trailing stop offset.</td></tr><tr><td><code>userComment</code></td><td>string/body</td><td>Additional order comment (Care orders only).</td></tr></tbody></table>

**Request body**

```json
{
  "action": "place",
  "accountName": "demo",
  "symbol": "ABC",
  "symbolType": "CRYPTO",
  "type": "Limit",
  "qty": 5,
  "side": "buy",
  "price": 34
}
```

**Response**

```json
{
  "s": "ok",
  "d": {
    "orderId": "3188861",
    "action": "place",
    "symbol": "ABC",
    "symbolType": "CRYPTO",
    "type": "limit",
    "qty": 5,
    "side": "buy",
    "price": 34,
    "accountName": "demo"
  }
}
```

**Modify order**

<table><thead><tr><th width="249">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>action*</code></td><td>string/body</td><td>Action type. Must be "modify".</td></tr><tr><td><code>accountName*</code></td><td>string/body</td><td>Identifier of the account for which the order modification is submitted.</td></tr><tr><td><code>orderId*</code></td><td>integer/body</td><td>Identifier of the order to be modified.</td></tr><tr><td><code>price</code></td><td>float/body</td><td>New price of the order.</td></tr><tr><td><code>stopPrice</code></td><td>float/body</td><td>Updated stop price for the order.</td></tr><tr><td><code>qty</code></td><td>float/body</td><td>Updated quantity of the order.</td></tr><tr><td><code>validity</code></td><td>string/body</td><td>Validity of the order (e.g., DAY, GTC, IOC, GTD, FOK, GTS).</td></tr><tr><td><code>expireDate</code></td><td>integer/body</td><td>Expiration timestamp in milliseconds. Used only when the validity type is GTD.</td></tr><tr><td><code>stopLoss</code></td><td>float/body</td><td>Updated stop loss price.</td></tr><tr><td><code>stopLossType</code></td><td>string/body</td><td>Type of the stop loss (absolute, offset in ticks, tr. offset, offset in %).</td></tr><tr><td><code>takeProfit</code></td><td>float/body</td><td>Updated take profit price.</td></tr><tr><td><code>takeProfitType</code></td><td>string/body</td><td>Type of the take profit (absolute, offset in ticks, offset in %).</td></tr><tr><td><code>trStopOffset</code></td><td>float/body</td><td>Updated trailing stop offset.</td></tr><tr><td><code>userComment</code></td><td>string/body</td><td>Additional order comment (Care orders only).</td></tr></tbody></table>

**Request body**

```json
{
  "action": "modify",
  "accountName": "demo",
  "orderId": 3188861,
  "price": 35,
  "qty": 10
}
```

**Response**

```json
{
  "s": "ok",
  "d": {
    "orderId": "3188861"
  }
}
```

**Cancel order**

<table><thead><tr><th width="249">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>action*</code></td><td>string/body</td><td>Action type. Must be "cancel".</td></tr><tr><td><code>accountName*</code></td><td>string/body</td><td>Identifier of the account for which the order is submitted.</td></tr><tr><td><code>orderId*</code></td><td>integer/body</td><td>Identifier of the order to cancel.</td></tr></tbody></table>

**Request body**

```json
{
  "action": "cancel",
  "accountName": "demo",
  "orderId": 3188861
}
```

**Response**

```json
{
  "s": "ok",
  "d": {
    "orderId": "3188861"
  }
}
```

As a result, you will receive a status indicating the outcome of the request. The status will be ok if the operation was successful, and error if there was an issue. If an error occurs, a description of the error will be provided in the errmsg field.&#x20;
