PyAlgoEngine 0.12.3__cp315-cp315-win_amd64.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 (156) hide show
  1. algo_engine/__infra__.pxd +3 -0
  2. algo_engine/__init__.pxd +3 -0
  3. algo_engine/__init__.py +107 -0
  4. algo_engine/apps/__init__.py +17 -0
  5. algo_engine/apps/backtest/__init__.py +20 -0
  6. algo_engine/apps/backtest/doc_server.py +328 -0
  7. algo_engine/apps/backtest/static/styles/dash.css +48 -0
  8. algo_engine/apps/backtest/templates/dash.html +20 -0
  9. algo_engine/apps/backtest/templates/index.html +40 -0
  10. algo_engine/apps/backtest/tester.py +252 -0
  11. algo_engine/apps/backtest/web_app.py +125 -0
  12. algo_engine/apps/bokeh_server.py +245 -0
  13. algo_engine/apps/demo/__init__.py +0 -0
  14. algo_engine/apps/demo/test.py +40 -0
  15. algo_engine/apps/sim_input/__init__.py +23 -0
  16. algo_engine/apps/sim_input/client.py +412 -0
  17. algo_engine/apps/sim_input/sim_keyboard.py +88 -0
  18. algo_engine/apps/sim_input/sim_mouse.py +137 -0
  19. algo_engine/apps/sim_input/window.py +162 -0
  20. algo_engine/backtest/__init__.py +19 -0
  21. algo_engine/backtest/__main__.py +51 -0
  22. algo_engine/backtest/metrics.py +179 -0
  23. algo_engine/backtest/replay.py +635 -0
  24. algo_engine/backtest/sim_match.py +506 -0
  25. algo_engine/base/__infra__.pxd +3 -0
  26. algo_engine/base/__init__.pxd +3 -0
  27. algo_engine/base/__init__.py +60 -0
  28. algo_engine/base/c_allocator_protocol.c +11608 -0
  29. algo_engine/base/c_allocator_protocol.cp315-win_amd64.pyd +0 -0
  30. algo_engine/base/c_allocator_protocol.pxd +24 -0
  31. algo_engine/base/c_allocator_protocol.pyi +68 -0
  32. algo_engine/base/c_allocator_protocol.pyx +111 -0
  33. algo_engine/base/c_intern_string.c +5908 -0
  34. algo_engine/base/c_intern_string.cp315-win_amd64.pyd +0 -0
  35. algo_engine/base/c_intern_string.pxd +14 -0
  36. algo_engine/base/c_intern_string.pyi +22 -0
  37. algo_engine/base/c_intern_string.pyx +17 -0
  38. algo_engine/base/c_market_data/__infra__.pxd +196 -0
  39. algo_engine/base/c_market_data/__init__.pxd +196 -0
  40. algo_engine/base/c_market_data/__init__.py +24 -0
  41. algo_engine/base/c_market_data/c_candlestick.c +18996 -0
  42. algo_engine/base/c_market_data/c_candlestick.cp315-win_amd64.pyd +0 -0
  43. algo_engine/base/c_market_data/c_candlestick.pxd +27 -0
  44. algo_engine/base/c_market_data/c_candlestick.pyi +217 -0
  45. algo_engine/base/c_market_data/c_candlestick.pyx +255 -0
  46. algo_engine/base/c_market_data/c_internal.c +14059 -0
  47. algo_engine/base/c_market_data/c_internal.cp315-win_amd64.pyd +0 -0
  48. algo_engine/base/c_market_data/c_internal.pxd +14 -0
  49. algo_engine/base/c_market_data/c_internal.pyi +47 -0
  50. algo_engine/base/c_market_data/c_internal.pyx +41 -0
  51. algo_engine/base/c_market_data/c_market_data.c +30420 -0
  52. algo_engine/base/c_market_data/c_market_data.cp315-win_amd64.pyd +0 -0
  53. algo_engine/base/c_market_data/c_market_data.h +1464 -0
  54. algo_engine/base/c_market_data/c_market_data.pxd +414 -0
  55. algo_engine/base/c_market_data/c_market_data.pyi +550 -0
  56. algo_engine/base/c_market_data/c_market_data.pyx +701 -0
  57. algo_engine/base/c_market_data/c_market_data_buffer.c +29407 -0
  58. algo_engine/base/c_market_data/c_market_data_buffer.cp315-win_amd64.pyd +0 -0
  59. algo_engine/base/c_market_data/c_market_data_buffer.h +941 -0
  60. algo_engine/base/c_market_data/c_market_data_buffer.pxd +143 -0
  61. algo_engine/base/c_market_data/c_market_data_buffer.pyi +355 -0
  62. algo_engine/base/c_market_data/c_market_data_buffer.pyx +571 -0
  63. algo_engine/base/c_market_data/c_market_data_config.h +29 -0
  64. algo_engine/base/c_market_data/c_tick.c +44303 -0
  65. algo_engine/base/c_market_data/c_tick.cp315-win_amd64.pyd +0 -0
  66. algo_engine/base/c_market_data/c_tick.pxd +53 -0
  67. algo_engine/base/c_market_data/c_tick.pyi +466 -0
  68. algo_engine/base/c_market_data/c_tick.pyx +673 -0
  69. algo_engine/base/c_market_data/c_trade_utils.c +28702 -0
  70. algo_engine/base/c_market_data/c_trade_utils.cp315-win_amd64.pyd +0 -0
  71. algo_engine/base/c_market_data/c_trade_utils.pxd +53 -0
  72. algo_engine/base/c_market_data/c_trade_utils.pyi +602 -0
  73. algo_engine/base/c_market_data/c_trade_utils.pyx +609 -0
  74. algo_engine/base/c_market_data/c_transaction.c +23558 -0
  75. algo_engine/base/c_market_data/c_transaction.cp315-win_amd64.pyd +0 -0
  76. algo_engine/base/c_market_data/c_transaction.pxd +27 -0
  77. algo_engine/base/c_market_data/c_transaction.pyi +433 -0
  78. algo_engine/base/c_market_data/c_transaction.pyx +460 -0
  79. algo_engine/base/console_utils.py +1070 -0
  80. algo_engine/base/finance_decimal.py +258 -0
  81. algo_engine/base/telemetrics.py +18 -0
  82. algo_engine/engine/__infra__.pxd +10 -0
  83. algo_engine/engine/__init__.pxd +10 -0
  84. algo_engine/engine/__init__.py +40 -0
  85. algo_engine/engine/algo_engine.py +904 -0
  86. algo_engine/engine/c_event_engine.c +16325 -0
  87. algo_engine/engine/c_event_engine.cp315-win_amd64.pyd +0 -0
  88. algo_engine/engine/c_event_engine.pxd +25 -0
  89. algo_engine/engine/c_event_engine.pyi +68 -0
  90. algo_engine/engine/c_market_engine.c +24258 -0
  91. algo_engine/engine/c_market_engine.cp315-win_amd64.pyd +0 -0
  92. algo_engine/engine/c_market_engine.pxd +87 -0
  93. algo_engine/engine/c_market_engine.pyi +357 -0
  94. algo_engine/engine/event_engine.py +53 -0
  95. algo_engine/engine/trade_engine.py +2037 -0
  96. algo_engine/exchange_profile/__infra__.pxd +100 -0
  97. algo_engine/exchange_profile/__init__.pxd +100 -0
  98. algo_engine/exchange_profile/__init__.py +53 -0
  99. algo_engine/exchange_profile/c_ex_profile_base.c +87 -0
  100. algo_engine/exchange_profile/c_ex_profile_base.h +1204 -0
  101. algo_engine/exchange_profile/c_ex_profile_cn.c +968 -0
  102. algo_engine/exchange_profile/c_ex_profile_cn.h +39 -0
  103. algo_engine/exchange_profile/c_exchange_profile.c +52375 -0
  104. algo_engine/exchange_profile/c_exchange_profile.cp315-win_amd64.pyd +0 -0
  105. algo_engine/exchange_profile/c_exchange_profile.pxd +336 -0
  106. algo_engine/exchange_profile/c_exchange_profile.pyi +883 -0
  107. algo_engine/exchange_profile/c_exchange_profile.pyx +1495 -0
  108. algo_engine/exchange_profile/c_profile_cn.c +7798 -0
  109. algo_engine/exchange_profile/c_profile_cn.cp315-win_amd64.pyd +0 -0
  110. algo_engine/exchange_profile/c_profile_cn.pxd +1 -0
  111. algo_engine/exchange_profile/c_profile_cn.pyi +3 -0
  112. algo_engine/exchange_profile/c_profile_cn.pyx +1 -0
  113. algo_engine/exchange_profile/c_profile_default.c +7798 -0
  114. algo_engine/exchange_profile/c_profile_default.cp315-win_amd64.pyd +0 -0
  115. algo_engine/exchange_profile/c_profile_default.pxd +1 -0
  116. algo_engine/exchange_profile/c_profile_default.pyi +3 -0
  117. algo_engine/exchange_profile/c_profile_default.pyx +1 -0
  118. algo_engine/exchange_profile/c_profile_dispatcher.c +7798 -0
  119. algo_engine/exchange_profile/c_profile_dispatcher.cp315-win_amd64.pyd +0 -0
  120. algo_engine/exchange_profile/c_profile_dispatcher.pxd +1 -0
  121. algo_engine/exchange_profile/c_profile_dispatcher.pyi +3 -0
  122. algo_engine/exchange_profile/c_profile_dispatcher.pyx +1 -0
  123. algo_engine/includes/algo_engine/base/c_allocator_protocol.c +11608 -0
  124. algo_engine/includes/algo_engine/base/c_intern_string.c +5908 -0
  125. algo_engine/includes/algo_engine/base/c_market_data/c_candlestick.c +18996 -0
  126. algo_engine/includes/algo_engine/base/c_market_data/c_internal.c +14059 -0
  127. algo_engine/includes/algo_engine/base/c_market_data/c_market_data.c +30420 -0
  128. algo_engine/includes/algo_engine/base/c_market_data/c_market_data.h +1464 -0
  129. algo_engine/includes/algo_engine/base/c_market_data/c_market_data_buffer.c +29407 -0
  130. algo_engine/includes/algo_engine/base/c_market_data/c_market_data_buffer.h +941 -0
  131. algo_engine/includes/algo_engine/base/c_market_data/c_market_data_config.h +29 -0
  132. algo_engine/includes/algo_engine/base/c_market_data/c_tick.c +44303 -0
  133. algo_engine/includes/algo_engine/base/c_market_data/c_trade_utils.c +28702 -0
  134. algo_engine/includes/algo_engine/base/c_market_data/c_transaction.c +23558 -0
  135. algo_engine/includes/algo_engine/engine/c_event_engine.c +16325 -0
  136. algo_engine/includes/algo_engine/engine/c_market_engine.c +24258 -0
  137. algo_engine/includes/algo_engine/exchange_profile/c_ex_profile_base.c +87 -0
  138. algo_engine/includes/algo_engine/exchange_profile/c_ex_profile_base.h +1204 -0
  139. algo_engine/includes/algo_engine/exchange_profile/c_ex_profile_cn.c +968 -0
  140. algo_engine/includes/algo_engine/exchange_profile/c_ex_profile_cn.h +39 -0
  141. algo_engine/includes/algo_engine/exchange_profile/c_exchange_profile.c +52375 -0
  142. algo_engine/includes/algo_engine/exchange_profile/c_profile_cn.c +7798 -0
  143. algo_engine/includes/algo_engine/exchange_profile/c_profile_default.c +7798 -0
  144. algo_engine/includes/algo_engine/exchange_profile/c_profile_dispatcher.c +7798 -0
  145. algo_engine/monitor/__init__.py +15 -0
  146. algo_engine/monitor/advanced_data_interface.py +334 -0
  147. algo_engine/strategy/__init__.py +44 -0
  148. algo_engine/strategy/strategy_engine.py +441 -0
  149. algo_engine/utils/__init__.py +3 -0
  150. algo_engine/utils/commit_regularizer.py +49 -0
  151. algo_engine/utils/data_utils.py +296 -0
  152. pyalgoengine-0.12.3.dist-info/METADATA +142 -0
  153. pyalgoengine-0.12.3.dist-info/RECORD +156 -0
  154. pyalgoengine-0.12.3.dist-info/WHEEL +5 -0
  155. pyalgoengine-0.12.3.dist-info/licenses/LICENSE +21 -0
  156. pyalgoengine-0.12.3.dist-info/top_level.txt +2 -0
@@ -0,0 +1,27 @@
1
+ from .c_market_data cimport md_variant, MarketData
2
+
3
+
4
+ cdef class TransactionData(MarketData):
5
+ pass
6
+
7
+
8
+ cdef class OrderData(MarketData):
9
+ pass
10
+
11
+
12
+ cdef class TradeData(TransactionData):
13
+ pass
14
+
15
+
16
+ cdef inline object transaction_from_header(const md_variant* market_data, bint owner):
17
+ cdef TransactionData instance = TransactionData.__new__(TransactionData)
18
+ instance.header = market_data
19
+ instance.owner = owner
20
+ return instance
21
+
22
+
23
+ cdef inline object order_from_header(const md_variant* market_data, bint owner):
24
+ cdef OrderData instance = OrderData.__new__(OrderData)
25
+ instance.header = market_data
26
+ instance.owner = owner
27
+ return instance
@@ -0,0 +1,433 @@
1
+ import enum
2
+ import uuid
3
+ from math import nan
4
+ from typing import Literal
5
+ from warnings import deprecated
6
+
7
+ from .c_market_data import MarketData
8
+
9
+ mid_t = str | int | bytes | uuid.UUID | None
10
+ sign_t = Literal[-1, 0, 1]
11
+
12
+
13
+ class OrderType(enum.IntEnum):
14
+ """Enum representing different order types."""
15
+ ORDER_UNKNOWN: OrderType
16
+ ORDER_CANCEL: OrderType
17
+ ORDER_GENERIC: OrderType
18
+ ORDER_LIMIT: OrderType
19
+ ORDER_LIMIT_MAKER: OrderType
20
+ ORDER_MARKET: OrderType
21
+ ORDER_FOK: OrderType
22
+ ORDER_FAK: OrderType
23
+ ORDER_IOC: OrderType
24
+
25
+
26
+ class TransactionDirection(enum.IntEnum):
27
+ """
28
+ Enum representing the direction of a financial transaction.
29
+
30
+ Attributes:
31
+ DIRECTION_UNKNOWN: Unknown transaction direction
32
+ DIRECTION_SHORT: Sell party initiated transaction (selling)
33
+ DIRECTION_LONG: Buy party initiated transaction (buying)
34
+ DIRECTION_NEUTRAL: Neither party initiated transaction, commonly in auction session (neutral)
35
+ """
36
+ DIRECTION_UNKNOWN: TransactionDirection
37
+ DIRECTION_SHORT: TransactionDirection
38
+ DIRECTION_LONG: TransactionDirection
39
+ DIRECTION_NEUTRAL: TransactionDirection
40
+
41
+ def __or__(self, offset: TransactionOffset) -> TransactionSide:
42
+ """
43
+ Combine direction and offset to create a TransactionSide using | operator.
44
+
45
+ Example:
46
+
47
+ >>> TransactionDirection.DIRECTION_LONG | TransactionOffset.OFFSET_OPEN
48
+ <TransactionSide.SIDE_LONG_OPEN: 10>
49
+
50
+ """
51
+ ...
52
+
53
+ @property
54
+ def sign(self) -> sign_t:
55
+ """
56
+ Get the numerical sign representing the transaction direction.
57
+
58
+ Returns:
59
+ - 1 for long (buy)
60
+ - -1 for short (sell)
61
+ - 0 for cancel / unknown / neutral
62
+ """
63
+ ...
64
+
65
+
66
+ class TransactionOffset(enum.IntEnum):
67
+ """
68
+ Enum representing the offset type of transaction.
69
+
70
+ Attributes:
71
+ OFFSET_CANCEL: Order cancellation
72
+ OFFSET_ORDER: Regular order placement
73
+ OFFSET_OPEN: Opening a new position
74
+ OFFSET_CLOSE: Closing an existing position
75
+ """
76
+ OFFSET_CANCEL: TransactionOffset
77
+ OFFSET_ORDER: TransactionOffset
78
+ OFFSET_OPEN: TransactionOffset
79
+ OFFSET_CLOSE: TransactionOffset
80
+
81
+ def __or__(self, direction: TransactionDirection) -> TransactionSide:
82
+ """
83
+ Combine offset and direction to create a TransactionSide using | operator.
84
+
85
+ Example:
86
+
87
+ >>> TransactionOffset.OFFSET_OPEN | TransactionDirection.DIRECTION_LONG
88
+ <TransactionSide.SIDE_LONG_OPEN: 10>
89
+
90
+ """
91
+ ...
92
+
93
+
94
+ @deprecated('Use entries from side_t instead')
95
+ class TransactionSideDeprecated(TransactionSide):
96
+ ...
97
+
98
+
99
+ class TransactionSide(enum.IntEnum):
100
+ """
101
+ Comprehensive enum representing all possible transaction sides.
102
+
103
+ Combines direction and offset to describe complete transaction types.
104
+ Includes deprecated legacy names for backward compatibility.
105
+ """
106
+ SIDE_LONG_OPEN: TransactionSide
107
+ SIDE_LONG_CLOSE: TransactionSide
108
+ SIDE_LONG_CANCEL: TransactionSide
109
+ SIDE_SHORT_OPEN: TransactionSide
110
+ SIDE_SHORT_CLOSE: TransactionSide
111
+ SIDE_NEUTRAL_OPEN: TransactionSide
112
+ SIDE_NEUTRAL_CLOSE: TransactionSide
113
+ SIDE_SHORT_CANCEL: TransactionSide
114
+ SIDE_BID: TransactionSide
115
+ SIDE_ASK: TransactionSide
116
+ SIDE_CANCEL: TransactionSide
117
+ SIDE_UNKNOWN: TransactionSide
118
+ SIDE_LONG: TransactionSide
119
+ SIDE_SHORT: TransactionSide
120
+ SIDE_FAULTY: TransactionSide
121
+
122
+ # Deprecated aliases
123
+ ShortOrder: TransactionSideDeprecated
124
+ AskOrder: TransactionSideDeprecated
125
+ Ask: TransactionSideDeprecated
126
+ LongOrder: TransactionSideDeprecated
127
+ BidOrder: TransactionSideDeprecated
128
+ Bid: TransactionSideDeprecated
129
+ ShortFilled: TransactionSideDeprecated
130
+ Unwind: TransactionSideDeprecated
131
+ Sell: TransactionSideDeprecated
132
+ LongFilled: TransactionSideDeprecated
133
+ LongOpen: TransactionSideDeprecated
134
+ Buy: TransactionSideDeprecated
135
+ ShortOpen: TransactionSideDeprecated
136
+ Short: TransactionSideDeprecated
137
+ Cover: TransactionSideDeprecated
138
+ UNKNOWN: TransactionSideDeprecated
139
+ CANCEL: TransactionSideDeprecated
140
+
141
+ @property
142
+ def sign(self) -> sign_t:
143
+ """
144
+ Get the numerical sign representing the transaction direction.
145
+
146
+ Returns:
147
+ - 1 for long (buy)
148
+ - -1 for short (sell)
149
+ - 0 for cancel/unknown
150
+ """
151
+ ...
152
+
153
+ @property
154
+ def offset(self) -> TransactionOffset:
155
+ """Get the transaction offset component of this side."""
156
+ ...
157
+
158
+ @property
159
+ def direction(self) -> TransactionDirection:
160
+ """Get the transaction direction component of this side."""
161
+ ...
162
+
163
+ @property
164
+ def side_name(self) -> str:
165
+ """Get the human-readable name of this transaction side."""
166
+ ...
167
+
168
+ @property
169
+ def offset_name(self) -> str:
170
+ """Get the human-readable name of the offset component."""
171
+ ...
172
+
173
+ @property
174
+ def direction_name(self) -> str:
175
+ """Get the human-readable name of the direction component."""
176
+ ...
177
+
178
+
179
+ class TransactionData(MarketData):
180
+ """
181
+ Market data representing a completed transaction or order cancellation.
182
+
183
+ Represents any action that reduces listing volume from the order book,
184
+ including trades and cancellations. The side indicates which party initiated
185
+ the action. The cancel order has no side information (as it only has 1 party).
186
+
187
+ Multiplier should be provided for instruments like future contracts where
188
+ the contract multiplier is not 1. This affects notional and flow calculations.
189
+ """
190
+
191
+ def __init__(
192
+ self,
193
+ *
194
+ ticker: str,
195
+ timestamp: float,
196
+ price: float,
197
+ volume: float,
198
+ side: int,
199
+ multiplier: float = 1.0,
200
+ notional: float = nan,
201
+ transaction_id: mid_t = None,
202
+ buy_id: mid_t = None,
203
+ sell_id: mid_t = None,
204
+ **kwargs
205
+ ) -> None:
206
+ """
207
+ Initialize a TransactionData instance.
208
+
209
+ Args:
210
+ ticker: The Ticker of the transaction
211
+ timestamp: Unix timestamp of transaction
212
+ price: Execution price
213
+ volume: Transaction volume
214
+ side: Transaction side (see TransactionSide)
215
+ multiplier: Contract multiplier (default 1.0)
216
+ notional: Optional pre-calculated notional value, if nan, will be computed as price * volume * multiplier
217
+ transaction_id: Unique transaction identifier
218
+ buy_id: Buyer's order identifier
219
+ sell_id: Seller's order identifier
220
+ **kwargs: Additional transaction attributes
221
+ """
222
+ ...
223
+
224
+ @classmethod
225
+ def merge(cls, data_list: list[TransactionData]) -> TransactionData:
226
+ """
227
+ Merge multiple transactions into a single aggregate transaction.
228
+
229
+ Args:
230
+ data_list: List of transactions to merge
231
+
232
+ Returns:
233
+ New combined TransactionData instance
234
+ """
235
+ ...
236
+
237
+ @property
238
+ def price(self) -> float:
239
+ """Get the execution price of this transaction."""
240
+ ...
241
+
242
+ @property
243
+ def volume(self) -> float:
244
+ """Get the volume/size of this transaction."""
245
+ ...
246
+
247
+ @property
248
+ def side(self) -> TransactionSide:
249
+ """Get the TransactionSide enum value for this transaction."""
250
+ ...
251
+
252
+ @property
253
+ def side_int(self) -> int:
254
+ """Get the raw int enum value of the transaction side."""
255
+ ...
256
+
257
+ @property
258
+ def side_sign(self) -> sign_t:
259
+ """Get the directional sign of this transaction (-1, 0, 1). See TransactionDirection.side for details."""
260
+ ...
261
+
262
+ @property
263
+ def multiplier(self) -> float:
264
+ """Get the contract multiplier for this transaction."""
265
+ ...
266
+
267
+ @property
268
+ def notional(self) -> float:
269
+ """Get the notional value (price * volume * multiplier)."""
270
+ ...
271
+
272
+ @property
273
+ def transaction_id(self) -> mid_t:
274
+ """Get the unique identifier for this transaction."""
275
+ ...
276
+
277
+ @property
278
+ def buy_id(self) -> mid_t:
279
+ """Get the buyer's order identifier."""
280
+ ...
281
+
282
+ @property
283
+ def sell_id(self) -> mid_t:
284
+ """Get the seller's order identifier."""
285
+ ...
286
+
287
+ @property
288
+ def volume_flow(self) -> float:
289
+ """Get the signed volume flow (volume * side_sign)."""
290
+ ...
291
+
292
+ @property
293
+ def notional_flow(self) -> float:
294
+ """Get the signed notional flow (notional * side_sign)."""
295
+ ...
296
+
297
+
298
+ class OrderData(MarketData):
299
+ """
300
+ Market data representing an order (bid / ask) in the order book.
301
+
302
+ Represents any action that increases listing volume to the order book.
303
+ The side indicates the side of the order book it affected.
304
+ """
305
+
306
+ def __init__(
307
+ self,
308
+ *
309
+ ticker: str,
310
+ timestamp: float,
311
+ price: float,
312
+ volume: float,
313
+ side: int,
314
+ order_id: mid_t = None,
315
+ order_type: int = OrderType.ORDER_GENERIC,
316
+ **kwargs
317
+ ) -> None:
318
+ """
319
+ Initialize an OrderData instance.
320
+
321
+ Args:
322
+ ticker: The Ticker of the order
323
+ timestamp: Unix timestamp
324
+ price: Order price
325
+ volume: Order volume
326
+ side: Order side (see TransactionSide)
327
+ order_id: Unique order identifier
328
+ order_type: Order type (see OrderType from c_market_data)
329
+ **kwargs: Additional order attributes
330
+ """
331
+ ...
332
+
333
+ @property
334
+ def price(self) -> float:
335
+ """Get the order price."""
336
+ ...
337
+
338
+ @property
339
+ def volume(self) -> float:
340
+ """Get the order volume."""
341
+ ...
342
+
343
+ @property
344
+ def side(self) -> TransactionSide:
345
+ """Get the TransactionSide enum value for this order."""
346
+ ...
347
+
348
+ @property
349
+ def side_int(self) -> int:
350
+ """Get the raw integer value of the order side."""
351
+ ...
352
+
353
+ @property
354
+ def side_sign(self) -> sign_t:
355
+ """Get the directional sign of this order (-1, 0, 1)."""
356
+ ...
357
+
358
+ @property
359
+ def order_id(self) -> mid_t:
360
+ """Get the unique order identifier."""
361
+ ...
362
+
363
+ @property
364
+ def order_type(self) -> OrderType:
365
+ """Get the OrderType enum value for this order."""
366
+ ...
367
+
368
+ @property
369
+ def order_type_int(self) -> int:
370
+ """Get the raw integer value of the order type."""
371
+ ...
372
+
373
+ @property
374
+ def flow(self) -> float:
375
+ """Get the signed order flow (volume * side_sign)."""
376
+ ...
377
+
378
+
379
+ class TradeData(TransactionData):
380
+ """
381
+ An alias for TransactionData for backwards compatibility.
382
+
383
+ Inherits all TransactionData functionality while providing
384
+ trade-specific property aliases.
385
+ """
386
+
387
+ def __init__(
388
+ self,
389
+ *,
390
+ ticker: str,
391
+ timestamp: float,
392
+ trade_price: float,
393
+ trade_volume: float,
394
+ trade_side: int,
395
+ multiplier: float = 1.0,
396
+ notional: float = nan,
397
+ transaction_id: mid_t = None,
398
+ buy_id: mid_t = None,
399
+ sell_id: mid_t = None,
400
+ **kwargs
401
+ ) -> None:
402
+ """
403
+ Initialize a TradeData instance.
404
+
405
+ Args:
406
+ ticker: Instrument identifier
407
+ timestamp: Unix timestamp of trade
408
+ trade_price: Execution price
409
+ trade_volume: Trade volume
410
+ trade_side: Trade side (see TransactionSide)
411
+ multiplier: Contract multiplier (default 1.0)
412
+ notional: Optional pre-calculated notional value, if nan, will be computed as price * volume * multiplier
413
+ transaction_id: Unique transaction identifier
414
+ buy_id: Buyer's order identifier
415
+ sell_id: Seller's order identifier
416
+ **kwargs: Additional transaction attributes
417
+ """
418
+ ...
419
+
420
+ @property
421
+ def trade_price(self) -> float:
422
+ """Alias for price property (trade execution price)."""
423
+ ...
424
+
425
+ @property
426
+ def trade_volume(self) -> float:
427
+ """Alias for volume property (trade volume)."""
428
+ ...
429
+
430
+ @property
431
+ def trade_side(self) -> TransactionSide:
432
+ """Alias for side property (trade side)."""
433
+ ...