cTrader ProtoOAOrderErrorEvent
Sent when an order request meets an error. It names the error and, where they apply, the order and the position.
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.
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
- ProtoOAOrderErrorEvent
- Direction
- Event, sent by the server
- Payload type
- PROTO_OA_ORDER_ERROR_EVENT, number 2132. This number is what identifies the message on the wire.
Fields
| Name | Type | Description |
|---|---|---|
| payloadType | ProtoOAPayloadType | Identifies the message. Its default in the definition is PROTO_OA_ORDER_ERROR_EVENT, which is number 2132. |
| ctidTraderAccountIdrequired | int64 | The 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. |
| errorCoderequired | string | The name of the error, taken from the ProtoErrorCode enumeration or from another error code enumeration. |
| orderId | int64 | The order, by its id. |
| positionId | int64 | The position, by its id. |
| description | string | The error described in words. |
Return codes documented for this message
The definition says the errorCode field of this event holds the name of a ProtoErrorCode or of another error code enumeration. The cTrader error codes recorded here, read from those enumerations, are below. help.ctrader.comchecked
- OA_AUTH_TOKEN_EXPIRED (1)The access token has expired.
- UNKNOWN_ERROR (1)A generic error.
- ACCOUNT_NOT_AUTHORIZED (2)The trading account has not been authorised on this connection.
- UNSUPPORTED_MESSAGE (2)The message type is not supported.
- INVALID_REQUEST (3)Input values are wrong.
- TIMEOUT_ERROR (5)Execution timed out.
- ENTITY_NOT_FOUND (6)The id does not exist.
- CANT_ROUTE_REQUEST (7)Connection to the server is lost.
- FRAME_TOO_LONG (8)Message is too large.
- MARKET_CLOSED (9)Market is closed.
- CONCURRENT_MODIFICATION (10)The order is busy, for example still being executed, so the change was not applied.
- BLOCKED_PAYLOAD_TYPE (11)Blocked or rate limited.
- RET_NO_SUCH_LOGIN (12)The trading account no longer exists.
- ALREADY_LOGGED_IN (14)Account already authorised on this connection.
- INCORRECT_BOUNDARIES (35)The from and to period is too long or invalid.
- RET_ACCOUNT_DISABLED (64)The trading account is disabled.
- CONNECTIONS_LIMIT_EXCEEDED (67)Your app has too many open connections.
- WORSE_GSL_NOT_ALLOWED (68)The request would increase the risk on a position that has a guaranteed stop loss, which is not allowed.
- SYMBOL_HAS_HOLIDAY (69)Trading is disabled for the symbol because of a holiday in its schedule.
- CH_CLIENT_AUTH_FAILURE (101)App credentials wrong or app not activated.
- CH_CLIENT_NOT_AUTHENTICATED (102)Command sent before app authorisation.
- CH_CLIENT_ALREADY_AUTHENTICATED (103)App authorised twice.
- CH_ACCESS_TOKEN_INVALID (104)Access token invalid.
- CH_SERVER_NOT_REACHABLE (105)The trading service is unavailable.
- CH_CTID_TRADER_ACCOUNT_NOT_FOUND (106)ctidTraderAccountId not found.
- CH_OA_CLIENT_NOT_FOUND (107)The client ID is not recognised.
- REQUEST_FREQUENCY_EXCEEDED (108)Request rate limit exceeded (page gives the name with no longer description).
- SERVER_IS_UNDER_MAINTENANCE (109)The server is in maintenance.
- CHANNEL_IS_BLOCKED (110)Operations are blocked for this account.
- NOT_SUBSCRIBED_TO_SPOTS (112)A subscription to depth, trendbars or similar was requested for a symbol that has no spot subscription.
- ALREADY_SUBSCRIBED (113)You asked for a subscription that is already active.
- SYMBOL_NOT_FOUND (114)The symbol does not exist for this account.
- UNKNOWN_SYMBOL (115)The file gives this code no description of its own, only a note that it is to be merged with SYMBOL_NOT_FOUND (114).
- NO_QUOTES (117)Trading cannot be done because no quotes are available.
- NOT_ENOUGH_MONEY (118)Insufficient margin.
- MAX_EXPOSURE_REACHED (119)The maximum exposure for this trader, symbol and side is reached.
- POSITION_NOT_FOUND (120)Position id does not exist.
- ORDER_NOT_FOUND (121)The order does not exist.
- POSITION_NOT_OPEN (122)A request tried to close a position that is not open.
- POSITION_LOCKED (123)The position is in a state that does not allow the operation to be performed.
- TOO_MANY_POSITIONS (124)The account has hit its limit of open positions and orders.
- TRADING_BAD_VOLUME (125)Volume invalid (cTrader volume is in cents of units).
- TRADING_BAD_STOPS (126)Stop price invalid.
- TRADING_BAD_PRICES (127)The price is invalid.
- TRADING_BAD_STAKE (128)The stake volume is invalid, for example negative.
- PROTECTION_IS_TOO_CLOSE_TO_MARKET (129)Stop loss or take profit is invalid or too close to the market.
- TRADING_BAD_EXPIRATION_DATE (130)The expiration given for the order is invalid.
- PENDING_EXECUTION (131)The change cannot be applied because the position has an order under execution.
- TRADING_DISABLED (132)Symbol not tradable.
- TRADING_NOT_ALLOWED (133)The account is read only for your app.
- UNABLE_TO_CANCEL_ORDER (134)The order could not be cancelled.
- UNABLE_TO_AMEND_ORDER (135)The order could not be amended.
- SHORT_SELLING_NOT_ALLOWED (136)Short selling is not allowed for this symbol or account.
Limits that apply at cTrader Open API
| Limit | Value | Scope | Source |
|---|---|---|---|
| Requests a second, not historical data | 50 | Per connection, requests that are not for historical data | help.ctrader.comchecked |
| Requests a second, historical data | 5 | Per connection, historical data requests only | help.ctrader.comchecked |