Open API Model Messages

Open API Model Messages .proto file

ProtoOAPayloadType

OPEN API 2000 - 2999

Name Number Description
OA_AUTH_REQ 2000
OA_AUTH_RES 2001
OA_SUBSCRIBE_FOR_TRADING_EVENTS_REQ 2002
OA_SUBSCRIBE_FOR_TRADING_EVENTS_RES 2003
OA_UNSUBSCRIBE_FROM_TRADING_EVENTS_REQ 2004
OA_UNSUBSCRIBE_FROM_TRADING_EVENTS_RES 2005
OA_GET_SUBSCRIBED_ACCOUNTS_REQ 2006
OA_GET_SUBSCRIBED_ACCOUNTS_RES 2007
OA_CREATE_ORDER_REQ 2013
OA_EXECUTION_EVENT 2016
OA_CANCEL_ORDER_REQ 2017
OA_CLOSE_POSITION_REQ 2018
OA_AMEND_POSITION_SL_TP_REQ 2019
OA_AMEND_ORDER_REQ 2020
OA_SUBSCRIBE_FOR_SPOTS_REQ 2021
OA_SUBSCRIBE_FOR_SPOTS_RES 2022
OA_UNSUBSCRIBE_FROM_SPOTS_REQ 2023
OA_UNSUBSCRIBE_FROM_SPOTS_RES 2024
OA_GET_SPOT_SUBSCRIPTION_REQ 2025
OA_GET_SPOT_SUBSCRIPTION_RES 2026
OA_GET_ALL_SPOT_SUBSCRIPTIONS_REQ 2027
OA_GET_ALL_SPOT_SUBSCRIPTIONS_RES 2028
OA_SPOT_EVENT 2029
OA_PING_REQ 2030
OA_PING_RES 2031

ProtoOAOrderType

Supported order types

Name Number Description
OA_MARKET 1
OA_LIMIT 2
OA_STOP 3
OA_PROTECTION 4
OA_MARKET_RANGE 5
OA_STOP_LIMIT 6

ProtoOAExecutionType

Open Api Execution Type

Name Number Description
OA_ORDER_ACCEPTED 1
OA_ORDER_FILLED 2
OA_ORDER_CANCELLED 3
OA_ORDER_EXPIRED 4
OA_ORDER_AMENDED 5
OA_ORDER_REJECTED 6
OA_ORDER_CANCEL_REJECTED 7

ProtoOAPositionStatus

Name Number Description
OA_POSITION_STATUS_OPEN 1
OA_POSITION_STATUS_CLOSED 2
OA_POSITION_STATUS_CREATED 3
OA_POSITION_STATUS_ERROR 4

ProtoOATrendbarPeriod

Name Number Description
M1 1
M2 2
M3 3
M4 4
M5 5
M10 6
M15 7
M30 8
H1 9
H4 10
H12 11
D1 12
W1 13
MN1 14

ProtoOAPartnerDetails

Required Type Field Name Description
required string partnerName

ProtoOAOrder

Represents an information about an order from execution event received from server

Required Type Field Name Description
required int64 orderId trading API does NOT guarantee the uniqueness of this field. It is unique only within one account (accountId)
required int64 accountId
required ProtoOAOrderType orderType
required ProtoTradeSide tradeSide
required string symbolName
required bool closingOrder
required int64 requestedVolume in cents
optional int64 executedVolume in cents
optional double executionPrice
optional double limitPrice
optional double stopPrice
optional double stopLossPrice
optional double takeProfitPrice
optional double baseSlippagePrice
optional int64 slippageInPips
optional int32 relativeStopLossInPips
optional int32 relativeTakeProfitInPips
optional int64 commission
optional int64 openTimestamp
optional int64 closeTimestamp
optional int64 expirationTimestamp
optional string channel
optional string comment
optional ProtoOAClosePositionDetails closePositionDetails
optional string clientOrderId
optional bool stopOut
optional int32 slippageInPoints

ProtoOAPosition

Represents an information about a position from execution event received from server

Required Type Field Name Description
required int64 positionId trading API does NOT guarantee the uniqueness of this field. It is unique only within one account (accountId)
required int64 accountId
required ProtoOAPositionStatus positionStatus
required ProtoTradeSide tradeSide
required string symbolName
required int64 volume
required double entryPrice
optional int64 swap
optional int64 commission
required int64 openTimestamp
optional int64 closeTimestamp
optional double stopLossPrice
optional double takeProfitPrice
optional string channel
optional string comment

ProtoOAClosePositionDetails

Represents additional details for the position which has been closed

Required Type Field Name Description
required double entryPrice
required int64 profit in cents
required int64 swap in cents
required int64 commission in cents
required int64 balance in cents
optional string comment
optional double stopLossPrice
optional double takeProfitPrice
optional double quoteToDepositConversionRate
required int64 closedVolume
optional bool closedByStopOut use stopOut field from ProtoOAOrder

ProtoOASpotSubscription

Required Type Field Name Description
required int64 accountId
required uint32 subscriptionId
repeated string symbolNames use subscribedSymbols below
repeated ProtoOASubscribedSpotSymbol subscribedSymbols

ProtoOASubscribedSpotSymbol

Required Type Field Name Description
required string symbolName
repeated ProtoOATrendbarPeriod period

ProtoOATrendbar

Required Type Field Name Description
optional double open
optional double close
optional double high
optional double low
required int64 volume
optional int64 utcTimestamp
optional ProtoOATrendbarPeriod period default for handle .Net protobuf generator bug

Scalar Value Types

.proto Type Notes C++ Type Java Type Python Type
double double double float
float float float float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long
uint32 Uses variable-length encoding. uint32 int int/long
uint64 Uses variable-length encoding. uint64 long int/long
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long
sfixed32 Always four bytes. int32 int int
sfixed64 Always eight bytes. int64 long int/long
bool bool boolean boolean
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode
bytes May contain any arbitrary sequence of bytes. string ByteString str