Skip to main content

Modify an Order

API URL: POST https://api.topstepx.com/api/Order/modify

API Reference: /api/Order/modify

Description​


Modify an open order.

Parameters​


NameTypeDescriptionRequiredNullable
accountIdintegerThe account ID.Requiredfalse
orderIdintegerThe order id.Requiredfalse
sizeintegerThe size of the order.Optionaltrue
limitPricedecimalThe limit price for the order, if applicable.Optionaltrue
stopPricedecimalThe stop price for the order, if applicable.Optionaltrue
trailPricedecimalTrailingStop orders only. The new absolute price level for the trailing stop, not a distance. See trailPrice.Optionaltrue

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 -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": true,
"errorCode": 0,
"errorMessage": null
}