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 pathOpenApiMessages.proto
More file actions
589 lines (457 loc) · 35.4 KB
/
Copy pathOpenApiMessages.proto
File metadata and controls
589 lines (457 loc) · 35.4 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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option java_package = "com.xtrader.protocol.openapi.v2";
option java_outer_classname = "ContainerOpenApiV2Messages";
import "OpenApiModelMessages.proto";
/** Request for the authorizing an application to work with the cTrader platform Proxies. */
message ProtoOAApplicationAuthReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_APPLICATION_AUTH_REQ];
required string clientId = 2; //The unique Client ID provided during the registration.
required string clientSecret = 3; //The unique Client Secret provided during the registration.
}
/** Response to the ProtoOAApplicationAuthReq request. */
message ProtoOAApplicationAuthRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_APPLICATION_AUTH_RES];
}
/** Request for the authorizing trading account session. Requires established authorized connection with the client application using ProtoOAApplicationAuthReq. */
message ProtoOAAccountAuthReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNT_AUTH_REQ];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
required string accessToken = 3; // The Access Token issued for providing access to the Trader's Account.
}
/** Response to the ProtoOAApplicationAuthRes request. */
message ProtoOAAccountAuthRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNT_AUTH_RES];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}
/** Generic response when an ERROR occurred. */
message ProtoOAErrorRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ERROR_RES];
optional int64 ctidTraderAccountId = 2; //The unique identifier of the trader's account in cTrader platform.
required string errorCode = 3; // The name of the ProtoErrorCode or the other custom ErrorCodes (e.g. ProtoCHErrorCode).
optional string description = 4; // The error description.
}
/** The event that is sent when the connection with the client application is cancelled by the server. All the sessions for the traders' accounts will be terminated. */
message ProtoOAClientDisconnectEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_CLIENT_DISCONNECT_EVENT];
optional string reason = 2; // The disconnection reason explained. For example: The application access was blocked by cTrader Administrator.
}
/** Event that is sent when a session to a specific trader's account is terminated by the server but the existing connections with the other trader's accounts are maintained. */
message ProtoOAAccountsTokenInvalidatedEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNTS_TOKEN_INVALIDATED_EVENT];
repeated int64 ctidTraderAccountIds = 2; // The unique identifier of the trader's account in cTrader platform.
optional string reason = 3; // The disconnection reason explained. For example: Access Token is expired or recalled.
}
/** Request for getting the proxy version. Can be used to check the current version of the Open API scheme. */
message ProtoOAVersionReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_VERSION_REQ];
}
/** Response to the ProtoOAVersionReq request. */
message ProtoOAVersionRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_VERSION_RES];
required string version = 2; // The current version of the server application.
}
/** Request for sending a new trading order. Allowed only if the accessToken has the "trade" permissions for the trading account. */
message ProtoOANewOrderReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_NEW_ORDER_REQ];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
required int64 symbolId = 3; // The unique identifier of a symbol in cTrader platform.
required ProtoOAOrderType orderType = 4; // The type of an order - MARKET, LIMIT, STOP, MARKET_RANGE, STOP_LIMIT.
required ProtoOATradeSide tradeSide = 5; // The trade direction - BUY or SELL.
required int64 volume = 6; // The volume represented in 0.01 of a unit (e.g. US$ 10.00 = 1000).
optional double limitPrice = 7; // The limit price, can be specified for the LIMIT order only.
optional double stopPrice = 8; // Stop Price, can be specified for the STOP and the STOP_LIMIT orders only.
optional ProtoOATimeInForce timeInForce = 9 [default = GOOD_TILL_CANCEL]; // The specific order execution or expiration instruction - GOOD_TILL_DATE, GOOD_TILL_CANCEL, IMMEDIATE_OR_CANCEL, FILL_OR_KILL, MARKET_ON_OPEN.
optional int64 expirationTimestamp = 10; // The exact Order expiration time. Should be set for the Good Till Date orders.
optional double stopLoss = 11; // The absolute Stop Loss price (1.23456 for example). Not supported for the MARKER orders.
optional double takeProfit = 12; // The absolute Take Profit price (1.23456 for example). Unsupported for the MARKER orders.
optional string comment = 13; // User-specified comment. MaxLength = 512.
optional double baseSlippagePrice = 14; // Base price to calculate relative slippage price for MARKET_RANGE order.
optional int32 slippageInPoints = 15; // Slippage distance for MARKET_RANGE and STOP_LIMIT order.
optional string label = 16; // User-specified label. MaxLength = 100.
optional int64 positionId = 17; // Reference to the existing position if the Order is intended to modify it.
optional string clientOrderId = 18; // Optional user-specific clientOrderId (similar to FIX ClOrderID). MaxLength = 50.
optional int64 relativeStopLoss = 19; // Relative Stop Loss that can be specified instead of the absolute as one. Specified in 1/100000 of unit of a price. For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
optional int64 relativeTakeProfit = 20; // Relative Take Profit that can be specified instead of the absolute one. Specified in 1/100000 of unit of a price. For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional bool guaranteedStopLoss = 21; // If TRUE then stopLoss is guaranteed. Available for the French Risk or the Guaranteed Stop Loss Accounts.
optional bool trailingStopLoss = 22; // If TRUE then the Stop Loss is Trailing.
optional ProtoOAOrderTriggerMethod stopTriggerMethod = 23 [default = TRADE]; // Trigger method for the STOP or the STOP_LIMIT pending order.
}
/** The event that is sent following the successful order acceptance or execution by the server. Acts as response to the ProtoOANewOrderReq, ProtoOACancelOrderReq, ProtoOAAmendOrderReq, ProtoOAAmendPositionSLTPReq, ProtoOAClosePositionReq requests. Also, the event is sent when a Deposit/Withdrawal took place. */
message ProtoOAExecutionEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_EXECUTION_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOAExecutionType executionType = 3; // Type of the order operation. For example: ACCEPTED, FILLED, etc.
optional ProtoOAPosition position = 4; // Reference to the position linked with the execution
optional ProtoOAOrder order = 5; // Reference to the initial order.
optional ProtoOADeal deal = 6; // Reference to the deal (execution).
optional ProtoOABonusDepositWithdraw bonusDepositWithdraw = 7; // Reference to the Bonus Deposit or Withdrawal operation.
optional ProtoOADepositWithdraw depositWithdraw = 8; // Reference to the Deposit or Withdrawal operation.
optional string errorCode = 9; //The name of the ProtoErrorCode or the other custom ErrorCodes (e.g. ProtoCHErrorCode).
optional bool isServerEvent = 10; // If TRUE then the event generated by the server logic instead of the trader's request. (e.g. stop-out).
}
/** Request for cancelling existing pending order. Allowed only if the accessToken has "trade" permissions for the trading account. */
message ProtoOACancelOrderReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_CANCEL_ORDER_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 orderId = 3; // The unique ID of the order.
}
/** Request for amending the existing pending order. Allowed only if the Access Token has "trade" permissions for the trading account. */
message ProtoOAAmendOrderReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_AMEND_ORDER_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 orderId = 3; // The unique ID of the order.
optional int64 volume = 4; // Volume, represented in 0.01 of a unit (e.g. cents).
optional double limitPrice = 5; // The Limit Price, can be specified for the LIMIT order only.
optional double stopPrice = 6; // The Stop Price, can be specified for the STOP and the STOP_LIMIT orders.
optional int64 expirationTimestamp = 7; // The exact Order expiration time. Should be set for the Good Till Date orders.
optional double stopLoss = 8; // The absolute Stop Loss price (e.g. 1.23456). Not supported for the MARKER orders.
optional double takeProfit = 9; // The absolute Take Profit price (e.g. 1.23456). Not supported for the MARKER orders.
optional int32 slippageInPoints = 10; // Slippage distance for the MARKET_RANGE and the STOP_LIMIT orders.
optional int64 relativeStopLoss = 11; // The relative Stop Loss can be specified instead of the absolute one. Specified in 1/100000 of a unit of price. For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
optional int64 relativeTakeProfit = 12; // The relative Take Profit can be specified instead of the absolute one. Specified in 1/100000 of a unit of price. For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional bool guaranteedStopLoss = 13; // If TRUE then the Stop Loss is guaranteed. Available for the French Risk or the Guaranteed Stop Loss Accounts.
optional bool trailingStopLoss = 14; // If TRUE then the Trailing Stop Loss is applied.
optional ProtoOAOrderTriggerMethod stopTriggerMethod = 15 [default = TRADE]; // Trigger method for the STOP or the STOP_LIMIT pending order.
}
/** Request for amending StopLoss and TakeProfit of existing position. Allowed only if the accessToken has "trade" permissions for the trading account. */
message ProtoOAAmendPositionSLTPReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_AMEND_POSITION_SLTP_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 positionId = 3; // The unique ID of the position to amend.
optional double stopLoss = 4; // Absolute Stop Loss price (1.23456 for example).
optional double takeProfit = 5; // Absolute Take Profit price (1.26543 for example).
optional bool guaranteedStopLoss = 7; //If TRUE then the Stop Loss is guaranteed. Available for the French Risk or the Guaranteed Stop Loss Accounts.
optional bool trailingStopLoss = 8; //If TRUE then the Trailing Stop Loss is applied.
optional ProtoOAOrderTriggerMethod stopLossTriggerMethod = 9 [default = TRADE]; // The Stop trigger method for the Stop Loss/Take Profit order.
}
/** Request for closing or partially closing of an existing position. Allowed only if the accessToken has "trade" permissions for the trading account. */
message ProtoOAClosePositionReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_CLOSE_POSITION_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 positionId = 3; // The unique ID of the position to close.
required int64 volume = 4; // Volume to close, represented in 0.01 of a unit (e.g. cents).
}
/** Event that is sent when the level of the Trailing Stop Loss is changed due to the price level changes. */
message ProtoOATrailingSLChangedEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_TRAILING_SL_CHANGED_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 positionId = 3; // The unique ID of the position.
required int64 orderId = 4; // The unique ID of the order.
required double stopPrice = 5; // New value of the Stop Loss price.
required int64 utcLastUpdateTimestamp = 6; // The exact UTC time when the Stop Loss was updated.
}
/** Request for the list of assets available for a trader's account. */
message ProtoOAAssetListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ASSET_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Response to the ProtoOAAssetListReq request. */
message ProtoOAAssetListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ASSET_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAAsset asset = 3; // The list of assets.
}
/** Request for a list of symbols available for a trading account. Symbol entries are returned with the limited set of fields. */
message ProtoOASymbolsListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOLS_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Response to the ProtoOASymbolsListReq request. */
message ProtoOASymbolsListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOLS_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOALightSymbol symbol = 3; // The list of symbols.
}
/** Request for getting a full symbol entity. */
message ProtoOASymbolByIdReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOL_BY_ID_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the symbol in cTrader platform.
}
/** Response to the ProtoOASymbolByIdReq request. */
message ProtoOASymbolByIdRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOL_BY_ID_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOASymbol symbol = 3; // Symbol entity with the full set of fields.
}
/** Request for getting a conversion chain between two assets that consists of several symbols. Use when no direct quote is available */
message ProtoOASymbolsForConversionReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOLS_FOR_CONVERSION_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 firstAssetId = 3; // The ID of the firs asset in the conversation chain. e.g.: for EUR/USD the firstAssetId is EUR ID and lastAssetId is USD ID.
required int64 lastAssetId = 4; // The ID of the last asset in the conversation chain. e.g.: for EUR/USD the firstAssetId is EUR ID and lastAssetId is USD ID.
}
/** Response to the ProtoOASymbolsForConversionReq request. */
message ProtoOASymbolsForConversionRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOLS_FOR_CONVERSION_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOALightSymbol symbol = 3; // Conversion chain of the symbols (e.g. EUR/USD, USD/JPY, GBP/JPY -> EUR/GBP).
}
/** Event that is sent when the symbol is changed on the Server side. */
message ProtoOASymbolChangedEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOL_CHANGED_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
}
/** Request for a list of asset classes available for the trader's account. */
message ProtoOAAssetClassListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ASSET_CLASS_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Response to the ProtoOAAssetListReq request. */
message ProtoOAAssetClassListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ASSET_CLASS_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAAssetClass assetClass = 3; // List of the asset classes.
}
/** Request for getting data of Trader's Account. */
message ProtoOATraderReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_TRADER_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Response to the ProtoOATraderReq request. */
message ProtoOATraderRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_TRADER_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOATrader trader = 3; // The Trader account information.
}
/** Event that is sent when a Trader is updated on Server side. */
message ProtoOATraderUpdatedEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_TRADER_UPDATE_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOATrader trader = 3; // The Trader account information.
}
/** Request for getting Trader's current open positions and pending orders data. */
message ProtoOAReconcileReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_RECONCILE_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** The response to the ProtoOAReconcileReq request. */
message ProtoOAReconcileRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_RECONCILE_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAPosition position = 3; // The list of trader's account open positions.
repeated ProtoOAOrder order = 4; // The list of trader's account pending orders.
}
/** Event that is sent when errors occur during the order requests. */
message ProtoOAOrderErrorEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_ERROR_EVENT];
required int64 ctidTraderAccountId = 5; //Unique identifier of the trader's account. Used to match responses to trader's accounts.
required string errorCode = 2; // The name of the ProtoErrorCode or the other custom ErrorCodes (e.g. ProtoCHErrorCode).
optional int64 orderId = 3; // The unique ID of the order.
optional int64 positionId = 6; // The unique ID of the position.
optional string description = 7; // The error description.
}
/** Request for getting Trader's deals historical data (execution details). */
message ProtoOADealListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 fromTimestamp = 3; // The UNIX time from which the search starts >=0 (1-1-1970). Validation: toTimestamp - fromTimestamp <= 604800000 (1 week).
required int64 toTimestamp = 4; // The UNIX time where to stop searching <= 2147483646000 (19-1-2038).
optional int32 maxRows = 5; // The maximum number of the deals to return.
}
/** The response to the ProtoOADealListRes request. */
message ProtoOADealListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOADeal deal = 3; // The list of the deals.
required bool hasMore = 4; // If TRUE then the response will provide more than 10000 deals.
}
/** Request for getting the margin estimate. Can be used before sending a new order request. */
message ProtoOAExpectedMarginReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_EXPECTED_MARGIN_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
repeated int64 volume = 4; // Volume represented in 0.01 of a unit (e.g. cents).
}
/**The response to the ProtoOAExpectedMarginReq request. */
message ProtoOAExpectedMarginRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_EXPECTED_MARGIN_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAExpectedMargin margin = 3; // The buy and sell margin estimate.
}
/** Event that is sent when the margin allocated to a specific position is changed. */
message ProtoOAMarginChangedEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CHANGED_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required uint64 positionId = 3; // The unique ID of the position.
required uint64 usedMargin = 4; // The new value of the margin used.
}
/** Request for getting Trader's historical data of deposits and withdrawals. */
message ProtoOACashFlowHistoryListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_CASH_FLOW_HISTORY_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 fromTimestamp = 3; // The UNIX time from which the search starts >=0 (1-1-1970). Validation: toTimestamp - fromTimestamp <= 604800000 (1 week).
required int64 toTimestamp = 4; // The UNIX time where to stop searching <= 2147483646000 (19-1-2038).
}
/** Response to the ProtoOACashFlowHistoryListReq request. */
message ProtoOACashFlowHistoryListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_CASH_FLOW_HISTORY_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOADepositWithdraw depositWithdraw = 3; // The list of deposit and withdrawal operations.
}
/** Request for getting the list of granted trader's account for the access token. */
message ProtoOAGetAccountListByAccessTokenReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ];
required string accessToken = 2; // The Access Token issued for providing access to the Trader's Account.
}
/** Response to the ProtoOAGetAccountListByAccessTokenReq request. */
message ProtoOAGetAccountListByAccessTokenRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_RES];
required string accessToken = 2; // The Access Token issued for providing access to the Trader's Account.
optional ProtoOAClientPermissionScope permissionScope = 3; // SCOPE_VIEW, SCOPE_TRADE.
repeated ProtoOACtidTraderAccount ctidTraderAccount = 4; // The list of the accounts.
}
//+------------------------------------------------------------------+
//| Quotes |
//+------------------------------------------------------------------+
/** Request for subscribing on spot events of the specified symbol. */
message ProtoOASubscribeSpotsReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_SPOTS_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
}
/** Response to the ProtoOASubscribeSpotsReq request. */
message ProtoOASubscribeSpotsRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_SPOTS_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Request for unsubscribing from the spot events of the specified symbol. */
message ProtoOAUnsubscribeSpotsReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_SPOTS_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
}
/** Response to the ProtoOASubscribeSpotsRes request. */
message ProtoOAUnsubscribeSpotsRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_SPOTS_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Event that is sent when a new spot event is generated on the server side. Requires subscription on the spot events, see ProtoOASubscribeSpotsReq. */
message ProtoOASpotEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SPOT_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
optional uint64 bid = 4; // Bid price.
optional uint64 ask = 5; // Ask price.
repeated ProtoOATrendbar trendbar = 6; // Returns live trend bar. Requires subscription on the trend bars.
}
/** Request for subscribing for live trend bars. Requires subscription on the spot events, see ProtoOASubscribeSpotsReq. */
message ProtoOASubscribeLiveTrendbarReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_LIVE_TRENDBAR_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOATrendbarPeriod period = 3; // Specifies period of trend bar series (e.g. M1, M10, etc.).
required int64 symbolId = 4; // Unique identifier of the Symbol in cTrader platform.
}
/** Request for unsubscribing from the live trend bars. */
message ProtoOAUnsubscribeLiveTrendbarReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_LIVE_TRENDBAR_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOATrendbarPeriod period = 3; // Specifies period of trend bar series (e.g. M1, M10, etc.).
required int64 symbolId = 4; // Unique identifier of the Symbol in cTrader platform.
}
/** Request for getting historical trend bars for the symbol. */
message ProtoOAGetTrendbarsReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_TRENDBARS_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 fromTimestamp = 3; // The exact time of starting the search in milliseconds. Must be bigger or equal to zero (1-1-1970). Validation: toTimestamp - fromTimestamp <= X, where X depends on series period: M1, M2, M3, M4, M5: 302400000 (5 weeks); M10, M15, M30, H1: 21168000000 (35 weeks), H4, H12, D1: 31622400000 (1 year); W1, MN1: 158112000000 (5 years).
required int64 toTimestamp = 4; // The exact time of finishing the search in milliseconds. Smaller or equal to 2147483646000 (19-1-2038).
required ProtoOATrendbarPeriod period = 5; // Specifies period of trend bar series (e.g. M1, M10, etc.).
required int64 symbolId = 6; // Unique identifier of the Symbol in cTrader platform.
}
/** Response to the ProtoOAGetTrendbarsReq request. */
message ProtoOAGetTrendbarsRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_TRENDBARS_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOATrendbarPeriod period = 3; // Specifies period of trend bar series (e.g. M1, M10, etc.).
required int64 timestamp = 4; // Equals to toTimestamp from the request.
repeated ProtoOATrendbar trendbar = 5; // The list of trend bars.
optional int64 symbolId = 6; // Unique identifier of the Symbol in cTrader platform.
}
/** Request for getting historical tick data for the symbol. */
message ProtoOAGetTickDataReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_TICKDATA_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
required ProtoOAQuoteType type = 4; // Bid/Ask (1/2).
required int64 fromTimestamp = 5; // The exact time of starting the search in milliseconds. Must be bigger of equal to zero (1-1-1970). Validation: toTimestamp - fromTimestamp <= 604800000 (1 week).
required int64 toTimestamp = 6; // The exact time of finishing the search in milliseconds <= 2147483646000 (19-1-2038).
}
/** Response to the ProtoOAGetTickDataReq request. */
message ProtoOAGetTickDataRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_TICKDATA_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOATickData tickData = 3; // The list of ticks.
required bool hasMore = 4; // If TRUE then the number of records by filter is larger than chunkSize, the response contains the number of records that is equal to chunkSize.
}
//+------------------------------------------------------------------+
//| End quotes section |
//+------------------------------------------------------------------+
/** Request for getting details of Trader's profile. Limited due to GDRP requirements. */
message ProtoOAGetCtidProfileByTokenReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_REQ];
required string accessToken = 2; // The Access Token issued for providing access to the Trader's Account.
}
/** Response to the ProtoOAGetCtidProfileByTokenReq request. */
message ProtoOAGetCtidProfileByTokenRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_RES];
required ProtoOACtidProfile profile = 2; // Trader's profile.
}
/** Event that is sent when the structure of depth of market is changed. Requires subscription on the depth of markets for the symbol, see ProtoOASubscribeDepthQuotesReq. */
message ProtoOADepthEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEPTH_EVENT];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required uint64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
repeated ProtoOADepthQuote newQuotes = 4; // The list of changes in the depth of market quotes.
repeated uint64 deletedQuotes = 5 [packed = true]; // The list of quotes to delete.
}
/** Request for subscribing on depth of market of the specified symbol. */
message ProtoOASubscribeDepthQuotesReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
}
/** Response to the ProtoOASubscribeDepthQuotesReq request. */
message ProtoOASubscribeDepthQuotesRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Request for unsubscribing from the depth of market of the specified symbol. */
message ProtoOAUnsubscribeDepthQuotesReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated int64 symbolId = 3; // Unique identifier of the Symbol in cTrader platform.
}
/** Response to the ProtoOAUnsubscribeDepthQuotesReq request. */
message ProtoOAUnsubscribeDepthQuotesRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Request for a list of symbol categories available for a trading account. */
message ProtoOASymbolCategoryListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOL_CATEGORY_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** Response to the ProtoSymbolCategoryListReq request. */
message ProtoOASymbolCategoryListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SYMBOL_CATEGORY_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOASymbolCategory symbolCategory = 3; // The list of symbol categories.
}
/** Request for logout of trading account session.*/
message ProtoOAAccountLogoutReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNT_LOGOUT_REQ];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}
/** Response to the ProtoOATraderLogoutReq request. */
message ProtoOAAccountLogoutRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNT_LOGOUT_RES];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}
/** Event that is sent when the established session for an account is dropped on the server side.
A new session must be authorized for the account. */
message ProtoOAAccountDisconnectEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ACCOUNT_DISCONNECT_EVENT];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}