Broker API HubMenu

cTrader ProtoOAAmendOrderReq

messageProtoOAAmendOrderReqcTrader Open APIpayloadType 2109Orders and positions

Changes a pending order: its size, its prices, its expiry or its stop loss and take profit. The definition allows it only where the access token has trade permission for the account.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Independent and unofficialhelp.ctrader.comchecked The definition file it was checked against

This is a message of the cTrader Open API, not an HTTP endpoint. It has no method and no path: it is sent over an open TCP or WebSocket connection, as Protocol Buffers or as JSON.

The message

Name
ProtoOAAmendOrderReq
Direction
Request, sent by the client
Payload type
PROTO_OA_AMEND_ORDER_REQ, number 2109. This number is what identifies the message on the wire.

Fields

NameTypeDescription
payloadTypeProtoOAPayloadTypeIdentifies the message. Its default in the definition is PROTO_OA_AMEND_ORDER_REQ, which is number 2109.
ctidTraderAccountIdrequiredint64The account the message is about, by its cTrader account id. Responses and events carry the same id, which is how a program holding several accounts on one connection tells them apart.
orderIdrequiredint64The pending order to change, by its id.
volumeint64The size. In hundredths of a unit, so 1000 means 10.00 units.
limitPricedoubleThe limit price. The definition says it can be given for a LIMIT order only.
stopPricedoubleThe stop price. The definition says it can be given for STOP and STOP_LIMIT orders only.
expirationTimestampint64When the order expires, as Unix time in milliseconds. To be set for good till date orders.
stopLossdoubleThe stop loss as an absolute price, for example 1.23456. The definition says it is not supported for market orders.
takeProfitdoubleThe take profit as an absolute price, for example 1.23456. The definition says it is not supported for market orders.
slippageInPointsint32The slippage distance for MARKET_RANGE and STOP_LIMIT orders.
relativeStopLossint64The stop loss as a distance from the entry price instead of an absolute price, in 1/100000 of a price unit. For a buy it is taken off the entry price, for a sell it is added.
relativeTakeProfitint64The take profit as a distance from the entry price instead of an absolute price, in 1/100000 of a price unit. For a buy it is added to the entry price, for a sell it is taken off.
guaranteedStopLossboolTrue makes the stop loss a guaranteed one. The definition says this is available for French Risk and Guaranteed Stop Loss accounts.
trailingStopLossboolTrue makes the stop loss a trailing one.
stopTriggerMethodProtoOAOrderTriggerMethodWhat triggers a STOP or STOP_LIMIT order, as a value of ProtoOAOrderTriggerMethod. Default: TRADE.

Sample

Written by this site from the payload type and fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.

The three outer keys, clientMsgId, payloadType and payload, are the ones Spotware's page on sending and receiving JSON gives. The sample holds the message's required and repeated fields and leaves the optional ones out. help.ctrader.comchecked

{
  "clientMsgId": "msg-1",
  "payloadType": 2109,
  "payload": {
    "ctidTraderAccountId": 12345678,
    "orderId": 123456
  }
}

Limits that apply at cTrader Open API

LimitValueScopeSource
Requests a second, not historical data50Per connection, requests that are not for historical datahelp.ctrader.comchecked
Requests a second, historical data5Per connection, historical data requests onlyhelp.ctrader.comchecked