forked from spotware/ctrader-open-api-v2-java-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApiModelMessages.proto
More file actions
532 lines (485 loc) · 28.9 KB
/
Copy pathOpenApiModelMessages.proto
File metadata and controls
532 lines (485 loc) · 28.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option java_package = "com.xtrader.protocol.openapi.v2.model";
option java_outer_classname = "ContainerOpenApiV2ModelMessages";
enum ProtoOAPayloadType {
PROTO_OA_APPLICATION_AUTH_REQ = 2100;
PROTO_OA_APPLICATION_AUTH_RES = 2101;
PROTO_OA_ACCOUNT_AUTH_REQ = 2102;
PROTO_OA_ACCOUNT_AUTH_RES = 2103;
PROTO_OA_VERSION_REQ = 2104;
PROTO_OA_VERSION_RES = 2105;
PROTO_OA_NEW_ORDER_REQ = 2106;
PROTO_OA_TRAILING_SL_CHANGED_EVENT = 2107;
PROTO_OA_CANCEL_ORDER_REQ = 2108;
PROTO_OA_AMEND_ORDER_REQ = 2109;
PROTO_OA_AMEND_POSITION_SLTP_REQ = 2110;
PROTO_OA_CLOSE_POSITION_REQ = 2111;
PROTO_OA_ASSET_LIST_REQ = 2112;
PROTO_OA_ASSET_LIST_RES = 2113;
PROTO_OA_SYMBOLS_LIST_REQ = 2114;
PROTO_OA_SYMBOLS_LIST_RES = 2115;
PROTO_OA_SYMBOL_BY_ID_REQ = 2116;
PROTO_OA_SYMBOL_BY_ID_RES = 2117;
PROTO_OA_SYMBOLS_FOR_CONVERSION_REQ = 2118;
PROTO_OA_SYMBOLS_FOR_CONVERSION_RES = 2119;
PROTO_OA_SYMBOL_CHANGED_EVENT = 2120;
PROTO_OA_TRADER_REQ = 2121;
PROTO_OA_TRADER_RES = 2122;
PROTO_OA_TRADER_UPDATE_EVENT = 2123;
PROTO_OA_RECONCILE_REQ = 2124;
PROTO_OA_RECONCILE_RES = 2125;
PROTO_OA_EXECUTION_EVENT = 2126;
PROTO_OA_SUBSCRIBE_SPOTS_REQ = 2127;
PROTO_OA_SUBSCRIBE_SPOTS_RES = 2128;
PROTO_OA_UNSUBSCRIBE_SPOTS_REQ = 2129;
PROTO_OA_UNSUBSCRIBE_SPOTS_RES = 2130;
PROTO_OA_SPOT_EVENT = 2131;
PROTO_OA_ORDER_ERROR_EVENT = 2132;
PROTO_OA_DEAL_LIST_REQ = 2133;
PROTO_OA_DEAL_LIST_RES = 2134;
PROTO_OA_SUBSCRIBE_LIVE_TRENDBAR_REQ = 2135;
PROTO_OA_UNSUBSCRIBE_LIVE_TRENDBAR_REQ = 2136;
PROTO_OA_GET_TRENDBARS_REQ = 2137;
PROTO_OA_GET_TRENDBARS_RES = 2138;
PROTO_OA_EXPECTED_MARGIN_REQ = 2139;
PROTO_OA_EXPECTED_MARGIN_RES = 2140;
PROTO_OA_MARGIN_CHANGED_EVENT = 2141;
PROTO_OA_ERROR_RES = 2142;
PROTO_OA_CASH_FLOW_HISTORY_LIST_REQ = 2143;
PROTO_OA_CASH_FLOW_HISTORY_LIST_RES = 2144;
PROTO_OA_GET_TICKDATA_REQ = 2145;
PROTO_OA_GET_TICKDATA_RES = 2146;
PROTO_OA_ACCOUNTS_TOKEN_INVALIDATED_EVENT = 2147;
PROTO_OA_CLIENT_DISCONNECT_EVENT = 2148;
PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ = 2149;
PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_RES = 2150;
PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_REQ = 2151;
PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_RES = 2152;
PROTO_OA_ASSET_CLASS_LIST_REQ = 2153;
PROTO_OA_ASSET_CLASS_LIST_RES = 2154;
PROTO_OA_DEPTH_EVENT = 2155;
PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_REQ = 2156;
PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_RES = 2157;
PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_REQ = 2158;
PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_RES = 2159;
PROTO_OA_SYMBOL_CATEGORY_REQ = 2160;
PROTO_OA_SYMBOL_CATEGORY_RES = 2161;
PROTO_OA_ACCOUNT_LOGOUT_REQ = 2162;
PROTO_OA_ACCOUNT_LOGOUT_RES = 2163;
PROTO_OA_ACCOUNT_DISCONNECT_EVENT = 2164;
}
/** Asset entity. */
message ProtoOAAsset {
required int64 assetId = 1; // The unique asset ID.
required string name = 2; // The asset name.
optional string displayName = 3; // User friendly name.
}
/** Trading symbol entity. */
message ProtoOASymbol {
required int64 symbolId = 1; // The unique identifier of the symbol in specific server environment within cTrader platform. Different servers have different IDs.
required int32 digits = 2; // Number of price digits to be displayed.
required int32 pipPosition = 3; // Pip position on digits.
optional bool enableShortSelling = 4; // If TRUE then the short selling with the symbol is enabled.
optional bool guaranteedStopLoss = 5; // If TRUE then setting of guaranteedStopLoss is available for limited risk accounts.
optional ProtoOADayOfWeek swapRollover3Days = 6 [default = MONDAY]; // Day of the week when SWAP charge amount will be tripled. Doesn't impact Rollover Commission.
optional double swapLong = 7; // SWAP charge for long positions.
optional double swapShort = 8; // SWAP charge for short positions.
optional int64 maxVolume = 9; // Maximum allowed volume in cents for an order with a symbol.
optional int64 minVolume = 10; // Minimum allowed volume in cents for an order with a symbol.
optional int64 stepVolume = 11; // Step of the volume in cents for an order.
optional uint64 maxExposure = 12; // Value of max exposure per symbol, per account. Blocks execution if breached.
repeated ProtoOAInterval schedule = 13; // Symbol trading interval, specified in seconds starting from SUNDAY 00:00 in specified time zone.
required int64 commission = 14; // Commission base amount. Total commission depends on commissionType.
optional ProtoOACommissionType commissionType = 15 [default = USD_PER_MIL_USD]; // Commission type. See ProtoOACommissionType for details.
optional uint32 slDistance = 16; // Minimum allowed distance between stop loss and current market price.
optional uint32 tpDistance = 17; // Minimum allowed distance between take profit and current market price.
optional uint32 gslDistance = 18; // Minimum allowed distance between guaranteed stop loss and current market price.
optional int64 gslCharge = 19; // Guaranteed stop loss fee.
optional ProtoOASymbolDistanceType distanceSetIn = 20 [default = SYMBOL_DISTANCE_IN_POINTS]; // Unit of distance measure for slDistance, tpDistance, gslDistance.
optional int64 minCommission = 21; // Minimum commission amount per trade.
optional ProtoOAMinCommissionType minCommissionType = 22 [default = CURRENCY]; // Minimum commission Type. See ProtoOAMinCommissionType for details.
optional string minCommissionAsset = 23 [default = "USD"]; // Currency for minimum commission. (USD or quote currency).
optional int64 rolloverCommission = 24; // Amount of commission per trade for Shariah Compliant accounts in deposit currency (swapFree = TRUE).
optional int32 skipRolloverDays = 25; // Initial period before the first rolloverCommission will be charged on the account.
optional string scheduleTimeZone = 26; // Time zone for the symbol trading intervals.
optional ProtoOATradingMode tradingMode = 27 [default = ENABLED]; // Rules for trading with the symbol. See ProtoOATradingMode for details.
optional ProtoOADayOfWeek rolloverCommission3Days = 28 [default = MONDAY]; //Day of the week (in UTC) when Administrative Fee charge amount will be tripled. Applied only if RolloverChargePeriod = 0 or 1
}
/** Lightweight symbol entity. */
message ProtoOALightSymbol {
required int64 symbolId = 1; // The unique identifier of the symbol in specific server environment within cTrader platform. Different brokers might have different IDs.
optional string symbolName = 2; // Name of the symbol (e.g. EUR/USD).
optional bool enabled = 3; // If TRUE then symbol is visible for traders.
optional int64 baseAssetId = 4; // Base asset.
optional int64 quoteAssetId = 5; // Quote asset.
optional int64 symbolCategoryId = 6; // Id of the symbol category used for symbols grouping.
optional string description = 7;
}
/** Symbol category entity. */
message ProtoOASymbolCategory {
required int64 id = 1; // The unique identifier of the symbol category.
required int64 assetClassId = 2; // Link to the asset class. One asset class can have many symbol categories.
required string name = 3; // Category name.
}
enum ProtoOADayOfWeek {
NONE = 0;
MONDAY = 1;
TUESDAY = 2;
WEDNESDAY = 3;
THURSDAY = 4;
FRIDAY = 5;
SATURDAY = 6;
SUNDAY = 7;
}
/** Symbol trading session entity. */
message ProtoOAInterval {
required uint32 startSecond = 3; // Interval start, specified in seconds starting from SUNDAY 00:00 in specified time zone (inclusive to the interval).
required uint32 endSecond = 4; // Interval end, specified in seconds starting from SUNDAY 00:00 in specified time zone (exclusive from the interval).
}
/** Enum for specifying type of trading commission. */
enum ProtoOACommissionType {
USD_PER_MIL_USD = 1; // USD per million USD volume - usually used for FX. Example: 50 USD for 1 mil USD of trading volume. In cents.
USD_PER_LOT = 2; // USD per 1 lot - usually used for CFDs and futures for commodities, and indices. Example: 15 USD for 1 contract. In cents.
PERCENTAGE = 3; // Percentage of trading volume - usually used for Equities. Example: 0.005% of notional trading volume. Multiplied by 100,00.
QUOTE_CCY_PER_LOT = 4; // Quote ccy of Symbol per 1 lot - will be used for CFDs and futures for commodities, and indices. Example: 15 EUR for 1 contract of DAX. In cents.
}
/** Enum for specifying stop loss and take profit distances. */
enum ProtoOASymbolDistanceType {
SYMBOL_DISTANCE_IN_POINTS = 1;
SYMBOL_DISTANCE_IN_PERCENTAGE = 2;
}
/** Enum for specifying type of minimum trading commission. */
enum ProtoOAMinCommissionType {
CURRENCY = 1;
QUOTE_CURRENCY = 2;
}
/** Enum for specifying symbol trading mode. */
enum ProtoOATradingMode {
ENABLED = 0;
DISABLED_WITHOUT_PENDINGS_EXECUTION = 1;
DISABLED_WITH_PENDINGS_EXECUTION = 2;
CLOSE_ONLY_MODE = 3;
}
/** Enum for specifying access right for a trader. */
enum ProtoOAAccessRights {
FULL_ACCESS = 0; // Enable all trading.
CLOSE_ONLY = 1; // Only closing trading request are enabled.
NO_TRADING = 2; // View only access.
NO_LOGIN = 3; // No access.
}
/** Enum for specifying margin calculation type for an account. */
enum ProtoOATotalMarginCalculationType {
MAX = 0;
SUM = 1;
NET = 2;
}
/** Enum for specifying type of an account. */
enum ProtoOAAccountType {
HEDGED = 0; // Allows multiple positions on a trading account for a symbol.
NETTED = 1; // Only one position per symbol is allowed on a trading account.
SPREAD_BETTING = 2; // Spread betting type account.
}
/** Trading account entity. */
message ProtoOATrader {
required int64 ctidTraderAccountId = 1; // The unique Trader's Account ID used to match the responses to the Trader's Account.
required int64 balance = 2; // Current account balance in cents (e.g. If USD 100.00 then value = 10000).
optional int64 balanceVersion = 3; // Balance version used to identify the final balance. Increments each time when the trader's account balance is changed.
optional int64 managerBonus = 4; // Amount of broker's bonus allocated to the account in cents.
optional int64 ibBonus = 5; // Amount of introducing broker bonus allocated to the account cents.
optional int64 nonWithdrawableBonus = 6; // Broker's bonus that cannot be withdrew from the account as cash.
optional ProtoOAAccessRights accessRights = 7 [default = FULL_ACCESS]; // Access rights that an owner has to the account in cTrader platform. See ProtoOAAccessRights for details.
required int64 depositAssetId = 8; // Deposit currency of the account.
optional bool swapFree = 9; // If TRUE than account is Shariah compliant.
optional uint32 leverageInCents = 10; // Account leverage (e.g. If leverage = 1:50 then value = 5000).
optional ProtoOATotalMarginCalculationType totalMarginCalculationType = 11; // Margin computation type for the account (MAX, SUM, NET).
optional uint32 maxLeverage = 12; // Maximum allowed leverage for the account. Used as validation when a Trader can change leverage value.
optional bool frenchRisk = 13; // If TRUE then account is AMF compliant.
optional int64 traderLogin = 14; // ID of the account that is unique per server (Broker).
optional ProtoOAAccountType accountType = 15 [default = HEDGED]; // Account type: HEDGED, NETTED, etc.
optional string brokerName = 16; // Some whitelabel assigned to trader by broker at the moment of account creation.
optional int64 registrationTimestamp = 17; // Unix timestamp of the account registration. Should be used as minimal date in historical data requests.
}
/** Position status ENUM. */
enum ProtoOAPositionStatus {
POSITION_STATUS_OPEN = 1;
POSITION_STATUS_CLOSED = 2;
POSITION_STATUS_CREATED = 3; // Empty position is created for pending order.
POSITION_STATUS_ERROR = 4;
}
/** Trader side ENUM. Used for order, position, deal. */
enum ProtoOATradeSide {
BUY = 1;
SELL = 2;
}
/** Order type ENUM. */
enum ProtoOAOrderType {
MARKET = 1;
LIMIT = 2;
STOP = 3;
STOP_LOSS_TAKE_PROFIT = 4;
MARKET_RANGE = 5;
STOP_LIMIT = 6;
}
/** Order's time in force ENUM. */
enum ProtoOATimeInForce {
GOOD_TILL_DATE = 1;
GOOD_TILL_CANCEL = 2;
IMMEDIATE_OR_CANCEL = 3;
FILL_OR_KILL = 4;
MARKET_ON_OPEN = 5;
}
/** Order status ENUM. */
enum ProtoOAOrderStatus {
ORDER_STATUS_ACCEPTED = 1; // Order request validated and accepted for execution.
ORDER_STATUS_FILLED = 2; // Order is fully filled.
ORDER_STATUS_REJECTED = 3; // Order is rejected due to validation.
ORDER_STATUS_EXPIRED = 4; // Order expired. Might be valid for orders with partially filled volume that were expired on LP.
ORDER_STATUS_CANCELLED = 5; // Order is cancelled. Might be valid for orders with partially filled volume that were cancelled by LP.
}
/** Stop Order and Stop Lost triggering method ENUM. */
enum ProtoOAOrderTriggerMethod {
TRADE = 1; // Stop Order: buy is triggered by ask, sell by bid; Stop Loss Order: for buy position is triggered by bid and for sell position by ask.
OPPOSITE = 2; // Stop Order: buy is triggered by bid, sell by ask; Stop Loss Order: for buy position is triggered by ask and for sell position by bid.
DOUBLE_TRADE = 3; // The same as TRADE, but trigger is checked after the second consecutive tick.
DOUBLE_OPPOSITE = 4; // The same as OPPOSITE, but trigger is checked after the second consecutive tick.
}
/** Trade position entity. */
message ProtoOAPosition {
required int64 positionId = 1; // The unique ID of the position. Note: trader might have two positions with the same id if positions are taken from accounts from different brokers.
required ProtoOATradeData tradeData = 2; // Position details. See ProtoOATradeData for details.
required ProtoOAPositionStatus positionStatus = 3; // Current status of the position.
required int64 swap = 4; // Total amount of charged swap on open position.
optional double price = 5; // VWAP price of the position based on all executions (orders) linked to the position.
optional double stopLoss = 6; // Current stop loss price.
optional double takeProfit = 7; // Current take profit price.
optional int64 utcLastUpdateTimestamp = 8; // Time of the last change of the position, including amend SL/TP of the position, execution of related order, cancel or related order, etc.
optional int64 commission = 9; // Current unrealized commission related to the position.
optional double marginRate = 10; // Rate for used margin computation. Represented as Base/Deposit.
optional int64 mirroringCommission = 11; // Amount of unrealized commission related to following of strategy provider.
optional bool guaranteedStopLoss = 12; // If TRUE then position's stop loss is guaranteedStopLoss.
optional uint64 usedMargin = 13; // Amount of margin used for the position in deposit currency.
optional ProtoOAOrderTriggerMethod stopLossTriggerMethod = 14 [default = TRADE]; // Stop trigger method for SL/TP of the position.
}
/** Position/order trading details entity. */
message ProtoOATradeData {
required int64 symbolId = 1; // The unique identifier of the symbol in specific server environment within cTrader platform. Different brokers might have different IDs.
required int64 volume = 2; // Volume in cents.
required ProtoOATradeSide tradeSide = 3; // Buy, Sell.
optional int64 openTimestamp = 4; // Time when position was opened or order was created.
optional string label = 5; // Text label specified during order request.
optional bool guaranteedStopLoss = 6; // If TRUE then position/order stop loss is guaranteedStopLoss.
}
/** Trade order entity. */
message ProtoOAOrder {
required int64 orderId = 1; // The unique ID of the order. Note: trader might have two orders with the same id if orders are taken from accounts from different brokers.
required ProtoOATradeData tradeData = 2; // Detailed trader data.
required ProtoOAOrderType orderType = 3; // Order type.
required ProtoOAOrderStatus orderStatus = 4; // Order status.
optional int64 expirationTimestamp = 6; // If the order has time in force GTD then expiration is specified.
optional double executionPrice = 7; // Price at which an order was executed. For order with FILLED status.
optional int64 executedVolume = 8; // Part of the volume that was filled.
optional int64 utcLastUpdateTimestamp = 9; // Timestamp of the last update of the order.
optional double baseSlippagePrice = 10; // Used for Market Range order with combination of slippageInPoints to specify price range were order can be executed.
optional int64 slippageInPoints = 11; // Used for Market Range and STOP_LIMIT orders to to specify price range were order can be executed.
optional bool closingOrder = 12; // If TRUE then the order is closing part of whole position. Must have specified positionId.
optional double limitPrice = 13; // Valid only for LIMIT orders.
optional double stopPrice = 14; // Valid only for STOP and STOP_LIMIT orders.
optional double stopLoss = 15; // Absolute stopLoss price.
optional double takeProfit = 16; // Absolute takeProfit price.
optional string clientOrderId = 17; // Optional ClientOrderId. Max Length = 50 chars.
optional ProtoOATimeInForce timeInForce = 18 [default = IMMEDIATE_OR_CANCEL]; // Order's time in force. Depends on order type.
optional int64 positionId = 19; // ID of the position linked to the order (e.g. closing order, order that increase volume of a specific position, etc.).
optional int64 relativeStopLoss = 20; // Relative stopLoss that can be specified instead of absolute as one. Specified in 1/100'000 of unit of a price. For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
optional int64 relativeTakeProfit = 21; // Relative takeProfit that can be specified instead of absolute one. Specified in 1/100'000 of unit of a price. ForBUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional bool isStopOut = 22; // If TRUE then order was stopped out from server side.
optional bool trailingStopLoss = 23; // If TRUE then order is trailingStopLoss. Valid for STOP_LOSS_TAKE_PROFIT order.
optional ProtoOAOrderTriggerMethod stopTriggerMethod = 24 [default = TRADE]; // Trigger method for the order. Valid only for STOP and STOP_LIMIT orders.
}
/** Execution event type ENUM. */
enum ProtoOAExecutionType {
ORDER_ACCEPTED = 2; // Order passed validation.
ORDER_FILLED = 3; // Order filled.
ORDER_REPLACED = 4; // Pending order is changed with a new one.
ORDER_CANCELLED = 5; // Order cancelled.
ORDER_EXPIRED = 6; // Order with GTD time in force is expired.
ORDER_REJECTED = 7; // Order is rejected due to validations.
ORDER_CANCEL_REJECTED = 8; // Cancel order request is rejected.
SWAP = 9; // Type related to SWAP execution events.
DEPOSIT_WITHDRAW = 10; // Type related to event of deposit or withdrawal cash flow operation.
ORDER_PARTIAL_FILL = 11; // Order is partially filled.
BONUS_DEPOSIT_WITHDRAW = 12; // Type related to event of bonus deposit or bonus withdrawal.
}
/** Bonus deposit/withdrawal entity. */
message ProtoOABonusDepositWithdraw {
required ProtoOAChangeBonusType operationType = 1; // Type of the operation. Deposit/Withdrawal.
required int64 bonusHistoryId = 2; // The unique ID of the bonus deposit/withdrawal operation.
required int64 managerBonus = 3; // Total amount of broker's bonus after the operation.
required int64 managerDelta = 4; // Amount of bonus deposited/withdrew by manager.
required int64 ibBonus = 5; // Total amount of introducing broker's bonus after the operation.
required int64 ibDelta = 6; // Amount of bonus deposited/withdrew by introducing broker.
required int64 changeBonusTimestamp = 7; // Time when the bonus operation was executed.
optional string externalNote = 8; // Note added to operation. Visible to the trader.
optional int64 introducingBrokerId = 9; // ID of introducing broker who deposited/withdrew bonus.
}
/** Bonus operation type ENUM. */
enum ProtoOAChangeBonusType {
BONUS_DEPOSIT = 0;
BONUS_WITHDRAW = 1;
}
/** Account deposit/withdrawal operation entity. */
message ProtoOADepositWithdraw {
required ProtoOAChangeBalanceType operationType = 1; // Type of the operation. Deposit/Withdrawal.
required int64 balanceHistoryId = 2; // The unique ID of the deposit/withdrawal operation.
required int64 balance = 3; // Account balance after the operation was executed.
required int64 delta = 4; // Amount of deposit/withdrawal operation.
required int64 changeBalanceTimestamp = 5; // Time when deposit/withdrawal operation was executed.
optional string externalNote = 6; // Note added to operation. Visible to the trader.
optional int64 balanceVersion = 7; // Balance version used to identify the final balance. Increments each time when the trader's account balance is changed.
optional int64 equity = 8; // Total account's equity after balance operation was executed.
}
/** Balance operation entity. Covers all cash movement operations related to account, trading, IB operations, mirroring, etc. */
enum ProtoOAChangeBalanceType {
BALANCE_DEPOSIT = 0; // Cash deposit.
BALANCE_WITHDRAW = 1; // Cash withdrawal.
BALANCE_DEPOSIT_STRATEGY_COMMISSION_INNER = 3; // Received mirroring commission.
BALANCE_WITHDRAW_STRATEGY_COMMISSION_INNER = 4; // Paid mirroring commission.
BALANCE_DEPOSIT_IB_COMMISSIONS = 5; // For IB account. Commissions paid by trader.
BALANCE_WITHDRAW_IB_SHARED_PERCENTAGE = 6; // For IB account. Withdrawal of commissions shared with broker.
BALANCE_DEPOSIT_IB_SHARED_PERCENTAGE_FROM_SUB_IB = 7; // For IB account. Commissions paid by sub-ibs.
BALANCE_DEPOSIT_IB_SHARED_PERCENTAGE_FROM_BROKER = 8; // For IB account. Commissions paid by broker.
BALANCE_DEPOSIT_REBATE = 9; // Deposit rebate for trading volume for period.
BALANCE_WITHDRAW_REBATE = 10; // Withdrawal of rebate.
BALANCE_DEPOSIT_STRATEGY_COMMISSION_OUTER = 11; // Mirroring commission.
BALANCE_WITHDRAW_STRATEGY_COMMISSION_OUTER = 12; // Mirroring commission.
BALANCE_WITHDRAW_BONUS_COMPENSATION = 13; // For IB account. Share commission with the Broker.
BALANCE_WITHDRAW_IB_SHARED_PERCENTAGE_TO_BROKER = 14; // IB commissions.
BALANCE_DEPOSIT_DIVIDENDS = 15; // Deposit dividends payments.
BALANCE_WITHDRAW_DIVIDENDS = 16; // Negative dividend charge for short position.
BALANCE_WITHDRAW_GSL_CHARGE = 17; // Charge for guaranteedStopLoss.
BALANCE_WITHDRAW_ROLLOVER = 18; // Charge of rollover fee for Shariah compliant accounts.
BALANCE_DEPOSIT_NONWITHDRAWABLE_BONUS = 19; // Broker's operation to deposit bonus.
BALANCE_WITHDRAW_NONWITHDRAWABLE_BONUS = 20; // Broker's operation to withdrawal bonus.
BALANCE_DEPOSIT_SWAP = 21; // Deposits of negative SWAP.
BALANCE_WITHDRAW_SWAP = 22; // SWAP charges.
BALANCE_DEPOSIT_MANAGEMENT_FEE = 27; // Mirroring commission.
BALANCE_WITHDRAW_MANAGEMENT_FEE = 28; // Mirroring commission.
BALANCE_DEPOSIT_PERFORMANCE_FEE = 29; // Mirroring commission.
BALANCE_WITHDRAW_INACTIVITY_FEE = 35; // Withdraw of inactivity fee from the balance CS-10762
}
/** Execution entity. */
message ProtoOADeal {
required int64 dealId = 1; // The unique ID of the execution deal.
required int64 orderId = 2; // Source order of the deal.
required int64 positionId = 3; // Source position of the deal.
required int64 volume = 4; // Volume sent for execution, in cents.
required int64 filledVolume = 5; // Filled volume, in cents.
required int64 symbolId = 6; // The unique identifier of the symbol in specific server environment within cTrader platform. Different servers have different IDs.
required int64 createTimestamp = 7; // Time when the deal was sent for execution.
required int64 executionTimestamp = 8; // Time when the deal was executed.
optional int64 utcLastUpdateTimestamp = 9; // Timestamp when the deal was created, executed or rejected.
optional double executionPrice = 10; // Execution price.
required ProtoOATradeSide tradeSide = 11; // Buy/Sell.
required ProtoOADealStatus dealStatus = 12; // Status of the deal.
optional double marginRate = 13; // Rate for used margin computation. Represented as Base/Deposit.
optional int64 commission = 14; // Amount of trading commission associated with the deal.
optional double baseToUsdConversionRate = 15; // Base to USD conversion rate on the time of deal execution.
optional ProtoOAClosePositionDetail closePositionDetail = 16; // Closing position detail. Valid only for closing deal.
}
/** Deal status ENUM. */
enum ProtoOADealStatus {
FILLED = 2; // Deal filled.
PARTIALLY_FILLED = 3; // Deal is partially filled.
REJECTED = 4; // Deal is correct but was rejected by liquidity provider (e.g. no liquidity).
INTERNALLY_REJECTED = 5; // Deal rejected by server (e.g. no price quotes).
ERROR = 6; // Deal is rejected by LP due to error (e.g. symbol is unknown).
MISSED = 7; // Liquidity provider did not sent response on the deal during specified execution time period.
}
/** Trading details for closing deal. */
message ProtoOAClosePositionDetail {
required double entryPrice = 1; // Position price at the moment of filling the closing order.
required int64 grossProfit = 2; // Amount of realized gross profit after closing deal execution.
required int64 swap = 3; // Amount of realized swap in cents related to closed volume.
required int64 commission = 4; // Amount of realized commission in cents related to closed volume.
required int64 balance = 5; // Account balance after closing deal execution.
optional double quoteToDepositConversionRate = 6; // Quote/Deposit currency conversion rate on the time of closing deal execution.
optional int64 closedVolume = 7; // Closed volume in cents.
optional int64 balanceVersion = 8; // Balance version of the account related to closing deal operation.
}
/** Trendbar period ENUM. */
enum ProtoOATrendbarPeriod {
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;
}
/** Historical Trendbar entity. */
message ProtoOATrendbar {
required int64 volume = 3; // Bar volume in ticks.
optional ProtoOATrendbarPeriod period = 4 [default = M1]; // Bar period.
optional int64 low = 5; // Low price of the bar.
optional uint64 deltaOpen = 6; // Delta between open and low price. open = low + deltaOpen.
optional uint64 deltaClose = 7; // Delta between open and low price. close = low + deltaClose.
optional uint64 deltaHigh = 8; // Delta between open and low price. high = low + deltaHigh.
optional uint32 utcTimestampInMinutes = 9; // Timestamp of the bar. Equal to the timestamp of the open tick.
}
/** Expected margin computation entity. */
message ProtoOAExpectedMargin {
required int64 volume = 1; // Volume in cents used for computation of expected margin.
required int64 buyMargin = 2; // Buy margin amount in cents.
required int64 sellMargin = 3; // Sell margin amount in cents.
}
/** Price quote type. */
enum ProtoOAQuoteType {
BID = 1;
ASK = 2;
}
/** Historical tick data type. */
message ProtoOATickData {
required int64 timestamp = 1; // Tick timestamp.
required int64 tick = 2; // Tick price.
}
/** Open API application permission in regards to token ENUM. */
enum ProtoOAClientPermissionScope {
SCOPE_VIEW = 0; // Allows to use only view commends. Trade is prohibited.
SCOPE_TRADE = 1; // Allows to use all commands.
}
/** Trader profile entity. Empty due to GDPR. */
message ProtoOACtidProfile {
required int64 userId = 1;
}
/** Trader account entity. */
message ProtoOACtidTraderAccount {
required uint64 ctidTraderAccountId = 1; // Unique identifier of the trader's account. Used to match responses to trader's accounts.cTrader platform. Different brokers might have different ids
optional bool isLive = 2; // If TRUE then the account is belong to Live environment and live host must be used to authorize it
optional int64 traderLogin = 3;
}
/** Asset class entity. */
message ProtoOAAssetClass {
optional int64 id = 1; // Unique asset ID.
optional string name = 2; // Asset class name.
}
/** Depth of market entity. */
message ProtoOADepthQuote {
required uint64 id = 1; // Quote ID.
required uint64 size = 3; // Quote size in cents.
optional uint64 bid = 4; // Bid price for bid quotes.
optional uint64 ask = 5; // Ask price for ask quotes.
}
/** Error code ENUM. */
enum ProtoOAErrorCode {
OA_AUTH_TOKEN_EXPIRED = 1; // When token used for account authorization is expired.
ACCOUNT_NOT_AUTHORIZED = 2; // When account is not authorized.
INCORRECT_BOUNDARIES = 35; // Used for time and numeric boundaries.
CONNECTIONS_LIMIT_EXCEEDED = 67; // When Open API client connections number is reached its maximum.
}