Modify an Order
API URL: POST https://api.topstepx.com/api/Order/modify
API Reference: /api/Order/modify
Description
Modify an open order.
Parameters
| Name | Type | Description | Required | Nullable |
|---|---|---|---|---|
| accountId | integer | The account ID. | Required | false |
| orderId | integer | The order id. | Required | false |
| size | integer | The size of the order. | Optional | true |
| limitPrice | decimal | The limit price for the order, if applicable. | Optional | true |
| stopPrice | decimal | The stop price for the order, if applicable. | Optional | true |
| trailPrice | decimal | TrailingStop orders only. The new absolute price level for the trailing stop, not a distance. See trailPrice. | Optional | true |
trailPrice (TrailingStop orders)
trailPrice follows the same rules as on Place an Order. It is an absolute price level, not a distance. The server measures the gap between the contract's last traded price at the time of the modify request and trailPrice, converts it to a whole number of ticks, and the stop trails the market by that many ticks from then on.
For example, on a contract with a 0.01 tick size last traded at 70.50, sending trailPrice 70.44 sets a 6-tick trail. Sending 0.06 is read as a price level near zero and sets a trail distance of 7044 ticks. Unlike Place an Order, a modify has no maximum-distance check, so this mistake is accepted rather than rejected. Double-check the value before sending.
A trailPrice that is not aligned to the contract's tick size, or a contract with no last traded price, is rejected with errorCode 3 (Rejected). The errorMessage values are the same as on Place an Order.
Example Usage
Example Request
- cURL Request
curl -X 'POST' \
'https://api.topstepx.com/api/Order/modify' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"accountId": 465,
"orderId": 26974,
"size": 1,
"limitPrice": null,
"stopPrice": 1604,
"trailPrice": null
}'
Example Response
- Success
- Error
{
"success": true,
"errorCode": 0,
"errorMessage": null
}
Error: response status is 401