Saltar a contenido

Advertencia

This feature is in pre-release and currently under testing. Documentation is for reference only.

Public server message

ProtoCancelOrderReq

Request to cancel existing pending order.

Expect ProtoExecutionEvent{executionType = ORDER_CANCELLED} event in case of success, or ProtoOrderErrorEvent in case validation failed

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
orderId int64 Required order Id to be cancelled
originalClientOrderId string Optional The client-assigned order ID of the order being cancelled, used for order tracking in client systems
clientOrderId string Optional A new client-assigned ID for this cancellation request, used for tracking the cancellation operation

ProtoClosePositionReq

Request to close existing open position by positionId.

Expect ProtoExecutionEvent{executionType = ORDER_ACCEPTED} in case of success, or ProtoOrderErrorEvent in case validation failed.

This request ensures that position will have 0 volume.

Note that it can still be in status "CREATED" if there are pending orders with same positionId

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
positionId int64 Required Position Id to be closed fully or partially
volume int64 Required Volume to be closed, specified in "cents" (*100). Position could be closed partially
channel string Optional Client-specified channel for reporting purposes
stake int64 Optional Trading size, instead of volume, for accounts with ProtoAccountType = SPREAD_BETTING. Value 1 is always 0.01
desiredVWAP double Optional price value to calculate slippage on execution. Specified by the client as Market VWAP for the desired volume at the moment of generation of request
closeWithPID int64 Optional Position ID that will be displayed in the UI as the opposing position used to close this position, used for visual grouping in the interface

ProtoCreateNewOrderReq

A request to submit a new order: on success, ProtoExecutionEvent with executionType = ORDER_ACCEPTED will be returned; if validation fails, ProtoOrderErrorEvent will be received.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId int64 Required Desired SymbolID to trade
orderType ProtoOrderType Required MARKET, LIMIT, STOP, MARKET_RANGE, STOP_LIMIT
tradeSide ProtoTradeSide Required BUY, SELL
volume int64 Required Trade Volume, specified in "cents" (*100)
limitPrice double Optional Price of the order. Valid for orderType = Limit
stopPrice double Optional Price of the order. Valid for orderType = STOP and STOP_LIMIT
timeInForce ProtoTimeInForce Optional only MARKET_ON_OPEN could be specified here for orderType = MARKET. Otherwise server will set TIF according to internal logics
expirationTimestamp int64 Optional UNIX expiration time for LIMIT, STOP and STOP_LIMIT orders. Server will set ProtoTimeInForce = GOOD_TILL_DATE in this case
stopLoss double Optional absolute stop loss price (1.23456 for example). Excludes takeProfitInPips field. Unsupported for MARKET and MARKET_RANGE orders
takeProfit double Optional absolute take profit price (1.23456 for example). Excludes takeProfitInPips field. Unsupported for MARKET orders
comment string Optional User-specified comment
method string Optional quickTrade button, Order screen, Chart trading, etc.
baseSlippagePrice double Optional Base price to calculate relative slippage price
label string Optional User-specified label
channel string Optional Client-specified channel for reporting purposes
positionId int64 Optional Position Id in case trade must be done into specific existing open position
clientOrderId string Optional Optional User-specific clientOrderId (similar to FIX ClOrderID). MaxLength = 50 chars
relativeStopLoss int64 Optional distance between position open price and desired Stop Loss. Value 1 is always 0.00001 of price
relativeTakeProfit int64 Optional distance between position open price and desired Take Profit. value 1 is always 0.00001 of price
stake int64 Optional trading unt instead of volume for accounts with ProtoAccountType = SPREAD_BETTING. Value 1 is always 0.01
desiredVWAP double Optional price value to calculate slippage on execution. Specified by the client as Market VWAP for the desired volume at the moment of generation of request
guaranteedStopLoss bool Optional If TRUE then stopLoss is guaranteed. Required to be set to TRUE for the Limited Risk accounts (ProtoTrader.isLimitedRisk = true).
checkTolerance bool Optional defines if server should perform check against ProtoProtectionProfile.tolerance.
trailingStopLoss bool Optional defines if specified Stop Loss is trailing.
stopTriggerMethod ProtoOrderTriggerMethod Optional Trigger method for main pending order
stopLossTriggerMethod ProtoOrderTriggerMethod Optional Stop trigger method for SL/TP order
slippageInPoints int32 Optional max allowed slippage for MARKET_RANGE and STOP_LIMIT orders. Value 1 is 1/10^digits of the Symbol. For EURJPY it will be 0.001, for EURUSD 0.00001
desiredOpenTimestamp int64 Optional timestamp of the desired session start to execute Market Order. Must be equal to time, related to ProtoInterval with isGlobalSessionStart = true.

ProtoErrorRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly

ProtoExecutionEvent

Event that is sent following the successful Order acceptance or execution.

Acts as response to the ProtoNewOrderReq, ProtoCancelOrderReq, ProtoAmendOrderReq, ProtoAmendPositionSLTPReq, ProtoClosePositionReq.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
executionType ProtoExecutionType Required Type of the happened event
position ProtoPosition Optional Reference to the Position linked with the execution
order ProtoOrder Optional Reference to the Order linked with the execution
errorCode string Optional The name of the ProtoErrorCode or the other custom ErrorCodes in case of unsuccessful operation
depositWithdraw ProtoDepositWithdraw Optional Reference to the Deposit or Withdrawal operation linked with the execution
deal ProtoDeal Optional Reference to the Deal linked with the execution
eventId uint64 Optional ID of the execution event
bonusDepositWithdraw ProtoBonusDepositWithdraw Optional Reference to the Bonus Deposit or Bonus Withdrawal operation linked with the execution
isServerEvent bool Optional If TRUE then the event generated by the cServer logic instead of the Trader's request. (e.g. Stop Out)
depositToUsdRate double Optional Conversion rate from the deposit currency to USD
notifyBigVolume bool Optional Returned as TRUE if executed volume is big enough as per Trade Notification Profile
usedMargin int64 Optional used margin of account

ProtoGetAccountGroupInformationReq

Request to retrieve comprehensive group settings (trading parameters, margin requirements, fees, commissions, bonus conversion rates, stop-out levels, inactivity fees, permission flags, and regional/legal entity information) for the currently authenticated account.

Returns a ProtoGroup object containing the group’s ID, name, status, commission profiles, bonus settings, inactivity fees, and legal entity details, along with the account’s deposit currency.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly

ProtoGetAccountGroupInformationRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
group ProtoGroup Required Group's information for currently authorized account
depositCurrency string Required Name of Trader's deposit Asset
enabled bool Optional TRUE if Trader's Group is enabled

ProtoGetAccountInformationReq

Request to retrieve comprehensive information about the authenticated trading account, to obtain account details including balance, margin requirements, account status, and trading permissions.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly

ProtoGetAccountInformationRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
trader ProtoTrader Required Comprehensive trader account information including ID, balance, margin settings, and account status

ProtoGetDealListReq

Request for returning list of closing deals within timestamps

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
fromTimestamp int64 Required UNIX time in milliseconds. fromTimestamp <= deal.execution_timestamp <= toTimestamp
toTimestamp int64 Required UNIX time in milliseconds

ProtoGetDealListRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
deal RepeatedField<ProtoDeal> Repeated List of closing deals, sorted by utcLastUpdateTimestamp in descending order (newest first)
hasMore bool Required If TRUE then server has more entities for the desired period than returned and another request must be sent to get the rest

ProtoGetDynamicLeverageReq

Request to fetch the dynamic leverage configuration for a specific symbol.

You must supply the leverageId value returned in ProtoSymbol from ProtoGetSymbolReq.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
leverageId uint64 Required Unique identifier returned in ProtoSymbol by ProtoGetSymbolReq

ProtoGetDynamicLeverageRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
leverage ProtoDynamicLeverage Required The dynamic leverage configuration for the requested symbol, containing volume tiers and corresponding leverage values

ProtoGetLightSymbolListReq

Request to retrieve a list of available trading symbols with essential information.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
includeArchivedSymbols bool Optional When TRUE, response will include symbols that are no longer active but have historical data

ProtoGetLightSymbolListRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbol RepeatedField<ProtoLightSymbol> Repeated List of active trading symbols with essential parameters
archivedSymbol RepeatedField<ProtoArchivedSymbol> Repeated List of archived symbols if includeArchivedSymbols was TRUE in the request

ProtoGetSymbolReq

Request to retrieve detailed information for specific symbol by its ID (which first need to obtain via ProtoGetLightSymbolListReq).

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId RepeatedField<int64> Repeated Symbol's ID, received from ProtoLightSymbol, for which to retrieve detailed information

ProtoGetSymbolRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbol RepeatedField<ProtoSymbol> Repeated List of detailed information for active symbols requested by their IDs
archivedSymbol RepeatedField<ProtoArchivedSymbol> Repeated List of archived symbols (no longer active) if any of the requested IDs were for archived symbols

ProtoGetTrendbarListReq

Request trend bars by symbol and time period with possibility to narrow by from and to timestamps and amount of bars.

In order to receive response either fromTimestamp or toTimestamp must be specified together with count.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId int64 Required Symbol Id
period ProtoTimeframe Required Bar period. Default is set for handling .Net protobuf generator bug
fromTimestamp int64 Optional UNIX timestamp in milliseconds from which the search starts
toTimestamp int64 Optional UNIX timestamp in milliseconds where to stop the search
count int64 Optional Max amount of trend bars in response. Count starts from the most recent trend bar
type ProtoTrendbarType Optional Trend bar type can be regular of Heikin-Ashi, value from TrendbarType reference table

ProtoGetTrendbarListRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
trendbar RepeatedField<ProtoTrendbar> Repeated Time-based chart bar
type ProtoTrendbarType Optional Trend bar type. Regular or Heikin-Ashi.
hasMore bool Optional If TRUE then server has more entities for the desired period than returned and another request must be sent to get the rest

ProtoModifyOrderProtectionReq

Request for changing SL/TP for existing position by positionId, expect ProtoExecutionEvent, executionType = ORDER_REPLACED event in case of success, or ProtoOrderErrorEvent in case validation failed, or ProtoExecutionEvent with executionType = ORDER_CANCELLED in case of removing all protections

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
positionId int64 Required Position Id to amend protections
stopLoss double Optional Absolute stop loss price (1.23456 for example). Send empty to remove SL. In case all protections are removed, expect ORDER_CANCELLED event
takeProfit double Optional Absolute take profit price (1.26543 for example). Send empty to remove TP. In case all protections are removed, expect ORDER_CANCELLED event
channel string Optional Client-specified channel for reporting purposes
guaranteedStopLoss bool Optional If TRUE then stopLoss is guaranteed. Required to be set to TRUE for the Limited Risk accounts (ProtoTrader.isLimitedRisk = true).
trailingStopLoss bool Optional Defines if specified Stop Loss is trailing.
stopLossTriggerMethod ProtoOrderTriggerMethod Optional Stop trigger method for SL/TP order

ProtoModifyOrderReq

Request to change existing pending order by orderId: on success, ProtoExecutionEvent with executionType = ORDER_REPLACED, or ProtoOrderErrorEvent in case validation failed

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
orderId int64 Required Unique identifier of the existing order to be modified
limitPrice double Optional Price of the order. Valid for orderType = Limit
stopPrice double Optional Price of the order. Valid for orderType = STOP and STOP_LIMIT
expirationTimestamp int64 Optional UNIX expiration time for LIMIT, STOP and STOP_LIMIT orders. Server will set ProtoTimeInForce = GOOD_TILL_DATE in this case
stopLoss double Optional absolute stop loss price (1.23456 for example). Excludes takeProfitInPips field. Unsupported for MARKET orders
takeProfit double Optional absolute take profit price (1.23456 for example). Excludes takeProfitInPips field. Unsupported for MARKET orders
channel string Optional Client-specified channel for reporting purposes
relativeStopLoss int64 Optional distance between position open price and desired Stop Loss. Value 1 is always 0.00001 of price
relativeTakeProfit int64 Optional distance between position open price and desired Take Profit. value 1 is always 0.00001 of price
volume int64 Optional Trade Volume, specified in "cents" (*100)
guaranteedStopLoss bool Optional If TRUE then stopLoss is guaranteed. Required to be set to TRUE for the Limited Risk accounts (ProtoTrader.isLimitedRisk = true).
stake int64 Optional Trading size, instead of volume, for accounts with ProtoAccountType = SPREAD_BETTING. Value 1 is always 0.01
trailingStopLoss bool Optional Defines if specified Stop Loss is trailing.
stopTriggerMethod ProtoOrderTriggerMethod Optional Trigger method for main pending order
stopLossTriggerMethod ProtoOrderTriggerMethod Optional Stop trigger method for SL/TP order
slippageInPoints int32 Optional Max allowed slippage for MARKET_RANGE and STOP_LIMIT orders. Value 1 is 1/10^digits of the Symbol. For EURJPY it will be 0.001, for EURUSD 0.00001
desiredOpenTimestamp int64 Optional Timestamp of the desired session start to execute Market Order. Must be equal to time, related to ProtoInterval with isGlobalSessionStart = true

ProtoOrderErrorRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
errorCode string Required Standardized error code identifying the specific error that occurred during order processing
orderId int32 Optional The unique identifier of the order associated with this error, if applicable
traderId int32 Optional The unique identifier of the trader whose action triggered this error
positionId int32 Optional The unique identifier of the position associated with this error, if applicable
description string Optional Explanation of the error, providing additional details about the problem

ProtoPublicServerPayloadType

Name Value Description
QUOTE_EVENT 3
ERROR_RES 50
TRENDBAR_REQ 113
TRENDBAR_RES 114
GET_ACCOUNT_INFORMATION_RES 124
GET_ACCOUNT_GROUP_INFORMATION_RES 125
ORDER_ERROR_RES 138
CREATE_NEW_ORDER_REQ 143
CANCEL_ORDER_REQ 144
MODIFY_ORDER_REQ 145
CLOSE_POSITION_REQ 146
MODIFY_ORDER_PROTECTION_REQ 147
GET_SYMBOL_REQ 163
GET_SYMBOL_RES 164
GET_ACCOUNT_INFORMATION_REQ 175
GET_ACCOUNT_GROUP_INFORMATION_REQ 176
EXECUTION_EVENT 300
GET_DEAL_LIST_REQ 477
GET_DEAL_LIST_RES 478
SUBSCRIBE_QUOTES_REQ 601
SUBSCRIBE_QUOTES_RES 602
UNSUBSCRIBE_QUOTES_REQ 608
UNSUBSCRIBE_QUOTES_RES 609
GET_LIGHT_SYMBOL_LIST_REQ 841
GET_LIGHT_SYMBOL_LIST_RES 842
GET_DYNAMIC_LEVERAGE_REQ 858
GET_DYNAMIC_LEVERAGE_RES 859

ProtoQuoteEvent

Event containing real-time price updates for a subscribed symbol.

These events are sent automatically to clients who have established a subscription using ProtoSubscribeQuotesReq.

The first event after subscription contains the latest available prices, even if the market is currently closed.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId int64 Required Symbol ID
bid uint64 Optional Current bid (sell) price in 1/100,000 format (e.g., 1.23 is represented as 123000)
ask uint64 Optional Current ask (buy) price in 1/100,000 format (e.g., 1.23 is represented as 123000)
high uint64 Optional Highest price in current trading session in 1/100,000 format
low uint64 Optional Lowest price in current trading session in 1/100,000 format
sessionClose uint64 Optional Last session's closing price in 1/100,000 format
trendbar RepeatedField<ProtoTrendbar> Repeated Time-based chart bars if subscribed to chart data
timestamp int64 Optional Precise UNIX timestamp in milliseconds when this price update occurred
tickbar RepeatedField<ProtoTickbar> Repeated Tick-based chart bars if subscribed to tick data
depth RepeatedField<ProtoDepthQuote> Repeated Depth of market data showing liquidity at different price levels if subscribed to DoM
hasGap bool Optional Indicates whether there was a gap in price continuity (previous update was dropped)

ProtoSubscribeQuotesReq

Request to establish a subscription for real-time price quotes for specific trading symbol by its ID (which first need to obtain via ProtoGetLightSymbolListReq).

After subscription is confirmed, the client will begin receiving ProtoQuoteEvent messages with the latest price updates.

An initial event with the current prices will be sent immediately after subscription, even if the market is closed.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId RepeatedField<int64> Repeated Symbol's ID, received from ProtoLightSymbol, for which to retrieve detailed information
enableStaleQuotesFiltering bool Optional When TRUE, enables depth of market (DoM) snapshot data in quote events
subscribeToSpotTimestamp bool Optional When TRUE, includes precise timestamp in quote events, useful for charting applications

ProtoSubscribeQuotesRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly

ProtoUnsubscribeQuotesReq

Request to cancel an existing subscription to real-time price quotes for specific symbol by its ID (which first need to obtain via ProtoGetLightSymbolListReq).

After unsubscribing, the client will stop receiving ProtoQuoteEvent messages for the specified symbols.

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly
symbolId RepeatedField<int64> Repeated The unique identifier of the Symbol in specific server environment within cTrader platform.

ProtoUnsubscribeQuotesRes

Field Type Label Description
payloadType ProtoPublicServerPayloadType Optional Code included in each message that tells cTrader and WebView plugins which specific request, response, or event is being sent so it can be routed and processed correctly