ctrader-api-client 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. ctrader_api_client/__init__.py +64 -0
  2. ctrader_api_client/_internal/__init__.py +26 -0
  3. ctrader_api_client/_internal/messages.py +348 -0
  4. ctrader_api_client/_internal/proto/OpenApiCommonMessages.py +42 -0
  5. ctrader_api_client/_internal/proto/OpenApiCommonModelMessages.py +30 -0
  6. ctrader_api_client/_internal/proto/OpenApiMessages.py +1112 -0
  7. ctrader_api_client/_internal/proto/OpenApiModelMessages.py +802 -0
  8. ctrader_api_client/_internal/proto/__init__.py +320 -0
  9. ctrader_api_client/_internal/serialization.py +84 -0
  10. ctrader_api_client/api/__init__.py +21 -0
  11. ctrader_api_client/api/accounts.py +71 -0
  12. ctrader_api_client/api/market_data.py +424 -0
  13. ctrader_api_client/api/symbols.py +171 -0
  14. ctrader_api_client/api/trading.py +506 -0
  15. ctrader_api_client/auth/__init__.py +14 -0
  16. ctrader_api_client/auth/credentials.py +72 -0
  17. ctrader_api_client/auth/manager.py +511 -0
  18. ctrader_api_client/client.py +475 -0
  19. ctrader_api_client/config.py +56 -0
  20. ctrader_api_client/connection/__init__.py +16 -0
  21. ctrader_api_client/connection/heartbeat.py +120 -0
  22. ctrader_api_client/connection/protocol.py +366 -0
  23. ctrader_api_client/connection/transport.py +123 -0
  24. ctrader_api_client/enums.py +138 -0
  25. ctrader_api_client/events/__init__.py +65 -0
  26. ctrader_api_client/events/emitter.py +254 -0
  27. ctrader_api_client/events/router.py +400 -0
  28. ctrader_api_client/events/types.py +340 -0
  29. ctrader_api_client/exceptions.py +231 -0
  30. ctrader_api_client/models/__init__.py +50 -0
  31. ctrader_api_client/models/_base.py +19 -0
  32. ctrader_api_client/models/account.py +177 -0
  33. ctrader_api_client/models/deal.py +242 -0
  34. ctrader_api_client/models/market_data.py +192 -0
  35. ctrader_api_client/models/order.py +262 -0
  36. ctrader_api_client/models/position.py +209 -0
  37. ctrader_api_client/models/requests.py +299 -0
  38. ctrader_api_client/models/symbol.py +194 -0
  39. ctrader_api_client/py.typed +0 -0
  40. ctrader_api_client-0.1.0.dist-info/METADATA +252 -0
  41. ctrader_api_client-0.1.0.dist-info/RECORD +43 -0
  42. ctrader_api_client-0.1.0.dist-info/WHEEL +4 -0
  43. ctrader_api_client-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,802 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # sources: OpenApiModelMessages.proto
3
+ # plugin: python-betterproto
4
+ from dataclasses import dataclass
5
+
6
+ import betterproto
7
+
8
+
9
+ class ProtoOAPayloadType(betterproto.Enum):
10
+ PROTO_OA_APPLICATION_AUTH_REQ = 2100
11
+ PROTO_OA_APPLICATION_AUTH_RES = 2101
12
+ PROTO_OA_ACCOUNT_AUTH_REQ = 2102
13
+ PROTO_OA_ACCOUNT_AUTH_RES = 2103
14
+ PROTO_OA_VERSION_REQ = 2104
15
+ PROTO_OA_VERSION_RES = 2105
16
+ PROTO_OA_NEW_ORDER_REQ = 2106
17
+ PROTO_OA_TRAILING_SL_CHANGED_EVENT = 2107
18
+ PROTO_OA_CANCEL_ORDER_REQ = 2108
19
+ PROTO_OA_AMEND_ORDER_REQ = 2109
20
+ PROTO_OA_AMEND_POSITION_SLTP_REQ = 2110
21
+ PROTO_OA_CLOSE_POSITION_REQ = 2111
22
+ PROTO_OA_ASSET_LIST_REQ = 2112
23
+ PROTO_OA_ASSET_LIST_RES = 2113
24
+ PROTO_OA_SYMBOLS_LIST_REQ = 2114
25
+ PROTO_OA_SYMBOLS_LIST_RES = 2115
26
+ PROTO_OA_SYMBOL_BY_ID_REQ = 2116
27
+ PROTO_OA_SYMBOL_BY_ID_RES = 2117
28
+ PROTO_OA_SYMBOLS_FOR_CONVERSION_REQ = 2118
29
+ PROTO_OA_SYMBOLS_FOR_CONVERSION_RES = 2119
30
+ PROTO_OA_SYMBOL_CHANGED_EVENT = 2120
31
+ PROTO_OA_TRADER_REQ = 2121
32
+ PROTO_OA_TRADER_RES = 2122
33
+ PROTO_OA_TRADER_UPDATE_EVENT = 2123
34
+ PROTO_OA_RECONCILE_REQ = 2124
35
+ PROTO_OA_RECONCILE_RES = 2125
36
+ PROTO_OA_EXECUTION_EVENT = 2126
37
+ PROTO_OA_SUBSCRIBE_SPOTS_REQ = 2127
38
+ PROTO_OA_SUBSCRIBE_SPOTS_RES = 2128
39
+ PROTO_OA_UNSUBSCRIBE_SPOTS_REQ = 2129
40
+ PROTO_OA_UNSUBSCRIBE_SPOTS_RES = 2130
41
+ PROTO_OA_SPOT_EVENT = 2131
42
+ PROTO_OA_ORDER_ERROR_EVENT = 2132
43
+ PROTO_OA_DEAL_LIST_REQ = 2133
44
+ PROTO_OA_DEAL_LIST_RES = 2134
45
+ PROTO_OA_SUBSCRIBE_LIVE_TRENDBAR_REQ = 2135
46
+ PROTO_OA_UNSUBSCRIBE_LIVE_TRENDBAR_REQ = 2136
47
+ PROTO_OA_GET_TRENDBARS_REQ = 2137
48
+ PROTO_OA_GET_TRENDBARS_RES = 2138
49
+ PROTO_OA_EXPECTED_MARGIN_REQ = 2139
50
+ PROTO_OA_EXPECTED_MARGIN_RES = 2140
51
+ PROTO_OA_MARGIN_CHANGED_EVENT = 2141
52
+ PROTO_OA_ERROR_RES = 2142
53
+ PROTO_OA_CASH_FLOW_HISTORY_LIST_REQ = 2143
54
+ PROTO_OA_CASH_FLOW_HISTORY_LIST_RES = 2144
55
+ PROTO_OA_GET_TICKDATA_REQ = 2145
56
+ PROTO_OA_GET_TICKDATA_RES = 2146
57
+ PROTO_OA_ACCOUNTS_TOKEN_INVALIDATED_EVENT = 2147
58
+ PROTO_OA_CLIENT_DISCONNECT_EVENT = 2148
59
+ PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ = 2149
60
+ PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_RES = 2150
61
+ PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_REQ = 2151
62
+ PROTO_OA_GET_CTID_PROFILE_BY_TOKEN_RES = 2152
63
+ PROTO_OA_ASSET_CLASS_LIST_REQ = 2153
64
+ PROTO_OA_ASSET_CLASS_LIST_RES = 2154
65
+ PROTO_OA_DEPTH_EVENT = 2155
66
+ PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_REQ = 2156
67
+ PROTO_OA_SUBSCRIBE_DEPTH_QUOTES_RES = 2157
68
+ PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_REQ = 2158
69
+ PROTO_OA_UNSUBSCRIBE_DEPTH_QUOTES_RES = 2159
70
+ PROTO_OA_SYMBOL_CATEGORY_REQ = 2160
71
+ PROTO_OA_SYMBOL_CATEGORY_RES = 2161
72
+ PROTO_OA_ACCOUNT_LOGOUT_REQ = 2162
73
+ PROTO_OA_ACCOUNT_LOGOUT_RES = 2163
74
+ PROTO_OA_ACCOUNT_DISCONNECT_EVENT = 2164
75
+ PROTO_OA_SUBSCRIBE_LIVE_TRENDBAR_RES = 2165
76
+ PROTO_OA_UNSUBSCRIBE_LIVE_TRENDBAR_RES = 2166
77
+ PROTO_OA_MARGIN_CALL_LIST_REQ = 2167
78
+ PROTO_OA_MARGIN_CALL_LIST_RES = 2168
79
+ PROTO_OA_MARGIN_CALL_UPDATE_REQ = 2169
80
+ PROTO_OA_MARGIN_CALL_UPDATE_RES = 2170
81
+ PROTO_OA_MARGIN_CALL_UPDATE_EVENT = 2171
82
+ PROTO_OA_MARGIN_CALL_TRIGGER_EVENT = 2172
83
+ PROTO_OA_REFRESH_TOKEN_REQ = 2173
84
+ PROTO_OA_REFRESH_TOKEN_RES = 2174
85
+ PROTO_OA_ORDER_LIST_REQ = 2175
86
+ PROTO_OA_ORDER_LIST_RES = 2176
87
+ PROTO_OA_GET_DYNAMIC_LEVERAGE_REQ = 2177
88
+ PROTO_OA_GET_DYNAMIC_LEVERAGE_RES = 2178
89
+ PROTO_OA_DEAL_LIST_BY_POSITION_ID_REQ = 2179
90
+ PROTO_OA_DEAL_LIST_BY_POSITION_ID_RES = 2180
91
+ PROTO_OA_ORDER_DETAILS_REQ = 2181
92
+ PROTO_OA_ORDER_DETAILS_RES = 2182
93
+ PROTO_OA_ORDER_LIST_BY_POSITION_ID_REQ = 2183
94
+ PROTO_OA_ORDER_LIST_BY_POSITION_ID_RES = 2184
95
+ PROTO_OA_DEAL_OFFSET_LIST_REQ = 2185
96
+ PROTO_OA_DEAL_OFFSET_LIST_RES = 2186
97
+ PROTO_OA_GET_POSITION_UNREALIZED_PNL_REQ = 2187
98
+ PROTO_OA_GET_POSITION_UNREALIZED_PNL_RES = 2188
99
+ PROTO_OA_V1_PNL_CHANGE_EVENT = 2189
100
+ PROTO_OA_V1_PNL_CHANGE_SUBSCRIBE_REQ = 2190
101
+ PROTO_OA_V1_PNL_CHANGE_SUBSCRIBE_RES = 2191
102
+ PROTO_OA_V1_PNL_CHANGE_UN_SUBSCRIBE_REQ = 2192
103
+ PROTO_OA_V1_PNL_CHANGE_UN_SUBSCRIBE_RES = 2193
104
+
105
+
106
+ class ProtoOADayOfWeek(betterproto.Enum):
107
+ NONE = 0
108
+ MONDAY = 1
109
+ TUESDAY = 2
110
+ WEDNESDAY = 3
111
+ THURSDAY = 4
112
+ FRIDAY = 5
113
+ SATURDAY = 6
114
+ SUNDAY = 7
115
+
116
+
117
+ class ProtoOACommissionType(betterproto.Enum):
118
+ """* Enum for specifying type of trading commission."""
119
+
120
+ USD_PER_MILLION_USD = 1
121
+ USD_PER_LOT = 2
122
+ PERCENTAGE_OF_VALUE = 3
123
+ QUOTE_CCY_PER_LOT = 4
124
+
125
+
126
+ class ProtoOASymbolDistanceType(betterproto.Enum):
127
+ """* Enum for specifying stop loss and take profit distances."""
128
+
129
+ SYMBOL_DISTANCE_IN_POINTS = 1
130
+ SYMBOL_DISTANCE_IN_PERCENTAGE = 2
131
+
132
+
133
+ class ProtoOAMinCommissionType(betterproto.Enum):
134
+ """* Enum for specifying type of minimum trading commission."""
135
+
136
+ CURRENCY = 1
137
+ QUOTE_CURRENCY = 2
138
+
139
+
140
+ class ProtoOATradingMode(betterproto.Enum):
141
+ """* Enum for specifying symbol trading mode."""
142
+
143
+ ENABLED = 0
144
+ DISABLED_WITHOUT_PENDINGS_EXECUTION = 1
145
+ DISABLED_WITH_PENDINGS_EXECUTION = 2
146
+ CLOSE_ONLY_MODE = 3
147
+
148
+
149
+ class ProtoOASwapCalculationType(betterproto.Enum):
150
+ """* Enum for specifying SWAP calculation type for symbol."""
151
+
152
+ PIPS = 0
153
+ PERCENTAGE = 1
154
+ POINTS = 2
155
+
156
+
157
+ class ProtoOAAccessRights(betterproto.Enum):
158
+ """* Enum for specifying access right for a trader."""
159
+
160
+ FULL_ACCESS = 0
161
+ CLOSE_ONLY = 1
162
+ NO_TRADING = 2
163
+ NO_LOGIN = 3
164
+
165
+
166
+ class ProtoOATotalMarginCalculationType(betterproto.Enum):
167
+ """* Enum for specifying margin calculation type for an account."""
168
+
169
+ MAX = 0
170
+ SUM = 1
171
+ NET = 2
172
+
173
+
174
+ class ProtoOAAccountType(betterproto.Enum):
175
+ """* Enum for specifying type of an account."""
176
+
177
+ HEDGED = 0
178
+ NETTED = 1
179
+ SPREAD_BETTING = 2
180
+
181
+
182
+ class ProtoOAPositionStatus(betterproto.Enum):
183
+ """* Position status ENUM."""
184
+
185
+ POSITION_STATUS_OPEN = 1
186
+ POSITION_STATUS_CLOSED = 2
187
+ POSITION_STATUS_CREATED = 3
188
+ POSITION_STATUS_ERROR = 4
189
+
190
+
191
+ class ProtoOATradeSide(betterproto.Enum):
192
+ """* Trader side ENUM. Used for order, position, deal."""
193
+
194
+ BUY = 1
195
+ SELL = 2
196
+
197
+
198
+ class ProtoOAOrderType(betterproto.Enum):
199
+ """* Order type ENUM."""
200
+
201
+ MARKET = 1
202
+ LIMIT = 2
203
+ STOP = 3
204
+ STOP_LOSS_TAKE_PROFIT = 4
205
+ MARKET_RANGE = 5
206
+ STOP_LIMIT = 6
207
+
208
+
209
+ class ProtoOATimeInForce(betterproto.Enum):
210
+ """* Order's time in force ENUM."""
211
+
212
+ GOOD_TILL_DATE = 1
213
+ GOOD_TILL_CANCEL = 2
214
+ IMMEDIATE_OR_CANCEL = 3
215
+ FILL_OR_KILL = 4
216
+ MARKET_ON_OPEN = 5
217
+
218
+
219
+ class ProtoOAOrderStatus(betterproto.Enum):
220
+ """* Order status ENUM."""
221
+
222
+ ORDER_STATUS_ACCEPTED = 1
223
+ ORDER_STATUS_FILLED = 2
224
+ ORDER_STATUS_REJECTED = 3
225
+ ORDER_STATUS_EXPIRED = 4
226
+ ORDER_STATUS_CANCELLED = 5
227
+
228
+
229
+ class ProtoOAOrderTriggerMethod(betterproto.Enum):
230
+ """* Stop Order and Stop Lost triggering method ENUM."""
231
+
232
+ TRADE = 1
233
+ OPPOSITE = 2
234
+ DOUBLE_TRADE = 3
235
+ DOUBLE_OPPOSITE = 4
236
+
237
+
238
+ class ProtoOAExecutionType(betterproto.Enum):
239
+ """* Execution event type ENUM."""
240
+
241
+ ORDER_ACCEPTED = 2
242
+ ORDER_FILLED = 3
243
+ ORDER_REPLACED = 4
244
+ ORDER_CANCELLED = 5
245
+ ORDER_EXPIRED = 6
246
+ ORDER_REJECTED = 7
247
+ ORDER_CANCEL_REJECTED = 8
248
+ SWAP = 9
249
+ DEPOSIT_WITHDRAW = 10
250
+ ORDER_PARTIAL_FILL = 11
251
+ BONUS_DEPOSIT_WITHDRAW = 12
252
+
253
+
254
+ class ProtoOAChangeBonusType(betterproto.Enum):
255
+ """* Bonus operation type ENUM."""
256
+
257
+ BONUS_DEPOSIT = 0
258
+ BONUS_WITHDRAW = 1
259
+
260
+
261
+ class ProtoOAChangeBalanceType(betterproto.Enum):
262
+ """
263
+ * Balance operation entity. Covers all cash movement operations related to
264
+ account, trading, IB operations, mirroring, etc.
265
+ """
266
+
267
+ BALANCE_DEPOSIT = 0
268
+ BALANCE_WITHDRAW = 1
269
+ BALANCE_DEPOSIT_STRATEGY_COMMISSION_INNER = 3
270
+ BALANCE_WITHDRAW_STRATEGY_COMMISSION_INNER = 4
271
+ BALANCE_DEPOSIT_IB_COMMISSIONS = 5
272
+ BALANCE_WITHDRAW_IB_SHARED_PERCENTAGE = 6
273
+ BALANCE_DEPOSIT_IB_SHARED_PERCENTAGE_FROM_SUB_IB = 7
274
+ BALANCE_DEPOSIT_IB_SHARED_PERCENTAGE_FROM_BROKER = 8
275
+ BALANCE_DEPOSIT_REBATE = 9
276
+ BALANCE_WITHDRAW_REBATE = 10
277
+ BALANCE_DEPOSIT_STRATEGY_COMMISSION_OUTER = 11
278
+ BALANCE_WITHDRAW_STRATEGY_COMMISSION_OUTER = 12
279
+ BALANCE_WITHDRAW_BONUS_COMPENSATION = 13
280
+ BALANCE_WITHDRAW_IB_SHARED_PERCENTAGE_TO_BROKER = 14
281
+ BALANCE_DEPOSIT_DIVIDENDS = 15
282
+ BALANCE_WITHDRAW_DIVIDENDS = 16
283
+ BALANCE_WITHDRAW_GSL_CHARGE = 17
284
+ BALANCE_WITHDRAW_ROLLOVER = 18
285
+ BALANCE_DEPOSIT_NONWITHDRAWABLE_BONUS = 19
286
+ BALANCE_WITHDRAW_NONWITHDRAWABLE_BONUS = 20
287
+ BALANCE_DEPOSIT_SWAP = 21
288
+ BALANCE_WITHDRAW_SWAP = 22
289
+ BALANCE_DEPOSIT_MANAGEMENT_FEE = 27
290
+ BALANCE_WITHDRAW_MANAGEMENT_FEE = 28
291
+ BALANCE_DEPOSIT_PERFORMANCE_FEE = 29
292
+ BALANCE_WITHDRAW_FOR_SUBACCOUNT = 30
293
+ BALANCE_DEPOSIT_TO_SUBACCOUNT = 31
294
+ BALANCE_WITHDRAW_FROM_SUBACCOUNT = 32
295
+ BALANCE_DEPOSIT_FROM_SUBACCOUNT = 33
296
+ BALANCE_WITHDRAW_COPY_FEE = 34
297
+ BALANCE_WITHDRAW_INACTIVITY_FEE = 35
298
+ BALANCE_DEPOSIT_TRANSFER = 36
299
+ BALANCE_WITHDRAW_TRANSFER = 37
300
+ BALANCE_DEPOSIT_CONVERTED_BONUS = 38
301
+ BALANCE_DEPOSIT_NEGATIVE_BALANCE_PROTECTION = 39
302
+
303
+
304
+ class ProtoOADealStatus(betterproto.Enum):
305
+ """* Deal status ENUM."""
306
+
307
+ FILLED = 2
308
+ PARTIALLY_FILLED = 3
309
+ REJECTED = 4
310
+ INTERNALLY_REJECTED = 5
311
+ ERROR = 6
312
+ MISSED = 7
313
+
314
+
315
+ class ProtoOATrendbarPeriod(betterproto.Enum):
316
+ """* Trendbar period ENUM."""
317
+
318
+ M1 = 1
319
+ M2 = 2
320
+ M3 = 3
321
+ M4 = 4
322
+ M5 = 5
323
+ M10 = 6
324
+ M15 = 7
325
+ M30 = 8
326
+ H1 = 9
327
+ H4 = 10
328
+ H12 = 11
329
+ D1 = 12
330
+ W1 = 13
331
+ MN1 = 14
332
+
333
+
334
+ class ProtoOAQuoteType(betterproto.Enum):
335
+ """* Price quote type."""
336
+
337
+ BID = 1
338
+ ASK = 2
339
+
340
+
341
+ class ProtoOAClientPermissionScope(betterproto.Enum):
342
+ """* Open API application permission in regards to token ENUM."""
343
+
344
+ SCOPE_VIEW = 0
345
+ SCOPE_TRADE = 1
346
+
347
+
348
+ class ProtoOANotificationType(betterproto.Enum):
349
+ """
350
+ * Type of notification, currently only 3 instances of marginCall are
351
+ supported.
352
+ """
353
+
354
+ MARGIN_LEVEL_THRESHOLD_1 = 61
355
+ MARGIN_LEVEL_THRESHOLD_2 = 62
356
+ MARGIN_LEVEL_THRESHOLD_3 = 63
357
+
358
+
359
+ class ProtoOAErrorCode(betterproto.Enum):
360
+ """* Error code ENUM."""
361
+
362
+ # Authorization
363
+ OA_AUTH_TOKEN_EXPIRED = 1
364
+ ACCOUNT_NOT_AUTHORIZED = 2
365
+ RET_NO_SUCH_LOGIN = 12
366
+ ALREADY_LOGGED_IN = 14
367
+ RET_ACCOUNT_DISABLED = 64
368
+ CH_CLIENT_AUTH_FAILURE = 101
369
+ CH_CLIENT_NOT_AUTHENTICATED = 102
370
+ CH_CLIENT_ALREADY_AUTHENTICATED = 103
371
+ CH_ACCESS_TOKEN_INVALID = 104
372
+ CH_SERVER_NOT_REACHABLE = 105
373
+ CH_CTID_TRADER_ACCOUNT_NOT_FOUND = 106
374
+ CH_OA_CLIENT_NOT_FOUND = 107
375
+ # General
376
+ REQUEST_FREQUENCY_EXCEEDED = 108
377
+ SERVER_IS_UNDER_MAINTENANCE = 109
378
+ CHANNEL_IS_BLOCKED = 110
379
+ CONNECTIONS_LIMIT_EXCEEDED = 67
380
+ WORSE_GSL_NOT_ALLOWED = 68
381
+ SYMBOL_HAS_HOLIDAY = 69
382
+ # Pricing
383
+ NOT_SUBSCRIBED_TO_SPOTS = 112
384
+ ALREADY_SUBSCRIBED = 113
385
+ SYMBOL_NOT_FOUND = 114
386
+ UNKNOWN_SYMBOL = 115
387
+ INCORRECT_BOUNDARIES = 35
388
+ # Trading
389
+ NO_QUOTES = 117
390
+ NOT_ENOUGH_MONEY = 118
391
+ MAX_EXPOSURE_REACHED = 119
392
+ POSITION_NOT_FOUND = 120
393
+ ORDER_NOT_FOUND = 121
394
+ POSITION_NOT_OPEN = 122
395
+ POSITION_LOCKED = 123
396
+ TOO_MANY_POSITIONS = 124
397
+ TRADING_BAD_VOLUME = 125
398
+ TRADING_BAD_STOPS = 126
399
+ TRADING_BAD_PRICES = 127
400
+ TRADING_BAD_STAKE = 128
401
+ PROTECTION_IS_TOO_CLOSE_TO_MARKET = 129
402
+ TRADING_BAD_EXPIRATION_DATE = 130
403
+ PENDING_EXECUTION = 131
404
+ TRADING_DISABLED = 132
405
+ TRADING_NOT_ALLOWED = 133
406
+ UNABLE_TO_CANCEL_ORDER = 134
407
+ UNABLE_TO_AMEND_ORDER = 135
408
+ SHORT_SELLING_NOT_ALLOWED = 136
409
+ NOT_SUBSCRIBED_TO_PNL = 137
410
+
411
+
412
+ class ProtoOALimitedRiskMarginCalculationStrategy(betterproto.Enum):
413
+ ACCORDING_TO_LEVERAGE = 0
414
+ ACCORDING_TO_GSL = 1
415
+ ACCORDING_TO_GSL_AND_LEVERAGE = 2
416
+
417
+
418
+ class ProtoOAStopOutStrategy(betterproto.Enum):
419
+ MOST_MARGIN_USED_FIRST = 0
420
+ MOST_LOSING_FIRST = 1
421
+
422
+
423
+ @dataclass
424
+ class ProtoOAAsset(betterproto.Message):
425
+ """* Asset entity."""
426
+
427
+ asset_id: int = betterproto.int64_field(1)
428
+ name: str = betterproto.string_field(2)
429
+ display_name: str = betterproto.string_field(3)
430
+ digits: int = betterproto.int32_field(4)
431
+
432
+
433
+ @dataclass
434
+ class ProtoOASymbol(betterproto.Message):
435
+ """* Trading symbol entity."""
436
+
437
+ symbol_id: int = betterproto.int64_field(1)
438
+ digits: int = betterproto.int32_field(2)
439
+ pip_position: int = betterproto.int32_field(3)
440
+ enable_short_selling: bool = betterproto.bool_field(4)
441
+ guaranteed_stop_loss: bool = betterproto.bool_field(5)
442
+ swap_rollover3_days: "ProtoOADayOfWeek" = betterproto.enum_field(6)
443
+ swap_long: float = betterproto.double_field(7)
444
+ swap_short: float = betterproto.double_field(8)
445
+ max_volume: int = betterproto.int64_field(9)
446
+ min_volume: int = betterproto.int64_field(10)
447
+ step_volume: int = betterproto.int64_field(11)
448
+ max_exposure: int = betterproto.uint64_field(12)
449
+ schedule: list["ProtoOAInterval"] = betterproto.message_field(13)
450
+ commission: int = betterproto.int64_field(14)
451
+ commission_type: "ProtoOACommissionType" = betterproto.enum_field(15)
452
+ sl_distance: int = betterproto.uint32_field(16)
453
+ tp_distance: int = betterproto.uint32_field(17)
454
+ gsl_distance: int = betterproto.uint32_field(18)
455
+ gsl_charge: int = betterproto.int64_field(19)
456
+ distance_set_in: "ProtoOASymbolDistanceType" = betterproto.enum_field(20)
457
+ min_commission: int = betterproto.int64_field(21)
458
+ min_commission_type: "ProtoOAMinCommissionType" = betterproto.enum_field(22)
459
+ min_commission_asset: str = betterproto.string_field(23)
460
+ rollover_commission: int = betterproto.int64_field(24)
461
+ skip_rollover_days: int = betterproto.int32_field(25)
462
+ schedule_time_zone: str = betterproto.string_field(26)
463
+ trading_mode: "ProtoOATradingMode" = betterproto.enum_field(27)
464
+ rollover_commission3_days: "ProtoOADayOfWeek" = betterproto.enum_field(28)
465
+ swap_calculation_type: "ProtoOASwapCalculationType" = betterproto.enum_field(29)
466
+ lot_size: int = betterproto.int64_field(30)
467
+ precise_trading_commission_rate: int = betterproto.int64_field(31)
468
+ precise_min_commission: int = betterproto.int64_field(32)
469
+ holiday: list["ProtoOAHoliday"] = betterproto.message_field(33)
470
+ pnl_conversion_fee_rate: int = betterproto.int32_field(34)
471
+ leverage_id: int = betterproto.int64_field(35)
472
+ swap_period: int = betterproto.int32_field(36)
473
+ swap_time: int = betterproto.int32_field(37)
474
+ skip_s_w_a_p_periods: int = betterproto.int32_field(38)
475
+ charge_swap_at_weekends: bool = betterproto.bool_field(39)
476
+ measurement_units: str = betterproto.string_field(40)
477
+
478
+
479
+ @dataclass
480
+ class ProtoOALightSymbol(betterproto.Message):
481
+ """* Lightweight symbol entity."""
482
+
483
+ symbol_id: int = betterproto.int64_field(1)
484
+ symbol_name: str = betterproto.string_field(2)
485
+ enabled: bool = betterproto.bool_field(3)
486
+ base_asset_id: int = betterproto.int64_field(4)
487
+ quote_asset_id: int = betterproto.int64_field(5)
488
+ symbol_category_id: int = betterproto.int64_field(6)
489
+ description: str = betterproto.string_field(7)
490
+ sorting_number: float = betterproto.double_field(8)
491
+
492
+
493
+ @dataclass
494
+ class ProtoOAArchivedSymbol(betterproto.Message):
495
+ symbol_id: int = betterproto.int64_field(1)
496
+ name: str = betterproto.string_field(2)
497
+ utc_last_update_timestamp: int = betterproto.int64_field(3)
498
+ description: str = betterproto.string_field(4)
499
+
500
+
501
+ @dataclass
502
+ class ProtoOASymbolCategory(betterproto.Message):
503
+ """* Symbol category entity."""
504
+
505
+ id: int = betterproto.int64_field(1)
506
+ asset_class_id: int = betterproto.int64_field(2)
507
+ name: str = betterproto.string_field(3)
508
+ sorting_number: float = betterproto.double_field(4)
509
+
510
+
511
+ @dataclass
512
+ class ProtoOAInterval(betterproto.Message):
513
+ """* Symbol trading session entity."""
514
+
515
+ start_second: int = betterproto.uint32_field(3)
516
+ end_second: int = betterproto.uint32_field(4)
517
+
518
+
519
+ @dataclass
520
+ class ProtoOATrader(betterproto.Message):
521
+ """* Trading account entity."""
522
+
523
+ ctid_trader_account_id: int = betterproto.int64_field(1)
524
+ balance: int = betterproto.int64_field(2)
525
+ balance_version: int = betterproto.int64_field(3)
526
+ manager_bonus: int = betterproto.int64_field(4)
527
+ ib_bonus: int = betterproto.int64_field(5)
528
+ non_withdrawable_bonus: int = betterproto.int64_field(6)
529
+ access_rights: "ProtoOAAccessRights" = betterproto.enum_field(7)
530
+ deposit_asset_id: int = betterproto.int64_field(8)
531
+ swap_free: bool = betterproto.bool_field(9)
532
+ leverage_in_cents: int = betterproto.uint32_field(10)
533
+ total_margin_calculation_type: "ProtoOATotalMarginCalculationType" = betterproto.enum_field(11)
534
+ max_leverage: int = betterproto.uint32_field(12)
535
+ french_risk: bool = betterproto.bool_field(13)
536
+ trader_login: int = betterproto.int64_field(14)
537
+ account_type: "ProtoOAAccountType" = betterproto.enum_field(15)
538
+ broker_name: str = betterproto.string_field(16)
539
+ registration_timestamp: int = betterproto.int64_field(17)
540
+ is_limited_risk: bool = betterproto.bool_field(18)
541
+ limited_risk_margin_calculation_strategy: "ProtoOALimitedRiskMarginCalculationStrategy" = betterproto.enum_field(19)
542
+ money_digits: int = betterproto.uint32_field(20)
543
+ fair_stop_out: bool = betterproto.bool_field(21)
544
+ stop_out_strategy: "ProtoOAStopOutStrategy" = betterproto.enum_field(22)
545
+
546
+
547
+ @dataclass
548
+ class ProtoOAPosition(betterproto.Message):
549
+ """* Trade position entity."""
550
+
551
+ position_id: int = betterproto.int64_field(1)
552
+ trade_data: "ProtoOATradeData" = betterproto.message_field(2)
553
+ position_status: "ProtoOAPositionStatus" = betterproto.enum_field(3)
554
+ swap: int = betterproto.int64_field(4)
555
+ price: float = betterproto.double_field(5)
556
+ stop_loss: float = betterproto.double_field(6)
557
+ take_profit: float = betterproto.double_field(7)
558
+ utc_last_update_timestamp: int = betterproto.int64_field(8)
559
+ commission: int = betterproto.int64_field(9)
560
+ margin_rate: float = betterproto.double_field(10)
561
+ mirroring_commission: int = betterproto.int64_field(11)
562
+ guaranteed_stop_loss: bool = betterproto.bool_field(12)
563
+ used_margin: int = betterproto.uint64_field(13)
564
+ stop_loss_trigger_method: "ProtoOAOrderTriggerMethod" = betterproto.enum_field(14)
565
+ money_digits: int = betterproto.uint32_field(15)
566
+ trailing_stop_loss: bool = betterproto.bool_field(16)
567
+
568
+
569
+ @dataclass
570
+ class ProtoOATradeData(betterproto.Message):
571
+ """* Position/order trading details entity."""
572
+
573
+ symbol_id: int = betterproto.int64_field(1)
574
+ volume: int = betterproto.int64_field(2)
575
+ trade_side: "ProtoOATradeSide" = betterproto.enum_field(3)
576
+ open_timestamp: int = betterproto.int64_field(4)
577
+ label: str = betterproto.string_field(5)
578
+ guaranteed_stop_loss: bool = betterproto.bool_field(6)
579
+ comment: str = betterproto.string_field(7)
580
+ measurement_units: str = betterproto.string_field(8)
581
+ close_timestamp: int = betterproto.uint64_field(9)
582
+
583
+
584
+ @dataclass
585
+ class ProtoOAOrder(betterproto.Message):
586
+ """* Trade order entity."""
587
+
588
+ order_id: int = betterproto.int64_field(1)
589
+ trade_data: "ProtoOATradeData" = betterproto.message_field(2)
590
+ order_type: "ProtoOAOrderType" = betterproto.enum_field(3)
591
+ order_status: "ProtoOAOrderStatus" = betterproto.enum_field(4)
592
+ expiration_timestamp: int = betterproto.int64_field(6)
593
+ execution_price: float = betterproto.double_field(7)
594
+ executed_volume: int = betterproto.int64_field(8)
595
+ utc_last_update_timestamp: int = betterproto.int64_field(9)
596
+ base_slippage_price: float = betterproto.double_field(10)
597
+ slippage_in_points: int = betterproto.int64_field(11)
598
+ closing_order: bool = betterproto.bool_field(12)
599
+ limit_price: float = betterproto.double_field(13)
600
+ stop_price: float = betterproto.double_field(14)
601
+ stop_loss: float = betterproto.double_field(15)
602
+ take_profit: float = betterproto.double_field(16)
603
+ client_order_id: str = betterproto.string_field(17)
604
+ time_in_force: "ProtoOATimeInForce" = betterproto.enum_field(18)
605
+ position_id: int = betterproto.int64_field(19)
606
+ relative_stop_loss: int = betterproto.int64_field(20)
607
+ relative_take_profit: int = betterproto.int64_field(21)
608
+ is_stop_out: bool = betterproto.bool_field(22)
609
+ trailing_stop_loss: bool = betterproto.bool_field(23)
610
+ stop_trigger_method: "ProtoOAOrderTriggerMethod" = betterproto.enum_field(24)
611
+
612
+
613
+ @dataclass
614
+ class ProtoOABonusDepositWithdraw(betterproto.Message):
615
+ """* Bonus deposit/withdrawal entity."""
616
+
617
+ operation_type: "ProtoOAChangeBonusType" = betterproto.enum_field(1)
618
+ bonus_history_id: int = betterproto.int64_field(2)
619
+ manager_bonus: int = betterproto.int64_field(3)
620
+ manager_delta: int = betterproto.int64_field(4)
621
+ ib_bonus: int = betterproto.int64_field(5)
622
+ ib_delta: int = betterproto.int64_field(6)
623
+ change_bonus_timestamp: int = betterproto.int64_field(7)
624
+ external_note: str = betterproto.string_field(8)
625
+ introducing_broker_id: int = betterproto.int64_field(9)
626
+ money_digits: int = betterproto.uint32_field(10)
627
+
628
+
629
+ @dataclass
630
+ class ProtoOADepositWithdraw(betterproto.Message):
631
+ """* Account deposit/withdrawal operation entity."""
632
+
633
+ operation_type: "ProtoOAChangeBalanceType" = betterproto.enum_field(1)
634
+ balance_history_id: int = betterproto.int64_field(2)
635
+ balance: int = betterproto.int64_field(3)
636
+ delta: int = betterproto.int64_field(4)
637
+ change_balance_timestamp: int = betterproto.int64_field(5)
638
+ external_note: str = betterproto.string_field(6)
639
+ balance_version: int = betterproto.int64_field(7)
640
+ equity: int = betterproto.int64_field(8)
641
+ money_digits: int = betterproto.uint32_field(9)
642
+
643
+
644
+ @dataclass
645
+ class ProtoOADeal(betterproto.Message):
646
+ """* Execution entity."""
647
+
648
+ deal_id: int = betterproto.int64_field(1)
649
+ order_id: int = betterproto.int64_field(2)
650
+ position_id: int = betterproto.int64_field(3)
651
+ volume: int = betterproto.int64_field(4)
652
+ filled_volume: int = betterproto.int64_field(5)
653
+ symbol_id: int = betterproto.int64_field(6)
654
+ create_timestamp: int = betterproto.int64_field(7)
655
+ execution_timestamp: int = betterproto.int64_field(8)
656
+ utc_last_update_timestamp: int = betterproto.int64_field(9)
657
+ execution_price: float = betterproto.double_field(10)
658
+ trade_side: "ProtoOATradeSide" = betterproto.enum_field(11)
659
+ deal_status: "ProtoOADealStatus" = betterproto.enum_field(12)
660
+ margin_rate: float = betterproto.double_field(13)
661
+ commission: int = betterproto.int64_field(14)
662
+ base_to_usd_conversion_rate: float = betterproto.double_field(15)
663
+ close_position_detail: "ProtoOAClosePositionDetail" = betterproto.message_field(16)
664
+ money_digits: int = betterproto.uint32_field(17)
665
+
666
+
667
+ @dataclass
668
+ class ProtoOADealOffset(betterproto.Message):
669
+ """* Deal details for ProtoOADealOffsetListReq."""
670
+
671
+ deal_id: int = betterproto.int64_field(1)
672
+ volume: int = betterproto.int64_field(2)
673
+ execution_timestamp: int = betterproto.int64_field(3)
674
+ execution_price: float = betterproto.double_field(4)
675
+
676
+
677
+ @dataclass
678
+ class ProtoOAClosePositionDetail(betterproto.Message):
679
+ """* Trading details for closing deal."""
680
+
681
+ entry_price: float = betterproto.double_field(1)
682
+ gross_profit: int = betterproto.int64_field(2)
683
+ swap: int = betterproto.int64_field(3)
684
+ commission: int = betterproto.int64_field(4)
685
+ balance: int = betterproto.int64_field(5)
686
+ quote_to_deposit_conversion_rate: float = betterproto.double_field(6)
687
+ closed_volume: int = betterproto.int64_field(7)
688
+ balance_version: int = betterproto.int64_field(8)
689
+ money_digits: int = betterproto.uint32_field(9)
690
+ pnl_conversion_fee: int = betterproto.int64_field(10)
691
+
692
+
693
+ @dataclass
694
+ class ProtoOATrendbar(betterproto.Message):
695
+ """* Historical Trendbar entity."""
696
+
697
+ volume: int = betterproto.int64_field(3)
698
+ period: "ProtoOATrendbarPeriod" = betterproto.enum_field(4)
699
+ low: int = betterproto.int64_field(5)
700
+ delta_open: int = betterproto.uint64_field(6)
701
+ delta_close: int = betterproto.uint64_field(7)
702
+ delta_high: int = betterproto.uint64_field(8)
703
+ utc_timestamp_in_minutes: int = betterproto.uint32_field(9)
704
+
705
+
706
+ @dataclass
707
+ class ProtoOAExpectedMargin(betterproto.Message):
708
+ """* Expected margin computation entity."""
709
+
710
+ volume: int = betterproto.int64_field(1)
711
+ buy_margin: int = betterproto.int64_field(2)
712
+ sell_margin: int = betterproto.int64_field(3)
713
+
714
+
715
+ @dataclass
716
+ class ProtoOATickData(betterproto.Message):
717
+ """* Historical tick data type."""
718
+
719
+ timestamp: int = betterproto.int64_field(1)
720
+ tick: int = betterproto.int64_field(2)
721
+
722
+
723
+ @dataclass
724
+ class ProtoOACtidProfile(betterproto.Message):
725
+ """* Trader profile entity. Empty due to GDPR."""
726
+
727
+ user_id: int = betterproto.int64_field(1)
728
+
729
+
730
+ @dataclass
731
+ class ProtoOACtidTraderAccount(betterproto.Message):
732
+ """* Trader account entity."""
733
+
734
+ ctid_trader_account_id: int = betterproto.uint64_field(1)
735
+ is_live: bool = betterproto.bool_field(2)
736
+ trader_login: int = betterproto.int64_field(3)
737
+ last_closing_deal_timestamp: int = betterproto.int64_field(4)
738
+ last_balance_update_timestamp: int = betterproto.int64_field(5)
739
+ broker_title_short: str = betterproto.string_field(6)
740
+
741
+
742
+ @dataclass
743
+ class ProtoOAAssetClass(betterproto.Message):
744
+ """* Asset class entity."""
745
+
746
+ id: int = betterproto.int64_field(1)
747
+ name: str = betterproto.string_field(2)
748
+ sorting_number: float = betterproto.double_field(3)
749
+
750
+
751
+ @dataclass
752
+ class ProtoOADepthQuote(betterproto.Message):
753
+ """* Depth of market entity."""
754
+
755
+ id: int = betterproto.uint64_field(1)
756
+ size: int = betterproto.uint64_field(3)
757
+ bid: int = betterproto.uint64_field(4)
758
+ ask: int = betterproto.uint64_field(5)
759
+
760
+
761
+ @dataclass
762
+ class ProtoOAMarginCall(betterproto.Message):
763
+ """
764
+ * Margin call entity, specifies threshold for exact margin call type. Only
765
+ 3 instances of margin calls are supported, identified by marginCallType.
766
+ See ProtoOANotificationType for details.
767
+ """
768
+
769
+ margin_call_type: "ProtoOANotificationType" = betterproto.enum_field(1)
770
+ margin_level_threshold: float = betterproto.double_field(2)
771
+ utc_last_update_timestamp: int = betterproto.int64_field(3)
772
+
773
+
774
+ @dataclass
775
+ class ProtoOAHoliday(betterproto.Message):
776
+ holiday_id: int = betterproto.int64_field(1)
777
+ name: str = betterproto.string_field(2)
778
+ description: str = betterproto.string_field(3)
779
+ schedule_time_zone: str = betterproto.string_field(4)
780
+ holiday_date: int = betterproto.int64_field(5)
781
+ is_recurring: bool = betterproto.bool_field(6)
782
+ start_second: int = betterproto.int32_field(7)
783
+ end_second: int = betterproto.int32_field(8)
784
+
785
+
786
+ @dataclass
787
+ class ProtoOADynamicLeverage(betterproto.Message):
788
+ leverage_id: int = betterproto.int64_field(1)
789
+ tiers: list["ProtoOADynamicLeverageTier"] = betterproto.message_field(2)
790
+
791
+
792
+ @dataclass
793
+ class ProtoOADynamicLeverageTier(betterproto.Message):
794
+ volume: int = betterproto.int64_field(1)
795
+ leverage: int = betterproto.int32_field(2)
796
+
797
+
798
+ @dataclass
799
+ class ProtoOAPositionUnrealizedPnL(betterproto.Message):
800
+ position_id: int = betterproto.int64_field(1)
801
+ gross_unrealized_pn_l: int = betterproto.int64_field(2)
802
+ net_unrealized_pn_l: int = betterproto.int64_field(3)