# PUT Change Order

One or all of the following fields in an order can be modified: limit price, stop price, and quantity. You can optionally set a specific strategy ID to ensure the order and strategy match.

## Change an existing order by ID

<mark style="color:blue;">`PUT`</mark> `/v1/api/accounts/{account}/orders/{orderId}/change`

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Path Parameters**

<table><thead><tr><th width="168">Name</th><th width="100">Type</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>account</code></td><td>string</td><td><mark style="color:red;">Required</mark></td><td>Name of account in NT8</td></tr></tbody></table>

**Query Parameters**

<table><thead><tr><th width="168">Name</th><th width="100">Type</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>orderId</code></td><td>string</td><td><mark style="color:red;">Required</mark></td><td>ID of the order to by replaced</td></tr></tbody></table>

**Body**

<table><thead><tr><th width="167">Name</th><th width="101">Type</th><th width="104">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>quantity</code></td><td>integer</td><td>Optional</td><td>Contract quantity of new order</td></tr><tr><td><code>limitPrice</code></td><td>float</td><td>Optional</td><td>Limit price when changing limit order type</td></tr><tr><td><code>stopPrice</code></td><td>float</td><td>Optional</td><td>Stop price when changing stop order type</td></tr><tr><td><code>strategyId</code></td><td>string</td><td>Optional</td><td>ATM strategy ID, forces matching of both order ID and strategy ID</td></tr></tbody></table>

**Code Examples**

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

```python
import requests

token = 'my-secret-token'

url = "https://app.crosstrade.io/v1/api/accounts/Sim101/orders/64e8164f337c4bcfb2abc3468ff5fa20/change"
headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}
data = {
    "quantity": 2,
    # "limitPrice": 6000
    # "stopPrice": 0,
    # "strategyId": "MyAtmStrategy"
}

try:
    response = requests.put(url, headers=headers, json=data)
    print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
    print(f"An error occurred: {e}")
```

{% endtab %}
{% endtabs %}

***

**Response**

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

```json
{
    "orderId": "36f59a2f4594436084484b92350ca25a",
    "success": true
}
```

{% endtab %}

{% tab title="400" %}

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

{% endtab %}
{% endtabs %}

#### WebSocket API

This request can also be made over the WebSocket API. The `account` and `orderId` path parameters and request body fields are all passed inside `args`.

```json
{
  "action": "rpc",
  "id": "my-request-id",
  "api": "Change",
  "args": {
    "account": "Sim101",
    "orderId": "492281fc515e431692da57d957cfebb6",
    "quantity": 2,
    "limitPrice": 5400.00
  }
}
```
