forked from spotware/openapi-proto-messages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenApiMessages.proto
828 lines (645 loc) · 51.6 KB
/
OpenApiMessages.proto
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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
syntax = "proto2";
option go_package = "/openapi";
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 authorizing of the 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.
optional int64 maintenanceEndTimestamp = 5; // The Unix time in seconds when the current maintenance session will be ended.
optional uint64 retryAfter = 6; // When you hit rate limit with errorCode=BLOCKED_PAYLOAD_TYPE, this field will contain amount of seconds until related payload type will be unlocked.
}
/** 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. Reasons to trigger: account was deleted, cTID was deleted, token was refreshed, token was revoked. */
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. 1000 in protocol means 10.00 units).
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 Unix time in milliseconds of Order expiration. 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. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) 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. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional bool guaranteedStopLoss = 21; // If TRUE then stopLoss is guaranteed. Required to be set to TRUE for the Limited Risk accounts (ProtoOATrader.isLimitedRisk=true).
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.
}
/** 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. 1000 in protocol means 10.00 units).
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 Unix timestamp in milliseconds of Order expiration. 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. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) 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. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) 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. 1000 in protocol means 10.00 units).
}
/** 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 Unix time in milliseconds 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.
optional bool includeArchivedSymbols = 3 [default = false]; // Whether to include old archived symbols into response.
}
/** 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.
repeated ProtoOAArchivedSymbol archivedSymbol = 4; // The list of archived 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.
repeated ProtoOAArchivedSymbol archivedSymbol = 4; // Archived symbols.
}
/** 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.
optional bool returnProtectionOrders = 3; // If TRUE, then current protection orders are returned separately, otherwise you can use position.stopLoss and position.takeProfit fields.
}
/** 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.
optional int64 fromTimestamp = 3; // The Unix time from which the search starts >=0 (1st Jan 1970).
optional int64 toTimestamp = 4; // The Unix time where to stop searching <= 2147483646000 (19th Jan 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 number of records by filter is larger than chunkSize, the response contains the number of records that is equal to chunkSize.
}
/** Request for getting Trader's orders filtered by timestamp */
message ProtoOAOrderListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
optional int64 fromTimestamp = 3; // The Unix time from which the search starts >=0 (1st Jan 1970).
optional int64 toTimestamp = 4; // The Unix time where to stop searching <= 2147483646000 (19th Jan 2038).
}
/** The response to the ProtoOAOrderListReq request. */
message ProtoOAOrderListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAOrder order = 3; // The list of the orders.
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.
}
/** Request for getting the margin estimate according to leverage profiles. Can be used before sending a new order request. This doesn't consider ACCORDING_TO_GSL margin calculation type, as this calculation is trivial: usedMargin = (VWAP price of the position - GSL price) * volume * Quote2Deposit. */
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. 1000 in protocol means 10.00 units).
}
/** 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.
optional uint32 moneyDigits = 4; // Specifies the exponent of the monetary values. E.g. moneyDigits = 8 must be interpret as business value multiplied by 10^8, then real balance would be 10053099944 / 10^8 = 100.53099944. Affects margin.buyMargin, margin.sellMargin.
}
/** 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.
optional uint32 moneyDigits = 5; // Specifies the exponent of the monetary values. E.g. moneyDigits = 8 must be interpret as business value multiplied by 10^8, then real balance would be 10053099944 / 10^8 = 100.53099944. Affects usedMargin.
}
/** 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 (1st Jan 1970). Validation: toTimestamp - fromTimestamp <= 604800000 (1 week).
required int64 toTimestamp = 4; // The Unix time where to stop searching <= 2147483646000 (19th Jan 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.
}
/** Request to refresh the access token using refresh token of granted trader's account. */
message ProtoOARefreshTokenReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_REFRESH_TOKEN_REQ];
required string refreshToken = 2; // The Refresh Token issued for updating Access Token.
}
/** Response to the ProtoOARefreshTokenReq request. */
message ProtoOARefreshTokenRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_REFRESH_TOKEN_RES];
required string accessToken = 2; // The Access Token issued for providing access to the Trader's Account.
required string tokenType = 3; // bearer
required int64 expiresIn = 4; // Access Token expiration in seconds.
required string refreshToken = 5; // Your new Refresh Token.
}
/** Request for subscribing on spot events of the specified symbol. After successful subscription you'll receive technical ProtoOASpotEvent with latest price, after which you'll start receiving updates on prices via consequent ProtoOASpotEvents. */
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.
optional bool subscribeToSpotTimestamp = 4; // If TRUE you will also receive the timestamp in ProtoOASpotEvent.
}
/** Response to the ProtoOASubscribeSpotsReq request. Reflects that your request to subscribe for symbol has been added to queue. You'll receive technical ProtoOASpotEvent with current price shortly after this response. */
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. Request to stop receiving ProtoOASpotEvents related to particular symbols. Unsubscription is useful to minimize traffic, especially during high volatility events. */
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. Reflects that your request to unsubscribe will has been added to queue and will be completed shortly. You may still occasionally receive ProtoOASpotEvents until request processing is complete. */
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. First event, received after subscription will contain latest spot prices even if market is closed. */
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. Specified in 1/100000 of unit of a price. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782)
optional uint64 ask = 5; // Ask price. Specified in 1/100000 of unit of a price. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782)
repeated ProtoOATrendbar trendbar = 6; // Returns live trend bar. Requires subscription on the trend bars.
optional uint64 sessionClose = 7;// Last session close. Specified in 1/100000 of unit of a price. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782)
optional int64 timestamp = 8; // The Unix time for spot.
}
/** 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.
}
/** Response to the ProtoOASubscribeLiveTrendbarReq request. */
message ProtoOASubscribeLiveTrendbarRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_SUBSCRIBE_LIVE_TRENDBAR_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 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.
}
/** Response to the ProtoOASubscribeLiveTrendbarReq request. */
message ProtoOAUnsubscribeLiveTrendbarRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_UNSUBSCRIBE_LIVE_TRENDBAR_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
/** 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.
optional int64 fromTimestamp = 3; // The Unix time in milliseconds from which the search starts. Must be bigger or equal to zero (1st Jan 1970).
optional int64 toTimestamp = 4; // The Unix time in milliseconds of finishing the search. Smaller or equal to 2147483646000 (19th Jan 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.
optional uint32 count = 7; // Limit number of trend bars in response back from toTimestamp.
}
/** 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.).
optional int64 timestamp = 4 [deprecated = true]; // Simply don't use this field, as your original request already contains toTimestamp.
repeated ProtoOATrendbar trendbar = 5; // The list of trend bars.
optional int64 symbolId = 6; // Unique identifier of the Symbol in cTrader platform.
optional bool hasMore = 7; // 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.
}
/** 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).
optional int64 fromTimestamp = 5; // The Unix time in milliseconds of starting the search. Must be bigger or equal to zero (1st Jan 1970).
optional int64 toTimestamp = 6; // The Unix time in milliseconds of finishing the search. <= 2147483646000 (19th Jan 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 is in chronological order (newest first). The first tick contains Unix time in milliseconds while all subsequent ticks have the time difference in milliseconds between the previous and the current one.
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 ProtoOAAccountLogoutReq request. Actual logout of trading account will be completed on ProtoOAAccountDisconnectEvent. */
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.
}
/** Request for a list of existing margin call thresholds configured for a user. */
message ProtoOAMarginCallListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_LIST_REQ];
required int64 ctidTraderAccountId = 2;
}
/** Response with a list of existing user Margin Calls, usually contains 3 items. */
message ProtoOAMarginCallListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_LIST_RES];
repeated ProtoOAMarginCall marginCall = 2;
}
/** Request to modify marginLevelThreshold of specified marginCallType for ctidTraderAccountId. */
message ProtoOAMarginCallUpdateReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_UPDATE_REQ];
required int64 ctidTraderAccountId = 2;
required ProtoOAMarginCall marginCall = 3;
}
/** If this response received, it means that margin call was successfully updated. */
message ProtoOAMarginCallUpdateRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_UPDATE_RES];
}
/** Event that is sent when a Margin Call threshold configuration is updated. */
message ProtoOAMarginCallUpdateEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_UPDATE_EVENT];
required int64 ctidTraderAccountId = 2;
required ProtoOAMarginCall marginCall = 3;
}
/** Event that is sent when account margin level reaches target marginLevelThreshold. Event is sent no more than once every 10 minutes to avoid spamming. */
message ProtoOAMarginCallTriggerEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_MARGIN_CALL_TRIGGER_EVENT];
required int64 ctidTraderAccountId = 2;
required ProtoOAMarginCall marginCall = 3;
}
/** Request for getting a dynamic leverage entity referenced in ProtoOASymbol.leverageId. */
message ProtoOAGetDynamicLeverageByIDReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_DYNAMIC_LEVERAGE_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 leverageId = 3;
}
/** Response to the ProtoOAGetDynamicLeverageByIDReq request. */
message ProtoOAGetDynamicLeverageByIDRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_DYNAMIC_LEVERAGE_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOADynamicLeverage leverage = 3;
}
/** Request for retrieving the deals related to a position. */
message ProtoOADealListByPositionIdReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_LIST_BY_POSITION_ID_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.
optional int64 fromTimestamp = 4; // The Unix time in milliseconds of starting the search. Must be bigger or equal to zero (1st Jan 1970).
optional int64 toTimestamp = 5; // The Unix time in milliseconds of finishing the search. <= 2147483646000 (19th Jan 2038).
}
/** Response to the ProtoOADealListByPositionIdReq request. */
message ProtoOADealListByPositionIdRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_LIST_BY_POSITION_ID_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 deals.
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.
}
/** Request for getting Order and its related Deals. */
message ProtoOAOrderDetailsReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_DETAILS_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.
}
/** Response to the ProtoOAOrderDetailsReq request. */
message ProtoOAOrderDetailsRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_DETAILS_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required ProtoOAOrder order = 3; // Order details.
repeated ProtoOADeal deal = 4; // All Deals created by filling the specified Order.
}
/** Request for retrieving Orders related to a Position by using Position ID. Filtered by utcLastUpdateTimestamp. */
message ProtoOAOrderListByPositionIdReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_LIST_BY_POSITION_ID_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.
optional int64 fromTimestamp = 4; // The Unix time from which the search starts >=0 (1st Jan 1970). Search by utcLastUpdateTimestamp of the Order.
optional int64 toTimestamp = 5; // The Unix time where to stop searching <= 2147483646000 (19th Jan 2038). Search by utcLastUpdateTimestamp of the Order.
}
/** Response to ProtoOAOrderListByPositionIdReq request. */
message ProtoOAOrderListByPositionIdRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_LIST_BY_POSITION_ID_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAOrder order = 3; // Orders related to the specified Position, sorted by utcLastUpdateTimestamp in descending order (newest first).
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.
}
/** Request for getting sets of Deals that were offset by a specific Deal and that are offsetting the Deal. */
message ProtoOADealOffsetListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_OFFSET_LIST_REQ];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 dealId = 3; // The unique ID of the Deal.
}
/** Response for ProtoOADealOffsetListReq. */
message ProtoOADealOffsetListRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_DEAL_OFFSET_LIST_RES];
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOADealOffset offsetBy = 3; // Deals which closed the specified deal.
repeated ProtoOADealOffset offsetting = 4; // Deals which were closed by the specified deal.
}
/** Request for getting trader's positions' unrealized PnLs. */
message ProtoOAGetPositionUnrealizedPnLReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_POSITION_UNREALIZED_PNL_REQ];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}
/** Response to ProtoOAGetPositionUnrealizedPnLReq request. */
message ProtoOAGetPositionUnrealizedPnLRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_POSITION_UNREALIZED_PNL_RES];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
repeated ProtoOAPositionUnrealizedPnL positionUnrealizedPnL = 3; // Information about trader's positions' unrealized PnLs.
required uint32 moneyDigits = 4; // Specifies the exponent of various monetary values. E.g., moneyDigits = 8 should be interpreted as the value multiplied by 10^8 with the 'real' value equal to 10053099944 / 10^8 = 100.53099944. Affects positionUnrealizedPnL.grossUnrealizedPnL, positionUnrealizedPnL.netUnrealizedPnL.
}
// The event that is sent when the unrealized PnL is changed due to market movement. Requires subscribing to PnL events, see ProtoOAv1PnLChangeSubscribeReq
message ProtoOAv1PnLChangeEvent {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_V1_PNL_CHANGE_EVENT];
required int64 ctidTraderAccountId = 2; //Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 grossUnrealizedPnL = 3; //The gross unrealized PnL denoted in the account deposit currency
required int64 netUnrealizedPnL = 4; //The net unrealized PnL denoted in the account deposit currency
required uint32 moneyDigits = 5; //Specifies the exponent of various monetary values. E.g., moneyDigits = 8 should be interpreted as the value multiplied by 10^8 with the 'real' value equal to 10053099944 / 10^8 = 100.53099944
}
//The request to subscribe to ProtoOAv1PnLChangeEvent
message ProtoOAv1PnLChangeSubscribeReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_V1_PNL_CHANGE_SUBSCRIBE_REQ];
required int64 ctidTraderAccountId = 2; //Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
//The response for ProtoOAv1PnLChangeSubscribeReq
message ProtoOAv1PnLChangeSubscribeRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_V1_PNL_CHANGE_SUBSCRIBE_RES];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}
//The request to stop an existing subscription to PnL events. The subscriber who sends this request will stop receiving ProtoOAv1PnLChangeEvent
message ProtoOAv1PnLChangeUnSubscribeReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_V1_PNL_CHANGE_UN_SUBSCRIBE_REQ];
required int64 ctidTraderAccountId = 2; //Unique identifier of the trader's account. Used to match responses to trader's accounts.
}
//The response for ProtoOAv1PnLChangeUnSubscribeReq
message ProtoOAv1PnLChangeUnSubscribeRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_V1_PNL_CHANGE_UN_SUBSCRIBE_RES];
required int64 ctidTraderAccountId = 2; //Unique identifier of the trader's account. Used to match responses to trader's accounts.
}