Skip to main content

PUT Change Order

Change an existing order by ID NT8

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.

Endpoint

PUT /v1/api/accounts/{account}/orders/{orderId}/change

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Path parameters

NameTypeRequiredDescription
accountstringRequiredName of account in NT8
orderIdstringRequiredID of the order to by replaced

Body parameters

NameTypeRequiredDescription
quantityintOptionalContract quantity of new order
limitPricefloatOptionalLimit price when changing limit order type
stopPricefloatOptionalStop price when changing stop order type
strategyIdstringOptionalATM strategy ID, forces matching of both order ID and strategy ID

Code examples

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}")

Response

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

Platform nuances

  • Only nonterminal orders can be changed. A terminal order returns an error.
  • limitPrice is applied only to limit and stop-limit orders. stopPrice is applied only to stop-market and stop-limit orders. A new quantity is applied only when it is greater than zero.
  • When strategyId is provided, the add-on first limits the lookup to orders owned by that strategy.

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.

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