ddx-python 1.0.4__cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.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 (106) hide show
  1. ddx/.gitignore +1 -0
  2. ddx/__init__.py +58 -0
  3. ddx/_rust/__init__.pyi +2685 -0
  4. ddx/_rust/common/__init__.pyi +17 -0
  5. ddx/_rust/common/accounting.pyi +6 -0
  6. ddx/_rust/common/enums.pyi +3 -0
  7. ddx/_rust/common/requests/__init__.pyi +23 -0
  8. ddx/_rust/common/requests/intents.pyi +19 -0
  9. ddx/_rust/common/specs.pyi +17 -0
  10. ddx/_rust/common/state/__init__.pyi +41 -0
  11. ddx/_rust/common/state/keys.pyi +29 -0
  12. ddx/_rust/common/transactions.pyi +7 -0
  13. ddx/_rust/decimal.pyi +3 -0
  14. ddx/_rust/h256.pyi +3 -0
  15. ddx/_rust.abi3.so +0 -0
  16. ddx/app_config/ethereum/addresses.json +526 -0
  17. ddx/auditor/README.md +32 -0
  18. ddx/auditor/__init__.py +0 -0
  19. ddx/auditor/auditor_driver.py +1043 -0
  20. ddx/auditor/websocket_message.py +54 -0
  21. ddx/common/__init__.py +0 -0
  22. ddx/common/epoch_params.py +28 -0
  23. ddx/common/fill_context.py +141 -0
  24. ddx/common/logging.py +184 -0
  25. ddx/common/market_aware_account.py +259 -0
  26. ddx/common/market_specs.py +64 -0
  27. ddx/common/trade_mining_params.py +19 -0
  28. ddx/common/transaction_utils.py +85 -0
  29. ddx/common/transactions/__init__.py +0 -0
  30. ddx/common/transactions/advance_epoch.py +91 -0
  31. ddx/common/transactions/advance_settlement_epoch.py +63 -0
  32. ddx/common/transactions/all_price_checkpoints.py +84 -0
  33. ddx/common/transactions/cancel.py +76 -0
  34. ddx/common/transactions/cancel_all.py +88 -0
  35. ddx/common/transactions/complete_fill.py +103 -0
  36. ddx/common/transactions/disaster_recovery.py +96 -0
  37. ddx/common/transactions/event.py +48 -0
  38. ddx/common/transactions/fee_distribution.py +119 -0
  39. ddx/common/transactions/funding.py +292 -0
  40. ddx/common/transactions/futures_expiry.py +123 -0
  41. ddx/common/transactions/genesis.py +108 -0
  42. ddx/common/transactions/inner/__init__.py +0 -0
  43. ddx/common/transactions/inner/adl_outcome.py +25 -0
  44. ddx/common/transactions/inner/fill.py +232 -0
  45. ddx/common/transactions/inner/liquidated_position.py +41 -0
  46. ddx/common/transactions/inner/liquidation_entry.py +41 -0
  47. ddx/common/transactions/inner/liquidation_fill.py +118 -0
  48. ddx/common/transactions/inner/outcome.py +32 -0
  49. ddx/common/transactions/inner/trade_fill.py +292 -0
  50. ddx/common/transactions/insurance_fund_update.py +138 -0
  51. ddx/common/transactions/insurance_fund_withdraw.py +100 -0
  52. ddx/common/transactions/liquidation.py +353 -0
  53. ddx/common/transactions/partial_fill.py +125 -0
  54. ddx/common/transactions/pnl_realization.py +120 -0
  55. ddx/common/transactions/post.py +72 -0
  56. ddx/common/transactions/post_order.py +95 -0
  57. ddx/common/transactions/price_checkpoint.py +97 -0
  58. ddx/common/transactions/signer_registered.py +62 -0
  59. ddx/common/transactions/specs_update.py +61 -0
  60. ddx/common/transactions/strategy_update.py +158 -0
  61. ddx/common/transactions/tradable_product_update.py +98 -0
  62. ddx/common/transactions/trade_mining.py +147 -0
  63. ddx/common/transactions/trader_update.py +131 -0
  64. ddx/common/transactions/withdraw.py +90 -0
  65. ddx/common/transactions/withdraw_ddx.py +74 -0
  66. ddx/common/utils.py +176 -0
  67. ddx/config.py +17 -0
  68. ddx/derivadex_client.py +270 -0
  69. ddx/models/__init__.py +0 -0
  70. ddx/models/base.py +132 -0
  71. ddx/py.typed +0 -0
  72. ddx/realtime_client/__init__.py +2 -0
  73. ddx/realtime_client/config.py +2 -0
  74. ddx/realtime_client/models/__init__.py +611 -0
  75. ddx/realtime_client/realtime_client.py +646 -0
  76. ddx/rest_client/__init__.py +0 -0
  77. ddx/rest_client/clients/__init__.py +0 -0
  78. ddx/rest_client/clients/base_client.py +60 -0
  79. ddx/rest_client/clients/market_client.py +1243 -0
  80. ddx/rest_client/clients/on_chain_client.py +439 -0
  81. ddx/rest_client/clients/signed_client.py +292 -0
  82. ddx/rest_client/clients/system_client.py +843 -0
  83. ddx/rest_client/clients/trade_client.py +357 -0
  84. ddx/rest_client/constants/__init__.py +0 -0
  85. ddx/rest_client/constants/endpoints.py +66 -0
  86. ddx/rest_client/contracts/__init__.py +0 -0
  87. ddx/rest_client/contracts/checkpoint/__init__.py +560 -0
  88. ddx/rest_client/contracts/ddx/__init__.py +1949 -0
  89. ddx/rest_client/contracts/dummy_token/__init__.py +1014 -0
  90. ddx/rest_client/contracts/i_collateral/__init__.py +1414 -0
  91. ddx/rest_client/contracts/i_stake/__init__.py +696 -0
  92. ddx/rest_client/exceptions/__init__.py +0 -0
  93. ddx/rest_client/exceptions/exceptions.py +32 -0
  94. ddx/rest_client/http/__init__.py +0 -0
  95. ddx/rest_client/http/http_client.py +336 -0
  96. ddx/rest_client/models/__init__.py +0 -0
  97. ddx/rest_client/models/market.py +693 -0
  98. ddx/rest_client/models/signed.py +61 -0
  99. ddx/rest_client/models/system.py +311 -0
  100. ddx/rest_client/models/trade.py +185 -0
  101. ddx/rest_client/utils/__init__.py +0 -0
  102. ddx/rest_client/utils/encryption_utils.py +26 -0
  103. ddx/utils/__init__.py +0 -0
  104. ddx_python-1.0.4.dist-info/METADATA +63 -0
  105. ddx_python-1.0.4.dist-info/RECORD +106 -0
  106. ddx_python-1.0.4.dist-info/WHEEL +5 -0
ddx/_rust/__init__.pyi ADDED
@@ -0,0 +1,2685 @@
1
+ # This file is automatically generated by pyo3_stub_gen
2
+ # ruff: noqa: E501, F401
3
+
4
+ import builtins
5
+ import datetime
6
+ import enum
7
+ import typing
8
+
9
+ @typing.final
10
+ class AdvanceEpoch:
11
+ @property
12
+ def time(self) -> AdvanceTime: ...
13
+ @property
14
+ def epoch_id(self) -> builtins.int: ...
15
+ @property
16
+ def json(self) -> typing.Any: ...
17
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
18
+ def __new__(cls, epoch_id: builtins.int, time: AdvanceTime) -> AdvanceEpoch: ...
19
+ def __repr__(self) -> builtins.str: ...
20
+
21
+ @typing.final
22
+ class AdvanceSettlementEpoch:
23
+ @property
24
+ def time(self) -> AdvanceTime: ...
25
+ @property
26
+ def actions(self) -> builtins.list[SettlementAction]: ...
27
+ @property
28
+ def epoch_id(self) -> builtins.int: ...
29
+ @property
30
+ def json(self) -> typing.Any: ...
31
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
32
+ def __new__(cls, epoch_id: builtins.int, time: AdvanceTime, actions: typing.Sequence[SettlementAction]) -> AdvanceSettlementEpoch: ...
33
+ def __repr__(self) -> builtins.str: ...
34
+
35
+ @typing.final
36
+ class AdvanceTime:
37
+ @property
38
+ def value(self) -> builtins.int: ...
39
+ @property
40
+ def timestamp(self) -> builtins.int: ...
41
+ @property
42
+ def json(self) -> typing.Any: ...
43
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
44
+ def __new__(cls, value: builtins.int, timestamp: builtins.int) -> AdvanceTime: ...
45
+ def __repr__(self) -> builtins.str: ...
46
+
47
+ @typing.final
48
+ class Balance:
49
+ r"""
50
+ Maps token address to balance amount
51
+ """
52
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
53
+ def __new__(cls, amount: Decimal, address: TokenSymbol) -> Balance: ...
54
+ def __repr__(self) -> builtins.str: ...
55
+ def __len__(self) -> builtins.int: ...
56
+ def __getitem__(self, key: TokenSymbol) -> Decimal: ...
57
+ def __setitem__(self, key: TokenSymbol, value: Decimal) -> None: ...
58
+ @classmethod
59
+ def default(cls) -> Balance:
60
+ r"""
61
+ Return an empty `Balance` with zero for every token.
62
+ """
63
+ @classmethod
64
+ def new_from_many(cls, amounts: typing.Mapping[TokenSymbol, Decimal]) -> Balance:
65
+ r"""
66
+ Construct a `Balance` from a mapping (`dict`) of
67
+ `TokenSymbol` → `Decimal` amounts.
68
+ """
69
+ def total_value(self) -> Decimal:
70
+ r"""
71
+ Total value of this balance, obtained by summing
72
+ every token amount. This will be either in USD or DDX, depending on
73
+ its contents.
74
+ """
75
+ def amounts(self) -> builtins.list[Decimal]:
76
+ r"""
77
+ Raw amounts ordered by the canonical token list.
78
+ """
79
+
80
+ @typing.final
81
+ class BinaryPredictionFuture:
82
+ @property
83
+ def event(self) -> builtins.str: ...
84
+ @property
85
+ def qualifier(self) -> builtins.int:
86
+ r"""
87
+ numeric qualifier (often year-like "26")
88
+ """
89
+ @property
90
+ def description(self) -> builtins.str: ...
91
+ @property
92
+ def tick_size(self) -> Decimal: ...
93
+ @property
94
+ def max_order_notional(self) -> Decimal: ...
95
+ @property
96
+ def max_taker_price_deviation(self) -> Decimal: ...
97
+ @property
98
+ def min_order_size(self) -> Decimal: ...
99
+
100
+ @typing.final
101
+ class Block:
102
+ r"""
103
+ We use a single `BlockProducer` to sequence blocks along with other requests to ensure that
104
+ all Execution Operators synchronize their state with Ethereum event in the same order.
105
+
106
+ # Notes
107
+
108
+ Some Ethereum events (e.g. Deposits) must only be processed on confirmed blocks.
109
+ Block confirmation count is handled client-side during execution. The block producer's
110
+ responsibility is just to post block numbers into the `RequestQueue`.
111
+ """
112
+ @property
113
+ def json(self) -> typing.Any: ...
114
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
115
+ def __new__(cls, number: builtins.int) -> Block: ...
116
+ def __repr__(self) -> builtins.str: ...
117
+
118
+ @typing.final
119
+ class BookOrder:
120
+ r"""
121
+ A Bid or Ask in the orderbook (maker order)
122
+ """
123
+ @property
124
+ def side(self) -> OrderSide:
125
+ r"""
126
+ Bid = 0, Ask = 1
127
+ """
128
+ @side.setter
129
+ def side(self, value: OrderSide) -> None:
130
+ r"""
131
+ Bid = 0, Ask = 1
132
+ """
133
+ @property
134
+ def amount(self) -> Decimal:
135
+ r"""
136
+ Order amount
137
+ """
138
+ @amount.setter
139
+ def amount(self, value: Decimal) -> None:
140
+ r"""
141
+ Order amount
142
+ """
143
+ @property
144
+ def price(self) -> Decimal:
145
+ r"""
146
+ Price offered to takers
147
+ """
148
+ @price.setter
149
+ def price(self, value: Decimal) -> None:
150
+ r"""
151
+ Price offered to takers
152
+ """
153
+ @property
154
+ def trader_address(self) -> builtins.str:
155
+ r"""
156
+ Maker address
157
+ """
158
+ @trader_address.setter
159
+ def trader_address(self, value: builtins.str) -> None:
160
+ r"""
161
+ Maker address
162
+ """
163
+ @property
164
+ def strategy_id_hash(self) -> builtins.str:
165
+ r"""
166
+ Maker strategy identifier
167
+ """
168
+ @strategy_id_hash.setter
169
+ def strategy_id_hash(self, value: builtins.str) -> None:
170
+ r"""
171
+ Maker strategy identifier
172
+ """
173
+ @property
174
+ def book_ordinal(self) -> builtins.int:
175
+ r"""
176
+ Per market ordinal sequencing inclusion in the order book
177
+ """
178
+ @book_ordinal.setter
179
+ def book_ordinal(self, value: builtins.int) -> None:
180
+ r"""
181
+ Per market ordinal sequencing inclusion in the order book
182
+ """
183
+ @property
184
+ def time_value(self) -> builtins.int:
185
+ r"""
186
+ Time stamp of the post order transaction
187
+ """
188
+ @time_value.setter
189
+ def time_value(self, value: builtins.int) -> None:
190
+ r"""
191
+ Time stamp of the post order transaction
192
+ """
193
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
194
+ def __new__(cls, side: OrderSide, amount: Decimal, price: Decimal, trader_address: builtins.str, strategy_id_hash: builtins.str, book_ordinal: builtins.int, time_value: builtins.int) -> BookOrder: ...
195
+ def __repr__(self) -> builtins.str: ...
196
+ def __deepcopy__(self, _memo: dict) -> BookOrder: ...
197
+ def as_item(self) -> Item:
198
+ r"""
199
+ Wrap this concrete structure into the generic [`Item`] enum.
200
+ """
201
+ @classmethod
202
+ def from_item(cls, item: Item) -> BookOrder:
203
+ r"""
204
+ Down-cast a generic [`Item`] into this concrete type.
205
+ """
206
+ def abi_encoded_value(self) -> builtins.bytes:
207
+ r"""
208
+ ABI-encode this value.
209
+ """
210
+ @classmethod
211
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
212
+ r"""
213
+ Decode bytes back into an [`Item`] of this concrete type.
214
+ """
215
+ def is_void(self) -> builtins.bool:
216
+ r"""
217
+ `true` when this value represents the special *void* marker
218
+ used to delete a leaf from the SMT.
219
+ """
220
+
221
+ @typing.final
222
+ class BookOrderKey:
223
+ @property
224
+ def symbol(self) -> ProductSymbol: ...
225
+ @property
226
+ def order_hash(self) -> builtins.str: ...
227
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
228
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
229
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
230
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
231
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
232
+ def __hash__(self) -> builtins.int: ...
233
+ def __new__(cls, symbol: ProductSymbol, order_hash: builtins.str) -> BookOrderKey: ...
234
+ def __repr__(self) -> builtins.str: ...
235
+ def __deepcopy__(self, _memo: dict) -> BookOrderKey: ...
236
+ def encode_key(self) -> H256:
237
+ r"""
238
+ Encode this state-key into the 32-byte format used on-chain.
239
+ """
240
+ @classmethod
241
+ def decode_key(cls, value: H256) -> BookOrderKey:
242
+ r"""
243
+ Decode a previously-encoded key back into its strongly-typed form.
244
+ """
245
+
246
+ @typing.final
247
+ class CancelAllIntent:
248
+ r"""
249
+ Batch cancel all orders for a given strategy
250
+ """
251
+ @property
252
+ def symbol(self) -> ProductSymbol: ...
253
+ @property
254
+ def strategy(self) -> builtins.str:
255
+ r"""
256
+ Strategy to cancel orders for
257
+ """
258
+ @property
259
+ def nonce(self) -> builtins.str:
260
+ r"""
261
+ A salt for uniqueness of the EIP-712 hash function.
262
+ """
263
+ @property
264
+ def session_key_signature(self) -> typing.Optional[builtins.str]:
265
+ r"""
266
+ EIP-191 signature of the 1CT session public key
267
+ """
268
+ @session_key_signature.setter
269
+ def session_key_signature(self, value: typing.Optional[builtins.str]) -> None:
270
+ r"""
271
+ EIP-191 signature of the 1CT session public key
272
+ """
273
+ @property
274
+ def signature(self) -> builtins.str:
275
+ r"""
276
+ EIP-712 signature of the order cancellation intent attributes
277
+ """
278
+ @signature.setter
279
+ def signature(self, value: builtins.str) -> None:
280
+ r"""
281
+ EIP-712 signature of the order cancellation intent attributes
282
+ """
283
+ @property
284
+ def json(self) -> typing.Any: ...
285
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
286
+ def __new__(cls, symbol: ProductSymbol, strategy: builtins.str, nonce: builtins.str, session_key_signature: typing.Optional[builtins.str], signature: typing.Optional[builtins.str] = None) -> CancelAllIntent: ...
287
+ def __repr__(self) -> builtins.str: ...
288
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
289
+ r"""
290
+ Compute the EIP-712 digest for this intent.
291
+ Passing `message_metadata=(chain_id, verifying_contract)`
292
+ overrides the default values used in the hash.
293
+ """
294
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
295
+ r"""
296
+ Recover the `(eip712_hash, trader_address)` that signed
297
+ this intent.
298
+ """
299
+
300
+ @typing.final
301
+ class CancelOrderIntent:
302
+ @property
303
+ def symbol(self) -> ProductSymbol: ...
304
+ @property
305
+ def order_hash(self) -> builtins.str:
306
+ r"""
307
+ hash of the corresponding order intent
308
+ """
309
+ @property
310
+ def nonce(self) -> builtins.str:
311
+ r"""
312
+ `nonce` specified in the order intent to cancel (to lookup the order without storing its hash)
313
+ A salt for uniqueness of the EIP-712 hash function. May optionally have business meaning to the client.
314
+ """
315
+ @property
316
+ def session_key_signature(self) -> typing.Optional[builtins.str]:
317
+ r"""
318
+ EIP-191 signature of the 1CT session public key
319
+ """
320
+ @session_key_signature.setter
321
+ def session_key_signature(self, value: typing.Optional[builtins.str]) -> None:
322
+ r"""
323
+ EIP-191 signature of the 1CT session public key
324
+ """
325
+ @property
326
+ def signature(self) -> builtins.str:
327
+ r"""
328
+ EIP-712 signature of the order cancellation intent attributes
329
+ """
330
+ @signature.setter
331
+ def signature(self, value: builtins.str) -> None:
332
+ r"""
333
+ EIP-712 signature of the order cancellation intent attributes
334
+ """
335
+ @property
336
+ def json(self) -> typing.Any: ...
337
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
338
+ def __new__(cls, symbol: ProductSymbol, order_hash: builtins.str, nonce: builtins.str, session_key_signature: typing.Optional[builtins.str], signature: typing.Optional[builtins.str] = None) -> CancelOrderIntent: ...
339
+ def __repr__(self) -> builtins.str: ...
340
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
341
+ r"""
342
+ Compute the EIP-712 digest for this intent.
343
+ Passing `message_metadata=(chain_id, verifying_contract)`
344
+ overrides the default values used in the hash.
345
+ """
346
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
347
+ r"""
348
+ Recover the `(eip712_hash, trader_address)` that signed
349
+ this intent.
350
+ """
351
+
352
+ class CoreCommonError(builtins.Exception):
353
+ r"""
354
+ DDX Core error
355
+ """
356
+ ...
357
+
358
+ @typing.final
359
+ class Decimal:
360
+ r"""
361
+ Wrapped rust_decimal::Decimal. Constructor only supports str, e.g d = Decimal("123.456")
362
+ """
363
+ def __str__(self) -> builtins.str: ...
364
+ def __new__(cls, maybe_value: typing.Optional[typing.Any] = None) -> Decimal:
365
+ r"""
366
+ Create a new Decimal In Python:
367
+ let d1 = Decimal("123.456")
368
+ let d2 = Decimal("-987.654")
369
+ let d3 = Decimal("456")
370
+ let d4 = Decimal() # Decimal("0")
371
+ Accepts `None`, another `Decimal`, a string, an `int`, or a `float`.
372
+ When no value (or `None`) is supplied the resulting `Decimal` is zero.
373
+ """
374
+ def recorded_amount(self) -> Decimal:
375
+ r"""
376
+ Returns a value rounded toward zero to `TOKEN_UNIT_SCALE` decimal
377
+ places, matching the precision stored on-chain as `RecordedAmount`.
378
+ """
379
+ def to_usdc_grains(self) -> builtins.int:
380
+ r"""
381
+ Converts the current amount into raw USDC grains
382
+ (`u128`, scaled by `10^TOKEN_UNIT_SCALE`).
383
+ Fails if the result does not fit in `u128`.
384
+ """
385
+ def to_ddx_grains(self) -> builtins.int:
386
+ r"""
387
+ Converts the current amount into raw DDX grains
388
+ (`u128`, scaled by `10^18`).
389
+ Fails if the result does not fit in `u128`.
390
+ """
391
+ @classmethod
392
+ def from_usdc_grains(cls, u: builtins.int) -> Decimal:
393
+ r"""
394
+ Creates a `Decimal` from a `u128` expressed in USDC grains
395
+ (i.e. already scaled by `10^TOKEN_UNIT_SCALE`).
396
+ """
397
+ @classmethod
398
+ def from_ddx_grains(cls, u: builtins.int) -> Decimal:
399
+ r"""
400
+ Creates a `Decimal` from a `u128` expressed in DDX grains
401
+ (i.e. already scaled by `10^18`).
402
+ """
403
+ def quantize(self, precision: builtins.int) -> Decimal:
404
+ r"""
405
+ Returns a copy of this value rounded toward zero to the requested
406
+ number of fractional digits (`precision`).
407
+ """
408
+ def __setstate__(self, state: typing.Any) -> None: ...
409
+ def __getstate__(self) -> typing.Any: ...
410
+ def __repr__(self) -> builtins.str: ...
411
+ def __eq__(self, other: typing.Any) -> builtins.bool: ...
412
+ def __ne__(self, other: typing.Any) -> builtins.bool: ...
413
+ def __lt__(self, other: typing.Any) -> builtins.bool: ...
414
+ def __le__(self, other: typing.Any) -> builtins.bool: ...
415
+ def __gt__(self, other: typing.Any) -> builtins.bool: ...
416
+ def __ge__(self, other: typing.Any) -> builtins.bool: ...
417
+ def __hash__(self) -> builtins.int: ...
418
+ def __add__(self, other: typing.Any) -> Decimal: ...
419
+ def __radd__(self, other: typing.Any) -> Decimal: ...
420
+ def __sub__(self, other: typing.Any) -> Decimal: ...
421
+ def __rsub__(self, other: typing.Any) -> Decimal: ...
422
+ def __mul__(self, other: typing.Any) -> Decimal: ...
423
+ def __rmul__(self, other: typing.Any) -> Decimal: ...
424
+ def __truediv__(self, other: typing.Any) -> Decimal: ...
425
+ def __rtruediv__(self, other: typing.Any) -> Decimal: ...
426
+ def __mod__(self, other: typing.Any) -> Decimal: ...
427
+ def __rmod__(self, other: typing.Any) -> Decimal: ...
428
+ def __pow__(self, exponent: typing.Any, modulo: typing.Any = None) -> Decimal: ...
429
+ def __rpow__(self, base: typing.Any, modulo: typing.Any = None) -> Decimal: ...
430
+ def __neg__(self) -> Decimal: ...
431
+ def __abs__(self) -> Decimal: ...
432
+ def __int__(self) -> builtins.int: ...
433
+ def __float__(self) -> builtins.float: ...
434
+
435
+ class DecimalError(builtins.Exception):
436
+ r"""
437
+ rust_decimal::Decimal error
438
+ """
439
+ ...
440
+
441
+ @typing.final
442
+ class DerivadexSMT:
443
+ r"""
444
+ Wrapped DerivaDEX Sparse Merkle Tree.
445
+ """
446
+ def __repr__(self) -> builtins.str: ...
447
+ def __new__(cls) -> DerivadexSMT:
448
+ r"""
449
+ Construct an empty in-memory SMT with a fresh root.
450
+ """
451
+ @classmethod
452
+ def from_genesis(cls, insurance_fund_cap: Balance, ddx_fee_pool: Decimal, specs: typing.Any, current_time: datetime.datetime) -> DerivadexSMT:
453
+ r"""
454
+ Build the genesis SMT, taking `current_time` into account for futures.
455
+ """
456
+ def root(self) -> H256:
457
+ r"""
458
+ Current SMT root hash.
459
+ """
460
+ def merkle_proof(self, keys: typing.Sequence[H256]) -> MerkleProof:
461
+ r"""
462
+ Generate a compiled Merkle proof covering all provided leaf `keys`.
463
+ """
464
+ def store_item_by_key(self, key: H256, maybe_inner: typing.Optional[Item]) -> H256:
465
+ r"""
466
+ Insert (`Some`) or delete (`None`) a leaf at `key` and return the
467
+ updated tree root hash.
468
+ """
469
+ def __deepcopy__(self, _memo: dict) -> DerivadexSMT: ...
470
+ def trader(self, key: TraderKey) -> typing.Optional[Trader]:
471
+ r"""
472
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
473
+ """
474
+ def store_trader(self, key: TraderKey, maybe_inner: typing.Optional[Trader]) -> H256:
475
+ r"""
476
+ Insert (`Some`) or delete (`None`) a leaf and return the new
477
+ SMT root hash.
478
+ """
479
+ def all_traders(self) -> builtins.list[tuple[TraderKey, Trader]]:
480
+ r"""
481
+ Return every item of this type currently stored in the tree.
482
+ """
483
+ def strategy(self, key: StrategyKey) -> typing.Optional[Strategy]:
484
+ r"""
485
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
486
+ """
487
+ def store_strategy(self, key: StrategyKey, maybe_inner: typing.Optional[Strategy]) -> H256:
488
+ r"""
489
+ Insert (`Some`) or delete (`None`) a leaf and return the new
490
+ SMT root hash.
491
+ """
492
+ def all_strategies(self) -> builtins.list[tuple[StrategyKey, Strategy]]:
493
+ r"""
494
+ Return every item of this type currently stored in the tree.
495
+ """
496
+ def position(self, key: PositionKey) -> typing.Optional[Position]:
497
+ r"""
498
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
499
+ """
500
+ def store_position(self, key: PositionKey, maybe_inner: typing.Optional[Position]) -> H256:
501
+ r"""
502
+ Insert (`Some`) or delete (`None`) a leaf and return the new
503
+ SMT root hash.
504
+ """
505
+ def all_positions(self) -> builtins.list[tuple[PositionKey, Position]]:
506
+ r"""
507
+ Return every item of this type currently stored in the tree.
508
+ """
509
+ def book_order(self, key: BookOrderKey) -> typing.Optional[BookOrder]:
510
+ r"""
511
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
512
+ """
513
+ def store_book_order(self, key: BookOrderKey, maybe_inner: typing.Optional[BookOrder]) -> H256:
514
+ r"""
515
+ Insert (`Some`) or delete (`None`) a leaf and return the new
516
+ SMT root hash.
517
+ """
518
+ def all_book_orders(self) -> builtins.list[tuple[BookOrderKey, BookOrder]]:
519
+ r"""
520
+ Return every item of this type currently stored in the tree.
521
+ """
522
+ def price(self, key: PriceKey) -> typing.Optional[Price]:
523
+ r"""
524
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
525
+ """
526
+ def store_price(self, key: PriceKey, maybe_inner: typing.Optional[Price]) -> H256:
527
+ r"""
528
+ Insert (`Some`) or delete (`None`) a leaf and return the new
529
+ SMT root hash.
530
+ """
531
+ def all_prices(self) -> builtins.list[tuple[PriceKey, Price]]:
532
+ r"""
533
+ Return every item of this type currently stored in the tree.
534
+ """
535
+ def insurance_fund(self, key: InsuranceFundKey) -> typing.Optional[InsuranceFund]:
536
+ r"""
537
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
538
+ """
539
+ def store_insurance_fund(self, key: InsuranceFundKey, maybe_inner: typing.Optional[InsuranceFund]) -> H256:
540
+ r"""
541
+ Insert (`Some`) or delete (`None`) a leaf and return the new
542
+ SMT root hash.
543
+ """
544
+ def all_insurance_funds(self) -> builtins.list[tuple[InsuranceFundKey, InsuranceFund]]:
545
+ r"""
546
+ Return every item of this type currently stored in the tree.
547
+ """
548
+ def stats(self, key: StatsKey) -> typing.Optional[Stats]:
549
+ r"""
550
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
551
+ """
552
+ def store_stats(self, key: StatsKey, maybe_inner: typing.Optional[Stats]) -> H256:
553
+ r"""
554
+ Insert (`Some`) or delete (`None`) a leaf and return the new
555
+ SMT root hash.
556
+ """
557
+ def all_stats(self) -> builtins.list[tuple[StatsKey, Stats]]:
558
+ r"""
559
+ Return every item of this type currently stored in the tree.
560
+ """
561
+ def signer(self, key: SignerKey) -> typing.Optional[Signer]:
562
+ r"""
563
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
564
+ """
565
+ def store_signer(self, key: SignerKey, maybe_inner: typing.Optional[Signer]) -> H256:
566
+ r"""
567
+ Insert (`Some`) or delete (`None`) a leaf and return the new
568
+ SMT root hash.
569
+ """
570
+ def all_signers(self) -> builtins.list[tuple[SignerKey, Signer]]:
571
+ r"""
572
+ Return every item of this type currently stored in the tree.
573
+ """
574
+ def specs(self, key: SpecsKey) -> typing.Optional[Specs]:
575
+ r"""
576
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
577
+ """
578
+ def store_specs(self, key: SpecsKey, maybe_inner: typing.Optional[Specs]) -> H256:
579
+ r"""
580
+ Insert (`Some`) or delete (`None`) a leaf and return the new
581
+ SMT root hash.
582
+ """
583
+ def all_specs(self) -> builtins.list[tuple[SpecsKey, Specs]]:
584
+ r"""
585
+ Return every item of this type currently stored in the tree.
586
+ """
587
+ def tradable_product(self, key: TradableProductKey) -> typing.Optional[TradableProduct]:
588
+ r"""
589
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
590
+ """
591
+ def store_tradable_product(self, key: TradableProductKey, maybe_inner: typing.Optional[TradableProduct]) -> H256:
592
+ r"""
593
+ Insert (`Some`) or delete (`None`) a leaf and return the new
594
+ SMT root hash.
595
+ """
596
+ def all_tradable_products(self) -> builtins.list[tuple[TradableProductKey, TradableProduct]]:
597
+ r"""
598
+ Return every item of this type currently stored in the tree.
599
+ """
600
+ def insurance_fund_contribution(self, key: InsuranceFundContributionKey) -> typing.Optional[InsuranceFundContribution]:
601
+ r"""
602
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
603
+ """
604
+ def store_insurance_fund_contribution(self, key: InsuranceFundContributionKey, maybe_inner: typing.Optional[InsuranceFundContribution]) -> H256:
605
+ r"""
606
+ Insert (`Some`) or delete (`None`) a leaf and return the new
607
+ SMT root hash.
608
+ """
609
+ def all_insurance_fund_contributions(self) -> builtins.list[tuple[InsuranceFundContributionKey, InsuranceFundContribution]]:
610
+ r"""
611
+ Return every item of this type currently stored in the tree.
612
+ """
613
+ def epoch_metadata(self, key: EpochMetadataKey) -> typing.Optional[EpochMetadata]:
614
+ r"""
615
+ Fetch the item stored at `key`, or `None` if the leaf is empty.
616
+ """
617
+ def store_epoch_metadata(self, key: EpochMetadataKey, maybe_inner: typing.Optional[EpochMetadata]) -> H256:
618
+ r"""
619
+ Insert (`Some`) or delete (`None`) a leaf and return the new
620
+ SMT root hash.
621
+ """
622
+ def all_epoch_metadatas(self) -> builtins.list[tuple[EpochMetadataKey, EpochMetadata]]:
623
+ r"""
624
+ Return every item of this type currently stored in the tree.
625
+ """
626
+ def all_leaves(self) -> builtins.list[tuple[H256, Item]]:
627
+ r"""
628
+ Helper that returns the filtered list described by the method.
629
+ """
630
+ def all_prices_for_symbol(self, symbol: ProductSymbol) -> builtins.list[tuple[PriceKey, Price]]:
631
+ r"""
632
+ Helper that returns the filtered list described by the method.
633
+ """
634
+ def all_positions_for_symbol(self, symbol: ProductSymbol) -> builtins.list[tuple[PositionKey, Position]]:
635
+ r"""
636
+ Helper that returns the filtered list described by the method.
637
+ """
638
+ def all_book_orders_for_symbol(self, symbol: ProductSymbol) -> builtins.list[tuple[BookOrderKey, BookOrder]]:
639
+ r"""
640
+ Helper that returns the filtered list described by the method.
641
+ """
642
+
643
+ @typing.final
644
+ class EpochMetadata:
645
+ r"""
646
+ Metadata about an epoch that has been transitioned.
647
+ """
648
+ @property
649
+ def ddx_fee_pool(self) -> Decimal:
650
+ r"""
651
+ The DDX fee pool. This represents the total DDX fees collected in this epoch and are
652
+ distributed among custodians during a valid checkpoint.
653
+ """
654
+ @ddx_fee_pool.setter
655
+ def ddx_fee_pool(self, value: Decimal) -> None:
656
+ r"""
657
+ The DDX fee pool. This represents the total DDX fees collected in this epoch and are
658
+ distributed among custodians during a valid checkpoint.
659
+ """
660
+ @property
661
+ def next_book_ordinals(self) -> builtins.dict[ProductSymbol, builtins.int]:
662
+ r"""
663
+ The next book ordinals for all of the active markets. This mapping
664
+ allows follower nodes to reliably generate the market index from the
665
+ sparse merkle tree. The ordinals are logged at the end of the epoch and are None if this is
666
+ the current epoch.
667
+ """
668
+ @next_book_ordinals.setter
669
+ def next_book_ordinals(self, value: builtins.dict[ProductSymbol, builtins.int]) -> None:
670
+ r"""
671
+ The next book ordinals for all of the active markets. This mapping
672
+ allows follower nodes to reliably generate the market index from the
673
+ sparse merkle tree. The ordinals are logged at the end of the epoch and are None if this is
674
+ the current epoch.
675
+ """
676
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
677
+ def __new__(cls, ddx_fee_pool: Decimal, next_book_ordinals: typing.Mapping[ProductSymbol, builtins.int]) -> EpochMetadata: ...
678
+ def __repr__(self) -> builtins.str: ...
679
+ def __deepcopy__(self, _memo: dict) -> EpochMetadata: ...
680
+ def as_item(self) -> Item:
681
+ r"""
682
+ Wrap this concrete structure into the generic [`Item`] enum.
683
+ """
684
+ @classmethod
685
+ def from_item(cls, item: Item) -> EpochMetadata:
686
+ r"""
687
+ Down-cast a generic [`Item`] into this concrete type.
688
+ """
689
+ def abi_encoded_value(self) -> builtins.bytes:
690
+ r"""
691
+ ABI-encode this value.
692
+ """
693
+ @classmethod
694
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
695
+ r"""
696
+ Decode bytes back into an [`Item`] of this concrete type.
697
+ """
698
+ def is_void(self) -> builtins.bool:
699
+ r"""
700
+ `true` when this value represents the special *void* marker
701
+ used to delete a leaf from the SMT.
702
+ """
703
+ @classmethod
704
+ def default(cls) -> EpochMetadata:
705
+ r"""
706
+ Return empty `EpochMetadata` with zero fee pool and no order ordinals.
707
+ """
708
+
709
+ @typing.final
710
+ class EpochMetadataKey:
711
+ @property
712
+ def epoch_id(self) -> builtins.int: ...
713
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
714
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
715
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
716
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
717
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
718
+ def __hash__(self) -> builtins.int: ...
719
+ def __new__(cls, epoch_id: builtins.int) -> EpochMetadataKey: ...
720
+ def __repr__(self) -> builtins.str: ...
721
+ def __deepcopy__(self, _memo: dict) -> EpochMetadataKey: ...
722
+ def encode_key(self) -> H256:
723
+ r"""
724
+ Encode this state-key into the 32-byte format used on-chain.
725
+ """
726
+ @classmethod
727
+ def decode_key(cls, value: H256) -> EpochMetadataKey:
728
+ r"""
729
+ Decode a previously-encoded key back into its strongly-typed form.
730
+ """
731
+
732
+ @typing.final
733
+ class H256:
734
+ r"""
735
+ Wrapped sparse_merkle_tree::H256.
736
+ """
737
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
738
+ @classmethod
739
+ def from_bytes(cls, b: builtins.bytes) -> H256:
740
+ r"""
741
+ Construct an `H256` from a 32-byte buffer passed from Python.
742
+ Raises `H256Error` when the supplied slice is not exactly 32 bytes long.
743
+ """
744
+ def as_bytes(self) -> builtins.bytes:
745
+ r"""
746
+ Return the underlying 32-byte value as an immutable `bytes`/`memoryview`.
747
+ """
748
+ @staticmethod
749
+ def zero() -> H256:
750
+ r"""
751
+ Return a new zero hash (all bits set to 0).
752
+ """
753
+ def is_zero(self) -> builtins.bool:
754
+ r"""
755
+ `true` if this value equals the zero hash.
756
+ """
757
+ def get_bit(self, i: builtins.int) -> builtins.bool:
758
+ r"""
759
+ Return the bit at position `i` (0 = most-significant bit).
760
+ """
761
+ def set_bit(self, i: builtins.int) -> None:
762
+ r"""
763
+ Set the bit at position `i` to `1`.
764
+ """
765
+ def clear_bit(self, i: builtins.int) -> None:
766
+ r"""
767
+ Clear the bit at position `i` (set it to `0`).
768
+ """
769
+ def fork_height(self, key: H256) -> builtins.int:
770
+ r"""
771
+ Return the length (in bits) of the common prefix between this key and `key`.
772
+ """
773
+ def parent_path(self, height: builtins.int) -> H256:
774
+ r"""
775
+ Return a new key that keeps the first `height` bits of this key
776
+ (i.e. the path of the parent node at that height).
777
+ """
778
+ def copy_bits(self, start: builtins.int) -> H256:
779
+ r"""
780
+ Copy the suffix of this key starting at bit `start` into a new `H256`.
781
+ """
782
+ def __setstate__(self, state: typing.Any) -> None: ...
783
+ def __getstate__(self) -> typing.Any: ...
784
+ def __repr__(self) -> builtins.str: ...
785
+ def __str__(self) -> builtins.str: ...
786
+
787
+ class H256Error(builtins.Exception):
788
+ r"""
789
+ sparse_merkle_tree::H256 error
790
+ """
791
+ ...
792
+
793
+ @typing.final
794
+ class IndexFundPerpetual:
795
+ @property
796
+ def allocation(self) -> builtins.dict[builtins.str, Decimal]: ...
797
+ @property
798
+ def rebalance_interval(self) -> builtins.int: ...
799
+ @property
800
+ def initial_index_price(self) -> Decimal: ...
801
+ @property
802
+ def tick_size(self) -> Decimal: ...
803
+ @property
804
+ def max_order_notional(self) -> Decimal: ...
805
+ @property
806
+ def max_taker_price_deviation(self) -> Decimal: ...
807
+ @property
808
+ def min_order_size(self) -> Decimal: ...
809
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
810
+ def __new__(cls, **kwds: typing.Any) -> IndexFundPerpetual: ...
811
+
812
+ @typing.final
813
+ class IndexPrice:
814
+ r"""
815
+ An index price is the price update of an instrument coming from the oracle.
816
+
817
+ It is signed by the oracle's enclave.
818
+ """
819
+ @property
820
+ def symbol(self) -> ProductSymbol:
821
+ r"""
822
+ Symbol of the instrument
823
+ """
824
+ @property
825
+ def price(self) -> Decimal:
826
+ r"""
827
+ Current market price in the source exchange
828
+ """
829
+ @property
830
+ def prev_price(self) -> Decimal:
831
+ r"""
832
+ The previous price update. Useful to prove that no prices were skipped.
833
+ """
834
+ @property
835
+ def metadata(self) -> PriceMetadata:
836
+ r"""
837
+ Additional metadata required by the oracle to initialize
838
+ """
839
+ @property
840
+ def timestamp(self) -> builtins.int: ...
841
+ @property
842
+ def json(self) -> typing.Any: ...
843
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
844
+ def __new__(cls, symbol: ProductSymbol, price: Decimal, prev_price: Decimal, metadata: PriceMetadata, timestamp: builtins.int) -> IndexPrice: ...
845
+ def __repr__(self) -> builtins.str: ...
846
+ def hash(self) -> builtins.str:
847
+ r"""
848
+ Compute the hash of this index price request.
849
+ """
850
+
851
+ @typing.final
852
+ class InsuranceFund:
853
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
854
+ def __repr__(self) -> builtins.str: ...
855
+ def __deepcopy__(self, _memo: dict) -> InsuranceFund: ...
856
+ def as_item(self) -> Item:
857
+ r"""
858
+ Wrap this concrete structure into the generic [`Item`] enum.
859
+ """
860
+ @classmethod
861
+ def from_item(cls, item: Item) -> InsuranceFund:
862
+ r"""
863
+ Down-cast a generic [`Item`] into this concrete type.
864
+ """
865
+ def abi_encoded_value(self) -> builtins.bytes:
866
+ r"""
867
+ ABI-encode this value.
868
+ """
869
+ @classmethod
870
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
871
+ r"""
872
+ Decode bytes back into an [`Item`] of this concrete type.
873
+ """
874
+ def is_void(self) -> builtins.bool:
875
+ r"""
876
+ `true` when this value represents the special *void* marker
877
+ used to delete a leaf from the SMT.
878
+ """
879
+ def __len__(self) -> builtins.int: ...
880
+ def __getitem__(self, key: TokenSymbol) -> Decimal: ...
881
+ def __setitem__(self, key: TokenSymbol, value: Decimal) -> None: ...
882
+ def __new__(cls, amount: Decimal, symbol: TokenSymbol) -> InsuranceFund:
883
+ r"""
884
+ Construct a balance initialized with `amount` of `symbol`.
885
+ """
886
+ @classmethod
887
+ def default(cls) -> InsuranceFund:
888
+ r"""
889
+ Return an empty balance with zero for every token.
890
+ """
891
+ @classmethod
892
+ def new_from_many(cls, amounts: typing.Mapping[TokenSymbol, Decimal]) -> InsuranceFund:
893
+ r"""
894
+ Construct a balance from a mapping of token amounts.
895
+ """
896
+ def total_value(self) -> Decimal:
897
+ r"""
898
+ Total value of this balance, obtained by summing
899
+ every token amount. This will be either in USD or DDX, depending on
900
+ its contents.
901
+ """
902
+ def amounts(self) -> builtins.list[Decimal]:
903
+ r"""
904
+ Raw amounts ordered by the canonical token list.
905
+ """
906
+
907
+ @typing.final
908
+ class InsuranceFundContribution:
909
+ r"""
910
+ An insurance fund contribution
911
+ """
912
+ @property
913
+ def avail_balance(self) -> Balance:
914
+ r"""
915
+ Total contribution to the insurance fund, minus any withdrawals
916
+ """
917
+ @property
918
+ def locked_balance(self) -> Balance:
919
+ r"""
920
+ Balance locked for withdrawal
921
+ """
922
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
923
+ def __new__(cls, avail_balance: Balance, locked_balance: Balance) -> InsuranceFundContribution: ...
924
+ def __repr__(self) -> builtins.str: ...
925
+ def __deepcopy__(self, _memo: dict) -> InsuranceFundContribution: ...
926
+ def as_item(self) -> Item:
927
+ r"""
928
+ Wrap this concrete structure into the generic [`Item`] enum.
929
+ """
930
+ @classmethod
931
+ def from_item(cls, item: Item) -> InsuranceFundContribution:
932
+ r"""
933
+ Down-cast a generic [`Item`] into this concrete type.
934
+ """
935
+ def abi_encoded_value(self) -> builtins.bytes:
936
+ r"""
937
+ ABI-encode this value.
938
+ """
939
+ @classmethod
940
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
941
+ r"""
942
+ Decode bytes back into an [`Item`] of this concrete type.
943
+ """
944
+ def is_void(self) -> builtins.bool:
945
+ r"""
946
+ `true` when this value represents the special *void* marker
947
+ used to delete a leaf from the SMT.
948
+ """
949
+ @classmethod
950
+ def default(cls) -> InsuranceFundContribution:
951
+ r"""
952
+ Return an empty `InsuranceFundContribution` with zero balances.
953
+ """
954
+ def set_avail_balance(self, symbol: TokenSymbol, amount: Decimal) -> None:
955
+ r"""
956
+ Update this contributor's available balance for `symbol` to `amount`.
957
+ """
958
+ def set_locked_balance(self, symbol: TokenSymbol, amount: Decimal) -> None:
959
+ r"""
960
+ Update this contributor's locked balance for `symbol` to `amount`.
961
+ """
962
+ def update_avail_balance(self, symbol: TokenSymbol, amount: Decimal) -> Balance:
963
+ r"""
964
+ Return a copy of `avail_balance` with `symbol` set to `amount`.
965
+ """
966
+ def update_locked_balance(self, symbol: TokenSymbol, amount: Decimal) -> Balance:
967
+ r"""
968
+ Return a copy of `locked_balance` with `symbol` set to `amount`.
969
+ """
970
+
971
+ @typing.final
972
+ class InsuranceFundContributionKey:
973
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
974
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
975
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
976
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
977
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
978
+ def __hash__(self) -> builtins.int: ...
979
+ def __repr__(self) -> builtins.str: ...
980
+ def __deepcopy__(self, _memo: dict) -> InsuranceFundContributionKey: ...
981
+ def encode_key(self) -> H256:
982
+ r"""
983
+ Encode this state-key into the 32-byte format used on-chain.
984
+ """
985
+ @classmethod
986
+ def decode_key(cls, value: H256) -> InsuranceFundContributionKey:
987
+ r"""
988
+ Decode a previously-encoded key back into its strongly-typed form.
989
+ """
990
+ def __new__(cls, inner: builtins.str) -> InsuranceFundContributionKey: ...
991
+
992
+ @typing.final
993
+ class InsuranceFundKey:
994
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
995
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
996
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
997
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
998
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
999
+ def __hash__(self) -> builtins.int: ...
1000
+ def __new__(cls) -> InsuranceFundKey: ...
1001
+ def __repr__(self) -> builtins.str: ...
1002
+ def __deepcopy__(self, _memo: dict) -> InsuranceFundKey: ...
1003
+ def encode_key(self) -> H256:
1004
+ r"""
1005
+ Encode this state-key into the 32-byte format used on-chain.
1006
+ """
1007
+ @classmethod
1008
+ def decode_key(cls, value: H256) -> InsuranceFundKey:
1009
+ r"""
1010
+ Decode a previously-encoded key back into its strongly-typed form.
1011
+ """
1012
+
1013
+ @typing.final
1014
+ class Item:
1015
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1016
+ def __repr__(self) -> builtins.str: ...
1017
+ def item_kind(self) -> ItemKind:
1018
+ r"""
1019
+ Return this item's [`ItemKind`] discriminant.
1020
+ """
1021
+ def abi_encoded_value(self) -> builtins.bytes:
1022
+ r"""
1023
+ ABI-encode the wrapped value for hashing / storage.
1024
+ """
1025
+ @classmethod
1026
+ def abi_decode_value_into_item(cls, kind: ItemKind, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1027
+ r"""
1028
+ Decode the bytes produced by `abi_encoded_value()` back into
1029
+ an [`Item`] of the supplied kind.
1030
+ """
1031
+ @classmethod
1032
+ def decode_key(cls, kind: ItemKind, encoded_key: H256) -> typing.Any:
1033
+ r"""
1034
+ Decode a 32-byte SMT key into its strongly-typed form for
1035
+ the provided item kind.
1036
+ """
1037
+
1038
+ class MarkPriceMetadata:
1039
+ r"""
1040
+ Metadata for calculating the mark price, along with the current index price
1041
+ """
1042
+ @property
1043
+ def ema(self) -> typing.Optional[Decimal]: ...
1044
+ @classmethod
1045
+ def from_dict(cls, ob: typing.Any) -> MarkPriceMetadata:
1046
+ r"""
1047
+ Deserialize `MarkPriceMetadata` from the operator serialization.
1048
+ """
1049
+ def __repr__(self) -> builtins.str: ...
1050
+ def __deepcopy__(self, _memo: dict) -> MarkPriceMetadata: ...
1051
+ @typing.final
1052
+ class Ema(MarkPriceMetadata):
1053
+ r"""
1054
+ The mark price is calculated using the ema
1055
+ The calculated exponential moving address (input to the mark price and verifiable using orderbook snapshot in the aggregate tree)
1056
+ """
1057
+ __match_args__ = ("_0",)
1058
+ @property
1059
+ def _0(self) -> Decimal: ...
1060
+ def __new__(cls, _0: Decimal) -> MarkPriceMetadata.Ema: ...
1061
+ def __len__(self) -> builtins.int: ...
1062
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
1063
+
1064
+ @typing.final
1065
+ class Average(MarkPriceMetadata):
1066
+ r"""
1067
+ The mark price is calculated as an average using the sum and amount of previous index prices
1068
+ Mark price = (accum + index_price) / (count + 1)
1069
+ """
1070
+ __match_args__ = ("accum", "count",)
1071
+ @property
1072
+ def accum(self) -> Decimal: ...
1073
+ @property
1074
+ def count(self) -> builtins.int: ...
1075
+ def __new__(cls, accum: Decimal, count: builtins.int) -> MarkPriceMetadata.Average: ...
1076
+
1077
+
1078
+ @typing.final
1079
+ class MarketClose:
1080
+ @property
1081
+ def result(self) -> builtins.str: ...
1082
+ @property
1083
+ def timestamp(self) -> builtins.int: ...
1084
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1085
+
1086
+ @typing.final
1087
+ class MerkleProof:
1088
+ def __repr__(self) -> builtins.str: ...
1089
+ def as_bytes(self) -> builtins.bytes:
1090
+ r"""
1091
+ Return the compiled proof as a raw byte slice suitable for
1092
+ on-chain verification.
1093
+ """
1094
+
1095
+ @typing.final
1096
+ class MintPriceCheckpoint:
1097
+ @property
1098
+ def time_value(self) -> builtins.int: ...
1099
+ @property
1100
+ def json(self) -> typing.Any: ...
1101
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1102
+ def __new__(cls, time_value: builtins.int) -> MintPriceCheckpoint: ...
1103
+ def __repr__(self) -> builtins.str: ...
1104
+
1105
+ @typing.final
1106
+ class ModifyOrderIntent:
1107
+ r"""
1108
+ Modify order intents are intents that modify the original order details of a specific order
1109
+ identified by its order hash.
1110
+
1111
+ This is identical to a cancel and a re-placing of the new order,
1112
+ the only difference from doing them separately being that the execution is atomic when executed
1113
+ as a ModifyOrderIntent.
1114
+ """
1115
+ @property
1116
+ def order_hash(self) -> builtins.str:
1117
+ r"""
1118
+ Order hash of the order to modify
1119
+ """
1120
+ @property
1121
+ def symbol(self) -> ProductSymbol:
1122
+ r"""
1123
+ Symbol of the market
1124
+ """
1125
+ @property
1126
+ def strategy(self) -> builtins.str:
1127
+ r"""
1128
+ Strategy Id (label)
1129
+ """
1130
+ @property
1131
+ def side(self) -> OrderSide:
1132
+ r"""
1133
+ Side: 0-Long, 1-Short
1134
+ """
1135
+ @property
1136
+ def order_type(self) -> OrderType:
1137
+ r"""
1138
+ 0-Limit, 1-Market, 2-Stop-Limit
1139
+ """
1140
+ @property
1141
+ def nonce(self) -> builtins.str:
1142
+ r"""
1143
+ A salt for uniqueness of the EIP-712 hash function. May optionally have business meaning to the client.
1144
+ """
1145
+ @property
1146
+ def amount(self) -> Decimal:
1147
+ r"""
1148
+ Order amount
1149
+ """
1150
+ @property
1151
+ def price(self) -> Decimal:
1152
+ r"""
1153
+ Order price. For a limit order, it is the limit price.
1154
+ """
1155
+ @property
1156
+ def stop_price(self) -> Decimal:
1157
+ r"""
1158
+ Stop price. Set to 0 if the order is not a Stop-Limit.
1159
+ """
1160
+ @property
1161
+ def session_key_signature(self) -> typing.Optional[builtins.str]:
1162
+ r"""
1163
+ EIP-191 signature of the 1CT session public key
1164
+ """
1165
+ @session_key_signature.setter
1166
+ def session_key_signature(self, value: typing.Optional[builtins.str]) -> None:
1167
+ r"""
1168
+ EIP-191 signature of the 1CT session public key
1169
+ """
1170
+ @property
1171
+ def signature(self) -> builtins.str:
1172
+ r"""
1173
+ EIP-712 signature of the order intent attributes
1174
+ """
1175
+ @signature.setter
1176
+ def signature(self, value: builtins.str) -> None:
1177
+ r"""
1178
+ EIP-712 signature of the order intent attributes
1179
+ """
1180
+ @property
1181
+ def json(self) -> typing.Any: ...
1182
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1183
+ def __new__(cls, order_hash: builtins.str, symbol: ProductSymbol, strategy: builtins.str, side: OrderSide, order_type: OrderType, nonce: builtins.str, amount: Decimal, price: Decimal, stop_price: Decimal, session_key_signature: typing.Optional[builtins.str], signature: typing.Optional[builtins.str] = None) -> ModifyOrderIntent: ...
1184
+ def __repr__(self) -> builtins.str: ...
1185
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
1186
+ r"""
1187
+ Compute the EIP-712 digest for this intent.
1188
+ Passing `message_metadata=(chain_id, verifying_contract)`
1189
+ overrides the default values used in the hash.
1190
+ """
1191
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
1192
+ r"""
1193
+ Recover the `(eip712_hash, trader_address)` that signed
1194
+ this intent.
1195
+ """
1196
+ def hash(self) -> builtins.str:
1197
+ r"""
1198
+ Compute the hash of this modify order intent.
1199
+ """
1200
+
1201
+ @typing.final
1202
+ class OperatorContext:
1203
+ r"""
1204
+ Holds application-layer environment information
1205
+
1206
+ Information in here as analogous to something like the operating system locale, but at the application layer.
1207
+ In the git application for instance, such context includes name and email.
1208
+ Storing this information globally saves us the noise of repeating the same informational arguments
1209
+ in multiple functions throughout the application.
1210
+
1211
+ This does NOT include logic inputs of individual units like configuration parameters (like db credentials),
1212
+ business rules (like epoch sizes), etc. We capture these in `TrustedContext` and `NodeContext`, and
1213
+ pass them explicitly to individual components (in the name of functional testability).
1214
+
1215
+ This information does not impact logic routes (testability)
1216
+ """
1217
+ @property
1218
+ def contract_address(self) -> builtins.str: ...
1219
+ @property
1220
+ def chain_id(self) -> builtins.int: ...
1221
+
1222
+ @typing.final
1223
+ class OrderIntent:
1224
+ r"""
1225
+ Order intents are meta-transactions signed by traders Ethereum wallets and submitted to operators.
1226
+
1227
+ They come in through the API, signed by their maker. We verify that:
1228
+
1229
+ a) the signatures recovers the `trader_address`
1230
+ b) the maker has enough collateral to be solvent when the order gets filled
1231
+
1232
+ Following verification, we match an order intent against the order book. This may result in
1233
+ fill(s) or posting into the order book depending on the matches found.
1234
+ """
1235
+ @property
1236
+ def symbol(self) -> ProductSymbol:
1237
+ r"""
1238
+ Symbol of the market
1239
+ """
1240
+ @property
1241
+ def strategy(self) -> builtins.str:
1242
+ r"""
1243
+ Strategy Id (label)
1244
+ """
1245
+ @property
1246
+ def side(self) -> OrderSide:
1247
+ r"""
1248
+ Side: 0-Long, 1-Short
1249
+ """
1250
+ @property
1251
+ def order_type(self) -> OrderType:
1252
+ r"""
1253
+ 0-Limit, 1-Market, 2-Stop-Limit
1254
+ """
1255
+ @property
1256
+ def nonce(self) -> builtins.str:
1257
+ r"""
1258
+ A salt for uniqueness of the EIP-712 hash function. May optionally have business meaning to the client.
1259
+ """
1260
+ @property
1261
+ def amount(self) -> Decimal:
1262
+ r"""
1263
+ Order amount
1264
+ """
1265
+ @property
1266
+ def price(self) -> Decimal:
1267
+ r"""
1268
+ Order price. For a limit order, it is the limit price.
1269
+ """
1270
+ @property
1271
+ def stop_price(self) -> Decimal:
1272
+ r"""
1273
+ Stop price. Set to 0 if the order is not a Stop-Limit.
1274
+ """
1275
+ @property
1276
+ def session_key_signature(self) -> typing.Optional[builtins.str]:
1277
+ r"""
1278
+ EIP-191 signature of the 1CT session public key
1279
+ """
1280
+ @session_key_signature.setter
1281
+ def session_key_signature(self, value: typing.Optional[builtins.str]) -> None:
1282
+ r"""
1283
+ EIP-191 signature of the 1CT session public key
1284
+ """
1285
+ @property
1286
+ def signature(self) -> builtins.str:
1287
+ r"""
1288
+ EIP-712 signature of the order intent attributes
1289
+ """
1290
+ @signature.setter
1291
+ def signature(self, value: builtins.str) -> None:
1292
+ r"""
1293
+ EIP-712 signature of the order intent attributes
1294
+ """
1295
+ @property
1296
+ def json(self) -> typing.Any: ...
1297
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1298
+ def __new__(cls, symbol: ProductSymbol, strategy: builtins.str, side: OrderSide, order_type: OrderType, nonce: builtins.str, amount: Decimal, price: Decimal, stop_price: Decimal, session_key_signature: typing.Optional[builtins.str], signature: typing.Optional[builtins.str] = None) -> OrderIntent: ...
1299
+ def __repr__(self) -> builtins.str: ...
1300
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
1301
+ r"""
1302
+ Compute the EIP-712 digest for this intent.
1303
+ Passing `message_metadata=(chain_id, verifying_contract)`
1304
+ overrides the default values used in the hash.
1305
+ """
1306
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
1307
+ r"""
1308
+ Recover the `(eip712_hash, trader_address)` that signed
1309
+ this intent.
1310
+ """
1311
+ def hash(self) -> builtins.str:
1312
+ r"""
1313
+ Compute the hash of this order intent.
1314
+ """
1315
+
1316
+ @typing.final
1317
+ class OrderType:
1318
+ Limit: OrderType = ...
1319
+ Market: OrderType = ...
1320
+ StopLimit: OrderType = ...
1321
+ PostOnlyLimit: OrderType = ...
1322
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1323
+ def __repr__(self) -> builtins.str: ...
1324
+
1325
+ @typing.final
1326
+ class Position:
1327
+ r"""
1328
+ An individual position held in an strategy
1329
+ """
1330
+ @property
1331
+ def side(self) -> PositionSide:
1332
+ r"""
1333
+ The position side: Long = 0, Short = 1
1334
+ """
1335
+ @side.setter
1336
+ def side(self, value: PositionSide) -> None:
1337
+ r"""
1338
+ The position side: Long = 0, Short = 1
1339
+ """
1340
+ @property
1341
+ def balance(self) -> Decimal:
1342
+ r"""
1343
+ The position size denominated in the same unit as the underlying
1344
+ """
1345
+ @balance.setter
1346
+ def balance(self, value: Decimal) -> None:
1347
+ r"""
1348
+ The position size denominated in the same unit as the underlying
1349
+ """
1350
+ @property
1351
+ def avg_entry_price(self) -> Decimal:
1352
+ r"""
1353
+ The average entry price (updated when adding to the position)
1354
+ """
1355
+ @avg_entry_price.setter
1356
+ def avg_entry_price(self, value: Decimal) -> None:
1357
+ r"""
1358
+ The average entry price (updated when adding to the position)
1359
+ """
1360
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1361
+ def __new__(cls, side: PositionSide, balance: Decimal, avg_entry_price: Decimal) -> Position: ...
1362
+ def __repr__(self) -> builtins.str: ...
1363
+ def __deepcopy__(self, _memo: dict) -> Position: ...
1364
+ def as_item(self) -> Item:
1365
+ r"""
1366
+ Wrap this concrete structure into the generic [`Item`] enum.
1367
+ """
1368
+ @classmethod
1369
+ def from_item(cls, item: Item) -> Position:
1370
+ r"""
1371
+ Down-cast a generic [`Item`] into this concrete type.
1372
+ """
1373
+ def abi_encoded_value(self) -> builtins.bytes:
1374
+ r"""
1375
+ ABI-encode this value.
1376
+ """
1377
+ @classmethod
1378
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1379
+ r"""
1380
+ Decode bytes back into an [`Item`] of this concrete type.
1381
+ """
1382
+ def is_void(self) -> builtins.bool:
1383
+ r"""
1384
+ `true` when this value represents the special *void* marker
1385
+ used to delete a leaf from the SMT.
1386
+ """
1387
+ @classmethod
1388
+ def default(cls) -> Position:
1389
+ r"""
1390
+ Return an empty `Position` with zero balance and no entry price.
1391
+ """
1392
+ def bankruptcy_price(self, mark_price: Decimal, account_total_value: Decimal) -> Decimal:
1393
+ r"""
1394
+ Bankruptcy price at which margin would be exhausted.
1395
+ """
1396
+ def unrealized_pnl(self, price: Decimal) -> Decimal:
1397
+ r"""
1398
+ Unrealized profit and loss at the specified `price`.
1399
+ """
1400
+ def avg_pnl(self, price: Decimal) -> Decimal:
1401
+ r"""
1402
+ Average P&L per contract at the specified `price`.
1403
+ """
1404
+ def increase(self, price: Decimal, amount: Decimal) -> tuple[Position, Decimal]:
1405
+ r"""
1406
+ Increase position size by `amount` at `price`; returns the new
1407
+ position together with any realized P&L.
1408
+ """
1409
+ def decrease(self, price: Decimal, amount: Decimal) -> tuple[Position, Decimal]:
1410
+ r"""
1411
+ Decrease position size by `amount` at `price`; returns the new
1412
+ position and realized P&L.
1413
+ """
1414
+ def cross_over(self, price: Decimal, amount: Decimal) -> tuple[Position, Decimal]:
1415
+ r"""
1416
+ Reverse side by `amount` at `price`; returns updated position and P&L.
1417
+ """
1418
+
1419
+ @typing.final
1420
+ class PositionKey:
1421
+ @property
1422
+ def trader_address(self) -> builtins.str: ...
1423
+ @property
1424
+ def strategy_id_hash(self) -> builtins.str: ...
1425
+ @property
1426
+ def symbol(self) -> ProductSymbol: ...
1427
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1428
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1429
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1430
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1431
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1432
+ def __hash__(self) -> builtins.int: ...
1433
+ def __new__(cls, trader_address: builtins.str, strategy_id_hash: builtins.str, symbol: ProductSymbol) -> PositionKey: ...
1434
+ def __repr__(self) -> builtins.str: ...
1435
+ def __deepcopy__(self, _memo: dict) -> PositionKey: ...
1436
+ def encode_key(self) -> H256:
1437
+ r"""
1438
+ Encode this state-key into the 32-byte format used on-chain.
1439
+ """
1440
+ @classmethod
1441
+ def decode_key(cls, value: H256) -> PositionKey:
1442
+ r"""
1443
+ Decode a previously-encoded key back into its strongly-typed form.
1444
+ """
1445
+ def as_strategy_key(self) -> StrategyKey:
1446
+ r"""
1447
+ Convert this position key into its owner `StrategyKey`.
1448
+ """
1449
+
1450
+ @typing.final
1451
+ class Price:
1452
+ r"""
1453
+ A price value (used for funding and liquidations)
1454
+ """
1455
+ @property
1456
+ def index_price(self) -> Decimal:
1457
+ r"""
1458
+ The index price number coming from a oracle
1459
+ """
1460
+ @index_price.setter
1461
+ def index_price(self, value: Decimal) -> None:
1462
+ r"""
1463
+ The index price number coming from a oracle
1464
+ """
1465
+ @property
1466
+ def mark_price_metadata(self) -> MarkPriceMetadata: ...
1467
+ @mark_price_metadata.setter
1468
+ def mark_price_metadata(self, value: MarkPriceMetadata) -> None: ...
1469
+ @property
1470
+ def ordinal(self) -> builtins.int: ...
1471
+ @ordinal.setter
1472
+ def ordinal(self, value: builtins.int) -> None: ...
1473
+ @property
1474
+ def time_value(self) -> builtins.int: ...
1475
+ @time_value.setter
1476
+ def time_value(self, value: builtins.int) -> None: ...
1477
+ @property
1478
+ def mark_price(self) -> Decimal: ...
1479
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1480
+ def __new__(cls, index_price: Decimal, mark_price_metadata: MarkPriceMetadata, ordinal: builtins.int, time_value: builtins.int) -> Price: ...
1481
+ def __repr__(self) -> builtins.str: ...
1482
+ def __deepcopy__(self, _memo: dict) -> Price: ...
1483
+ def as_item(self) -> Item:
1484
+ r"""
1485
+ Wrap this concrete structure into the generic [`Item`] enum.
1486
+ """
1487
+ @classmethod
1488
+ def from_item(cls, item: Item) -> Price:
1489
+ r"""
1490
+ Down-cast a generic [`Item`] into this concrete type.
1491
+ """
1492
+ def abi_encoded_value(self) -> builtins.bytes:
1493
+ r"""
1494
+ ABI-encode this value.
1495
+ """
1496
+ @classmethod
1497
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1498
+ r"""
1499
+ Decode bytes back into an [`Item`] of this concrete type.
1500
+ """
1501
+ def is_void(self) -> builtins.bool:
1502
+ r"""
1503
+ `true` when this value represents the special *void* marker
1504
+ used to delete a leaf from the SMT.
1505
+ """
1506
+
1507
+ @typing.final
1508
+ class PriceKey:
1509
+ @property
1510
+ def symbol(self) -> ProductSymbol: ...
1511
+ @property
1512
+ def index_price_hash(self) -> builtins.str: ...
1513
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1514
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1515
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1516
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1517
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1518
+ def __hash__(self) -> builtins.int: ...
1519
+ def __new__(cls, symbol: ProductSymbol, index_price_hash: builtins.str) -> PriceKey: ...
1520
+ def __repr__(self) -> builtins.str: ...
1521
+ def __deepcopy__(self, _memo: dict) -> PriceKey: ...
1522
+ def encode_key(self) -> H256:
1523
+ r"""
1524
+ Encode this state-key into the 32-byte format used on-chain.
1525
+ """
1526
+ @classmethod
1527
+ def decode_key(cls, value: H256) -> PriceKey:
1528
+ r"""
1529
+ Decode a previously-encoded key back into its strongly-typed form.
1530
+ """
1531
+
1532
+ @typing.final
1533
+ class PriceMetadata:
1534
+ @property
1535
+ def weights(self) -> typing.Optional[builtins.dict[builtins.str, Decimal]]: ...
1536
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1537
+ @classmethod
1538
+ def from_dict(cls, ob: typing.Any) -> PriceMetadata:
1539
+ r"""
1540
+ Deserialize `PriceMetadata` from the operator serialization.
1541
+ """
1542
+ def __repr__(self) -> builtins.str: ...
1543
+
1544
+ class ProductSpecs:
1545
+ @property
1546
+ def tick_size(self) -> Decimal: ...
1547
+ @property
1548
+ def max_order_notional(self) -> Decimal: ...
1549
+ @property
1550
+ def max_taker_price_deviation(self) -> Decimal: ...
1551
+ @property
1552
+ def min_order_size(self) -> Decimal: ...
1553
+ def __repr__(self) -> builtins.str: ...
1554
+ def underlying_symbols(self, tradable_params: typing.Optional[TradableProductParameters]) -> builtins.list[builtins.str]:
1555
+ r"""
1556
+ Return the list of underlying symbols referenced by this specification.
1557
+ """
1558
+ @typing.final
1559
+ class SingleNamePerpetual(ProductSpecs):
1560
+ __match_args__ = ("_0",)
1561
+ @property
1562
+ def _0(self) -> SingleNamePerpetual: ...
1563
+ def __new__(cls, _0: SingleNamePerpetual) -> ProductSpecs.SingleNamePerpetual: ...
1564
+ def __len__(self) -> builtins.int: ...
1565
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
1566
+
1567
+ @typing.final
1568
+ class IndexFundPerpetual(ProductSpecs):
1569
+ __match_args__ = ("_0",)
1570
+ @property
1571
+ def _0(self) -> IndexFundPerpetual: ...
1572
+ def __new__(cls, _0: IndexFundPerpetual) -> ProductSpecs.IndexFundPerpetual: ...
1573
+ def __len__(self) -> builtins.int: ...
1574
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
1575
+
1576
+ @typing.final
1577
+ class QuarterlyExpiryFuture(ProductSpecs):
1578
+ __match_args__ = ("_0",)
1579
+ @property
1580
+ def _0(self) -> QuarterlyExpiryFuture: ...
1581
+ def __new__(cls, _0: QuarterlyExpiryFuture) -> ProductSpecs.QuarterlyExpiryFuture: ...
1582
+ def __len__(self) -> builtins.int: ...
1583
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
1584
+
1585
+ @typing.final
1586
+ class BinaryPredictionFuture(ProductSpecs):
1587
+ __match_args__ = ("_0",)
1588
+ @property
1589
+ def _0(self) -> BinaryPredictionFuture: ...
1590
+ def __new__(cls, _0: BinaryPredictionFuture) -> ProductSpecs.BinaryPredictionFuture: ...
1591
+ def __len__(self) -> builtins.int: ...
1592
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
1593
+
1594
+
1595
+ @typing.final
1596
+ class ProductSymbol:
1597
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1598
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1599
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1600
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1601
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1602
+ def __hash__(self) -> builtins.int: ...
1603
+ def __str__(self) -> builtins.str: ...
1604
+ def __new__(cls, symbol: builtins.str) -> ProductSymbol:
1605
+ r"""
1606
+ Construct a product symbol from a string representation such as `"ETHP"`.
1607
+ Returns an error if the supplied string cannot be parsed.
1608
+ """
1609
+ def __deepcopy__(self, _memo: dict) -> ProductSymbol: ...
1610
+ def __repr__(self) -> builtins.str: ...
1611
+ def __len__(self) -> builtins.int: ...
1612
+ def is_perpetual(self) -> builtins.bool:
1613
+ r"""
1614
+ Return `true` when this symbol represents a perpetual contract.
1615
+ """
1616
+ def is_future(self) -> builtins.bool:
1617
+ r"""
1618
+ Return `true` when this symbol corresponds to a fixed-expiry future.
1619
+ """
1620
+ def futures_quarter(self) -> typing.Optional[Quarter]:
1621
+ r"""
1622
+ For futures symbols, return the associated `Quarter`; otherwise `None`.
1623
+ """
1624
+ def price_metadata(self) -> PriceMetadata:
1625
+ r"""
1626
+ Construct a `PriceMetadata` value appropriate for this product type.
1627
+ """
1628
+
1629
+ @typing.final
1630
+ class ProfileUpdateIntent:
1631
+ @property
1632
+ def nonce(self) -> builtins.str:
1633
+ r"""
1634
+ A salt for uniqueness of the EIP-712 hash function. May optionally have business meaning to the client.
1635
+ """
1636
+ @property
1637
+ def pay_fees_in_ddx(self) -> builtins.bool:
1638
+ r"""
1639
+ Sets the flag in the trader profile
1640
+ """
1641
+ @property
1642
+ def referral_address(self) -> typing.Optional[builtins.str]:
1643
+ r"""
1644
+ Sets a one-time referral address.
1645
+ """
1646
+ @property
1647
+ def signature(self) -> builtins.str:
1648
+ r"""
1649
+ EIP-712 signature of the order intent attributes
1650
+ """
1651
+ @signature.setter
1652
+ def signature(self, value: builtins.str) -> None:
1653
+ r"""
1654
+ EIP-712 signature of the order intent attributes
1655
+ """
1656
+ @property
1657
+ def json(self) -> typing.Any: ...
1658
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1659
+ def __new__(cls, nonce: builtins.str, pay_fees_in_ddx: builtins.bool, referral_address: typing.Optional[builtins.str] = None, signature: typing.Optional[builtins.str] = None) -> ProfileUpdateIntent: ...
1660
+ def __repr__(self) -> builtins.str: ...
1661
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
1662
+ r"""
1663
+ Compute the EIP-712 digest for this intent.
1664
+ Passing `message_metadata=(chain_id, verifying_contract)`
1665
+ overrides the default values used in the hash.
1666
+ """
1667
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
1668
+ r"""
1669
+ Recover the `(eip712_hash, trader_address)` that signed
1670
+ this intent.
1671
+ """
1672
+
1673
+ @typing.final
1674
+ class QuarterlyExpiryFuture:
1675
+ r"""
1676
+ Quarterly expiry futures are contracts that expire at a month 28-day basis.
1677
+
1678
+ This only include attributes common to all quarterly expiry futures.
1679
+ """
1680
+ @property
1681
+ def underlying(self) -> builtins.str: ...
1682
+ @property
1683
+ def tick_size(self) -> Decimal: ...
1684
+ @property
1685
+ def max_order_notional(self) -> Decimal: ...
1686
+ @property
1687
+ def max_taker_price_deviation(self) -> Decimal: ...
1688
+ @property
1689
+ def min_order_size(self) -> Decimal: ...
1690
+ def __new__(cls, **kwds: typing.Any) -> QuarterlyExpiryFuture: ...
1691
+
1692
+ @typing.final
1693
+ class SettlementAction:
1694
+ TradeMining: SettlementAction = ...
1695
+ r"""
1696
+ Settlement action representing the distribution of trade mining payments.
1697
+ """
1698
+ PnlRealization: SettlementAction = ...
1699
+ r"""
1700
+ Settlement action representing the realization of all unrealized P&L.
1701
+ """
1702
+ FundingDistribution: SettlementAction = ...
1703
+ r"""
1704
+ Settlement action representing the distribution of funding payments.
1705
+ """
1706
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1707
+ def __hash__(self) -> builtins.int: ...
1708
+ @classmethod
1709
+ def FuturesExpiry(cls, quarter: Quarter) -> SettlementAction:
1710
+ r"""
1711
+ Settlement action representing the expiry of a quarterly future.
1712
+ """
1713
+ def futures_quarter(self) -> typing.Optional[Quarter]:
1714
+ r"""
1715
+ For futures-expiry actions, return the quarter of the quarterly expiry future.
1716
+ """
1717
+ def __repr__(self) -> builtins.str: ...
1718
+
1719
+ @typing.final
1720
+ class SettlementValue:
1721
+ @property
1722
+ def status(self) -> builtins.str: ...
1723
+ @property
1724
+ def value(self) -> Decimal: ...
1725
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1726
+
1727
+ @typing.final
1728
+ class Signer:
1729
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1730
+ def __repr__(self) -> builtins.str: ...
1731
+ def __deepcopy__(self, _memo: dict) -> Signer: ...
1732
+ def as_item(self) -> Item:
1733
+ r"""
1734
+ Wrap this concrete structure into the generic [`Item`] enum.
1735
+ """
1736
+ @classmethod
1737
+ def from_item(cls, item: Item) -> Signer:
1738
+ r"""
1739
+ Down-cast a generic [`Item`] into this concrete type.
1740
+ """
1741
+ def abi_encoded_value(self) -> builtins.bytes:
1742
+ r"""
1743
+ ABI-encode this value.
1744
+ """
1745
+ @classmethod
1746
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1747
+ r"""
1748
+ Decode bytes back into an [`Item`] of this concrete type.
1749
+ """
1750
+ def is_void(self) -> builtins.bool:
1751
+ r"""
1752
+ `true` when this value represents the special *void* marker
1753
+ used to delete a leaf from the SMT.
1754
+ """
1755
+ def __new__(cls, inner: builtins.str) -> Signer:
1756
+ r"""
1757
+ Construct a new `Signer` identified by `inner` release hash.
1758
+ """
1759
+
1760
+ @typing.final
1761
+ class SignerKey:
1762
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1763
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1764
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1765
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1766
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1767
+ def __hash__(self) -> builtins.int: ...
1768
+ def __repr__(self) -> builtins.str: ...
1769
+ def __deepcopy__(self, _memo: dict) -> SignerKey: ...
1770
+ def encode_key(self) -> H256:
1771
+ r"""
1772
+ Encode this state-key into the 32-byte format used on-chain.
1773
+ """
1774
+ @classmethod
1775
+ def decode_key(cls, value: H256) -> SignerKey:
1776
+ r"""
1777
+ Decode a previously-encoded key back into its strongly-typed form.
1778
+ """
1779
+ def __new__(cls, inner: builtins.str) -> SignerKey: ...
1780
+
1781
+ @typing.final
1782
+ class SingleNamePerpetual:
1783
+ r"""
1784
+ A set of specification about each market (aka derivative contracts)
1785
+ """
1786
+ @property
1787
+ def underlying(self) -> builtins.str: ...
1788
+ @property
1789
+ def tick_size(self) -> Decimal: ...
1790
+ @property
1791
+ def max_order_notional(self) -> Decimal: ...
1792
+ @property
1793
+ def max_taker_price_deviation(self) -> Decimal: ...
1794
+ @property
1795
+ def min_order_size(self) -> Decimal: ...
1796
+ def __new__(cls, **kwds: typing.Any) -> SingleNamePerpetual: ...
1797
+
1798
+ @typing.final
1799
+ class Specs:
1800
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1801
+ def __repr__(self) -> builtins.str: ...
1802
+ def __deepcopy__(self, _memo: dict) -> Specs: ...
1803
+ def as_item(self) -> Item:
1804
+ r"""
1805
+ Wrap this concrete structure into the generic [`Item`] enum.
1806
+ """
1807
+ @classmethod
1808
+ def from_item(cls, item: Item) -> Specs:
1809
+ r"""
1810
+ Down-cast a generic [`Item`] into this concrete type.
1811
+ """
1812
+ def abi_encoded_value(self) -> builtins.bytes:
1813
+ r"""
1814
+ ABI-encode this value.
1815
+ """
1816
+ @classmethod
1817
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1818
+ r"""
1819
+ Decode bytes back into an [`Item`] of this concrete type.
1820
+ """
1821
+ def is_void(self) -> builtins.bool:
1822
+ r"""
1823
+ `true` when this value represents the special *void* marker
1824
+ used to delete a leaf from the SMT.
1825
+ """
1826
+ def __new__(cls, inner: builtins.str) -> Specs:
1827
+ r"""
1828
+ Wrapped `SpecsExpr`.
1829
+ """
1830
+ def as_product_specs(self, specs_kind: SpecsKind) -> ProductSpecs:
1831
+ r"""
1832
+ Convert this expression into concrete `ProductSpecs` of the requested kind.
1833
+ """
1834
+
1835
+ @typing.final
1836
+ class SpecsKey:
1837
+ r"""
1838
+ Common key for all specs kind.
1839
+ """
1840
+ @property
1841
+ def kind(self) -> SpecsKind: ...
1842
+ @property
1843
+ def name(self) -> builtins.str:
1844
+ r"""
1845
+ Defined by convention associated with the specs kind.
1846
+ At the time of writing, the naming conventions are:
1847
+
1848
+ - `SingleNamePerpetual`: The product market symbol for the single name perpetuals in our universe (e.g. ETHP, BTCP).
1849
+ - `SpotGateway`: The host id (e.g. binance, coinbase).
1850
+ - `SpotIndex`: The symbol of the spot index (e.g. BTC, ETH).
1851
+ - `IndexFundPerpetual`: The product market symbol for the index fund perpetuals in our universe (e.g. ETHP, BTCP).
1852
+ - `QuarterlyExpiryFuture`: The product market symbol for the quarterly expiry future in our universe (e.g. ETHHF, BTCHF).
1853
+ - `BinaryPredictionFuture`: The internal symbol for each event in our universe (e.g. SB2611B, PG251B).
1854
+ - `BinaryPredictionGateway`: The hostname of the binary prediction gateway (e.g. api.elections.kalshi.com).
1855
+ """
1856
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1857
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1858
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1859
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1860
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1861
+ def __hash__(self) -> builtins.int: ...
1862
+ def __new__(cls, kind: SpecsKind, name: builtins.str) -> SpecsKey: ...
1863
+ def __repr__(self) -> builtins.str: ...
1864
+ def __deepcopy__(self, _memo: dict) -> SpecsKey: ...
1865
+ def encode_key(self) -> H256:
1866
+ r"""
1867
+ Encode this state-key into the 32-byte format used on-chain.
1868
+ """
1869
+ @classmethod
1870
+ def decode_key(cls, value: H256) -> SpecsKey:
1871
+ r"""
1872
+ Decode a previously-encoded key back into its strongly-typed form.
1873
+ """
1874
+ def current_tradable_products(self, current_time: datetime.datetime) -> builtins.list[TradableProductKey]:
1875
+ r"""
1876
+ List the currently tradable products that are live at `current_time`.
1877
+ """
1878
+ def has_lifecycle(self) -> typing.Optional[builtins.bool]:
1879
+ r"""
1880
+ Return whether this specs has a lifecycle constraint.
1881
+ """
1882
+
1883
+ @typing.final
1884
+ class Stats:
1885
+ r"""
1886
+ A trader statistics value. This is used to store verified data like trade
1887
+ volume data for trade mining.
1888
+ """
1889
+ @property
1890
+ def maker_volume(self) -> Decimal:
1891
+ r"""
1892
+ The maker volume of the trader during this trade mining period
1893
+ """
1894
+ @maker_volume.setter
1895
+ def maker_volume(self, value: Decimal) -> None:
1896
+ r"""
1897
+ The maker volume of the trader during this trade mining period
1898
+ """
1899
+ @property
1900
+ def taker_volume(self) -> Decimal:
1901
+ r"""
1902
+ The taker volume of the trader during this trade mining period
1903
+ """
1904
+ @taker_volume.setter
1905
+ def taker_volume(self, value: Decimal) -> None:
1906
+ r"""
1907
+ The taker volume of the trader during this trade mining period
1908
+ """
1909
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1910
+ def __new__(cls, maker_volume: Decimal, taker_volume: Decimal) -> Stats: ...
1911
+ def __repr__(self) -> builtins.str: ...
1912
+ def __deepcopy__(self, _memo: dict) -> Stats: ...
1913
+ def as_item(self) -> Item:
1914
+ r"""
1915
+ Wrap this concrete structure into the generic [`Item`] enum.
1916
+ """
1917
+ @classmethod
1918
+ def from_item(cls, item: Item) -> Stats:
1919
+ r"""
1920
+ Down-cast a generic [`Item`] into this concrete type.
1921
+ """
1922
+ def abi_encoded_value(self) -> builtins.bytes:
1923
+ r"""
1924
+ ABI-encode this value.
1925
+ """
1926
+ @classmethod
1927
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
1928
+ r"""
1929
+ Decode bytes back into an [`Item`] of this concrete type.
1930
+ """
1931
+ def is_void(self) -> builtins.bool:
1932
+ r"""
1933
+ `true` when this value represents the special *void* marker
1934
+ used to delete a leaf from the SMT.
1935
+ """
1936
+ @classmethod
1937
+ def default(cls) -> Stats:
1938
+ r"""
1939
+ Return a `Stats` structure with all counters set to zero.
1940
+ """
1941
+
1942
+ @typing.final
1943
+ class StatsKey:
1944
+ @property
1945
+ def trader(self) -> builtins.str: ...
1946
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
1947
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
1948
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
1949
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
1950
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
1951
+ def __hash__(self) -> builtins.int: ...
1952
+ def __new__(cls, trader: builtins.str) -> StatsKey: ...
1953
+ def __repr__(self) -> builtins.str: ...
1954
+ def __deepcopy__(self, _memo: dict) -> StatsKey: ...
1955
+ def encode_key(self) -> H256:
1956
+ r"""
1957
+ Encode this state-key into the 32-byte format used on-chain.
1958
+ """
1959
+ @classmethod
1960
+ def decode_key(cls, value: H256) -> StatsKey:
1961
+ r"""
1962
+ Decode a previously-encoded key back into its strongly-typed form.
1963
+ """
1964
+ def as_trader_key(self) -> TraderKey:
1965
+ r"""
1966
+ Convert this stats key into the corresponding `TraderKey`.
1967
+ """
1968
+
1969
+ @typing.final
1970
+ class Strategy:
1971
+ r"""
1972
+ An trading strategy (aka sub-account, formerly known as account)
1973
+ """
1974
+ @property
1975
+ def avail_collateral(self) -> Balance:
1976
+ r"""
1977
+ Amount of the collateral per token available as margin
1978
+ """
1979
+ @property
1980
+ def locked_collateral(self) -> Balance:
1981
+ r"""
1982
+ Amount of collateral per token frozen for withdrawal
1983
+ """
1984
+ @property
1985
+ def max_leverage(self) -> builtins.int:
1986
+ r"""
1987
+ Maximum amount of leverage allowed
1988
+ """
1989
+ @max_leverage.setter
1990
+ def max_leverage(self, value: builtins.int) -> None:
1991
+ r"""
1992
+ Maximum amount of leverage allowed
1993
+ """
1994
+ @property
1995
+ def frozen(self) -> builtins.bool:
1996
+ r"""
1997
+ Whether the entire account frozen for strategy tokenization
1998
+ """
1999
+ @frozen.setter
2000
+ def frozen(self, value: builtins.bool) -> None:
2001
+ r"""
2002
+ Whether the entire account frozen for strategy tokenization
2003
+ """
2004
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2005
+ def __new__(cls, avail_collateral: Balance, locked_collateral: Balance, max_leverage: builtins.int = 3, frozen: builtins.bool = False) -> Strategy: ...
2006
+ def __repr__(self) -> builtins.str: ...
2007
+ def __deepcopy__(self, _memo: dict) -> Strategy: ...
2008
+ def as_item(self) -> Item:
2009
+ r"""
2010
+ Wrap this concrete structure into the generic [`Item`] enum.
2011
+ """
2012
+ @classmethod
2013
+ def from_item(cls, item: Item) -> Strategy:
2014
+ r"""
2015
+ Down-cast a generic [`Item`] into this concrete type.
2016
+ """
2017
+ def abi_encoded_value(self) -> builtins.bytes:
2018
+ r"""
2019
+ ABI-encode this value.
2020
+ """
2021
+ @classmethod
2022
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
2023
+ r"""
2024
+ Decode bytes back into an [`Item`] of this concrete type.
2025
+ """
2026
+ def is_void(self) -> builtins.bool:
2027
+ r"""
2028
+ `true` when this value represents the special *void* marker
2029
+ used to delete a leaf from the SMT.
2030
+ """
2031
+ @classmethod
2032
+ def default(cls) -> Strategy:
2033
+ r"""
2034
+ Return an empty `Strategy` with default parameters.
2035
+ """
2036
+ def set_avail_collateral(self, symbol: TokenSymbol, amount: Decimal) -> None:
2037
+ r"""
2038
+ Update this strategy's available collateral for `symbol` to `amount`.
2039
+
2040
+ Note: This is exposed as a method (instead of relying on `#[pyo3(get, set)]`) to avoid
2041
+ mutating a cloned nested value returned from a getter.
2042
+ """
2043
+ def set_locked_collateral(self, symbol: TokenSymbol, amount: Decimal) -> None:
2044
+ r"""
2045
+ Update this strategy's locked collateral for `symbol` to `amount`.
2046
+ """
2047
+ def update_avail_collateral(self, symbol: TokenSymbol, amount: Decimal) -> Balance:
2048
+ r"""
2049
+ Return a new `Balance` obtained by updating this strategy's
2050
+ available collateral for `symbol` to `amount`.
2051
+ """
2052
+ def update_locked_collateral(self, symbol: TokenSymbol, amount: Decimal) -> Balance:
2053
+ r"""
2054
+ Return a new `Balance` obtained by updating this strategy's
2055
+ locked collateral for `symbol` to `amount`.
2056
+ """
2057
+
2058
+ @typing.final
2059
+ class StrategyKey:
2060
+ @property
2061
+ def trader_address(self) -> builtins.str: ...
2062
+ @property
2063
+ def strategy_id_hash(self) -> builtins.str: ...
2064
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2065
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
2066
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
2067
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
2068
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
2069
+ def __hash__(self) -> builtins.int: ...
2070
+ def __new__(cls, trader_address: builtins.str, strategy_id_hash: builtins.str) -> StrategyKey: ...
2071
+ def __repr__(self) -> builtins.str: ...
2072
+ def __deepcopy__(self, _memo: dict) -> StrategyKey: ...
2073
+ def encode_key(self) -> H256:
2074
+ r"""
2075
+ Encode this state-key into the 32-byte format used on-chain.
2076
+ """
2077
+ @classmethod
2078
+ def decode_key(cls, value: H256) -> StrategyKey:
2079
+ r"""
2080
+ Decode a previously-encoded key back into its strongly-typed form.
2081
+ """
2082
+ @staticmethod
2083
+ def generate_strategy_id_hash(strategy_id: builtins.str) -> builtins.str:
2084
+ r"""
2085
+ Deterministically hash `strategy_id` into a `StrategyIdHash`.
2086
+ """
2087
+ def as_position_key(self, symbol: ProductSymbol) -> PositionKey:
2088
+ r"""
2089
+ Derive the `PositionKey` for `symbol` that belongs to this strategy.
2090
+ """
2091
+
2092
+ @typing.final
2093
+ class TradableProduct:
2094
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2095
+ def __repr__(self) -> builtins.str: ...
2096
+ def __deepcopy__(self, _memo: dict) -> TradableProduct: ...
2097
+ def as_item(self) -> Item:
2098
+ r"""
2099
+ Wrap this concrete structure into the generic [`Item`] enum.
2100
+ """
2101
+ @classmethod
2102
+ def from_item(cls, item: Item) -> TradableProduct:
2103
+ r"""
2104
+ Down-cast a generic [`Item`] into this concrete type.
2105
+ """
2106
+ def abi_encoded_value(self) -> builtins.bytes:
2107
+ r"""
2108
+ ABI-encode this value.
2109
+ """
2110
+ @classmethod
2111
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
2112
+ r"""
2113
+ Decode bytes back into an [`Item`] of this concrete type.
2114
+ """
2115
+ def is_void(self) -> builtins.bool:
2116
+ r"""
2117
+ `true` when this value represents the special *void* marker
2118
+ used to delete a leaf from the SMT.
2119
+ """
2120
+ def __new__(cls) -> TradableProduct: ...
2121
+
2122
+ @typing.final
2123
+ class TradableProductKey:
2124
+ @property
2125
+ def specs_key(self) -> SpecsKey: ...
2126
+ @property
2127
+ def parameters(self) -> typing.Optional[TradableProductParameters]: ...
2128
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2129
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
2130
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
2131
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
2132
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
2133
+ def __hash__(self) -> builtins.int: ...
2134
+ def __repr__(self) -> builtins.str: ...
2135
+ def __deepcopy__(self, _memo: dict) -> TradableProductKey: ...
2136
+ def encode_key(self) -> H256:
2137
+ r"""
2138
+ Encode this state-key into the 32-byte format used on-chain.
2139
+ """
2140
+ @classmethod
2141
+ def decode_key(cls, value: H256) -> TradableProductKey:
2142
+ r"""
2143
+ Decode a previously-encoded key back into its strongly-typed form.
2144
+ """
2145
+ def as_product_symbol(self) -> ProductSymbol:
2146
+ r"""
2147
+ Convert this key into its `ProductSymbol`.
2148
+ """
2149
+ def __new__(cls, specs: SpecsKey, parameters: typing.Optional[TradableProductParameters]) -> TradableProductKey: ...
2150
+
2151
+ class TradableProductParameters:
2152
+ @property
2153
+ def quarter(self) -> typing.Optional[Quarter]: ...
2154
+ @classmethod
2155
+ def from_dict(cls, ob: typing.Any) -> TradableProductParameters:
2156
+ r"""
2157
+ Deserialize `TradableProductParameters` from the operator serialization.
2158
+ """
2159
+ def __repr__(self) -> builtins.str: ...
2160
+ @typing.final
2161
+ class Empty(TradableProductParameters):
2162
+ __match_args__ = ()
2163
+ def __new__(cls) -> TradableProductParameters.Empty: ...
2164
+ def __len__(self) -> builtins.int: ...
2165
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
2166
+
2167
+ @typing.final
2168
+ class QuarterlyExpiryFuture(TradableProductParameters):
2169
+ __match_args__ = ("_0",)
2170
+ @property
2171
+ def _0(self) -> Quarter: ...
2172
+ def __new__(cls, _0: Quarter) -> TradableProductParameters.QuarterlyExpiryFuture: ...
2173
+ def __len__(self) -> builtins.int: ...
2174
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
2175
+
2176
+ @typing.final
2177
+ class BinaryPredictionFuture(TradableProductParameters):
2178
+ r"""
2179
+ The nonzero index number of the binary prediction future (e.g. 1, 2, ..., 9 for SB26{1:10}B).
2180
+ """
2181
+ __match_args__ = ("_0",)
2182
+ @property
2183
+ def _0(self) -> builtins.int: ...
2184
+ def __new__(cls, _0: builtins.int) -> TradableProductParameters.BinaryPredictionFuture: ...
2185
+ def __len__(self) -> builtins.int: ...
2186
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
2187
+
2188
+
2189
+ @typing.final
2190
+ class Trader:
2191
+ r"""
2192
+ An individual trader
2193
+ """
2194
+ @property
2195
+ def avail_ddx_balance(self) -> Decimal:
2196
+ r"""
2197
+ The DDX balance stated / usable for trading
2198
+ """
2199
+ @avail_ddx_balance.setter
2200
+ def avail_ddx_balance(self, value: Decimal) -> None:
2201
+ r"""
2202
+ The DDX balance stated / usable for trading
2203
+ """
2204
+ @property
2205
+ def locked_ddx_balance(self) -> Decimal:
2206
+ r"""
2207
+ The DDX balance locked for withdrawal
2208
+ """
2209
+ @locked_ddx_balance.setter
2210
+ def locked_ddx_balance(self, value: Decimal) -> None:
2211
+ r"""
2212
+ The DDX balance locked for withdrawal
2213
+ """
2214
+ @property
2215
+ def pay_fees_in_ddx(self) -> builtins.bool:
2216
+ r"""
2217
+ Switch to paying fees with DDX
2218
+ """
2219
+ @pay_fees_in_ddx.setter
2220
+ def pay_fees_in_ddx(self, value: builtins.bool) -> None:
2221
+ r"""
2222
+ Switch to paying fees with DDX
2223
+ """
2224
+ @property
2225
+ def access_denied(self) -> builtins.bool:
2226
+ r"""
2227
+ Whether the trader is denied access to the platform
2228
+ """
2229
+ @access_denied.setter
2230
+ def access_denied(self, value: builtins.bool) -> None:
2231
+ r"""
2232
+ Whether the trader is denied access to the platform
2233
+ """
2234
+ @property
2235
+ def referral_address(self) -> typing.Optional[builtins.str]: ...
2236
+ @referral_address.setter
2237
+ def referral_address(self, value: typing.Optional[builtins.str]) -> None: ...
2238
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2239
+ def __repr__(self) -> builtins.str: ...
2240
+ def __deepcopy__(self, _memo: dict) -> Trader: ...
2241
+ def as_item(self) -> Item:
2242
+ r"""
2243
+ Wrap this concrete structure into the generic [`Item`] enum.
2244
+ """
2245
+ @classmethod
2246
+ def from_item(cls, item: Item) -> Trader:
2247
+ r"""
2248
+ Down-cast a generic [`Item`] into this concrete type.
2249
+ """
2250
+ def abi_encoded_value(self) -> builtins.bytes:
2251
+ r"""
2252
+ ABI-encode this value.
2253
+ """
2254
+ @classmethod
2255
+ def abi_decode_value_into_item(cls, abi_encoded_value: builtins.bytes) -> typing.Optional[Item]:
2256
+ r"""
2257
+ Decode bytes back into an [`Item`] of this concrete type.
2258
+ """
2259
+ def is_void(self) -> builtins.bool:
2260
+ r"""
2261
+ `true` when this value represents the special *void* marker
2262
+ used to delete a leaf from the SMT.
2263
+ """
2264
+ @classmethod
2265
+ def default(cls) -> Trader:
2266
+ r"""
2267
+ Return a zero-initialized `Trader` value.
2268
+ """
2269
+ def __new__(cls, avail_ddx_balance: Decimal, locked_ddx_balance: Decimal, pay_fees_in_ddx: builtins.bool) -> Trader: ...
2270
+
2271
+ @typing.final
2272
+ class TraderKey:
2273
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2274
+ def __lt__(self, other: builtins.object) -> builtins.bool: ...
2275
+ def __le__(self, other: builtins.object) -> builtins.bool: ...
2276
+ def __gt__(self, other: builtins.object) -> builtins.bool: ...
2277
+ def __ge__(self, other: builtins.object) -> builtins.bool: ...
2278
+ def __hash__(self) -> builtins.int: ...
2279
+ def __repr__(self) -> builtins.str: ...
2280
+ def __deepcopy__(self, _memo: dict) -> TraderKey: ...
2281
+ def encode_key(self) -> H256:
2282
+ r"""
2283
+ Encode this state-key into the 32-byte format used on-chain.
2284
+ """
2285
+ @classmethod
2286
+ def decode_key(cls, value: H256) -> TraderKey:
2287
+ r"""
2288
+ Decode a previously-encoded key back into its strongly-typed form.
2289
+ """
2290
+ def __new__(cls, inner: builtins.str) -> TraderKey: ...
2291
+
2292
+ @typing.final
2293
+ class UpdateProductListings:
2294
+ r"""
2295
+ A signal to update product listings is sent by the operator clock tick mechanism based on the
2296
+ current wall clock time. It is used to add or remove products from the exchange's product
2297
+ listings.
2298
+
2299
+ Motivating example: there are different futures products all corresponding to the same futures
2300
+ specs class, but each future is listed/available to trade at different times. For example, ETH{}F
2301
+ is a specs class representing futures tracking the price of ETH. ETHHF is a specific tradable
2302
+ product referring to the ETH future expiring in March that is listed at the time of writing one
2303
+ week before the expiry of the preceding September future until its expiry in March. The operator
2304
+ will update the listings to add ETHHF and remove ETHHF at the appropriate times.
2305
+ """
2306
+ @property
2307
+ def additions(self) -> builtins.list[TradableProductKey]: ...
2308
+ @property
2309
+ def removals(self) -> builtins.list[TradableProductKey]: ...
2310
+ @property
2311
+ def json(self) -> typing.Any: ...
2312
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2313
+ def __new__(cls, additions: typing.Sequence[TradableProductKey], removals: typing.Sequence[TradableProductKey]) -> UpdateProductListings: ...
2314
+ def __repr__(self) -> builtins.str: ...
2315
+
2316
+ @typing.final
2317
+ class WithdrawDDXIntent:
2318
+ r"""
2319
+ Traders signal their intent to withdraw ddx which freezes the specified amount
2320
+ in their account.
2321
+
2322
+ Funds may be available on-chain at the next checkpoint the operator is kind enough to
2323
+ "prove" the withdrawals on behalf of traders.
2324
+
2325
+ Otherwise, traders may submit a merkle proof at any time after a `Checkpoint` to collect
2326
+ their funds.
2327
+ """
2328
+ @property
2329
+ def amount(self) -> Decimal:
2330
+ r"""
2331
+ Amount to withdraw
2332
+ """
2333
+ @property
2334
+ def nonce(self) -> builtins.str:
2335
+ r"""
2336
+ A salt for uniqueness of the EIP-712 hash function. May optionally have
2337
+ business meaning to the client.
2338
+ """
2339
+ @property
2340
+ def signature(self) -> builtins.str:
2341
+ r"""
2342
+ EIP-712 signature of the withdraw ddx intent attributes
2343
+ """
2344
+ @signature.setter
2345
+ def signature(self, value: builtins.str) -> None:
2346
+ r"""
2347
+ EIP-712 signature of the withdraw ddx intent attributes
2348
+ """
2349
+ @property
2350
+ def json(self) -> typing.Any: ...
2351
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2352
+ def __new__(cls, amount: Decimal, nonce: builtins.str, signature: typing.Optional[builtins.str] = None) -> WithdrawDDXIntent: ...
2353
+ def __repr__(self) -> builtins.str: ...
2354
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
2355
+ r"""
2356
+ Compute the EIP-712 digest for this intent.
2357
+ Passing `message_metadata=(chain_id, verifying_contract)`
2358
+ overrides the default values used in the hash.
2359
+ """
2360
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
2361
+ r"""
2362
+ Recover the `(eip712_hash, trader_address)` that signed
2363
+ this intent.
2364
+ """
2365
+
2366
+ @typing.final
2367
+ class WithdrawIntent:
2368
+ r"""
2369
+ Traders signal their intent to withdraw which freezes the requested collateral in their account.
2370
+
2371
+ Funds may be available on-chain at the next checkpoint the operator is kind enough to "prove"
2372
+ the withdrawals on behalf of traders. Otherwise, traders may submit a merkle proof
2373
+ at any time after a `Checkpoint` to collect their funds.
2374
+ """
2375
+ @property
2376
+ def strategy_id(self) -> builtins.str:
2377
+ r"""
2378
+ Strategy Id (label)
2379
+ """
2380
+ @property
2381
+ def currency(self) -> builtins.str:
2382
+ r"""
2383
+ Ethereum address of the collateral token (ERC-20)
2384
+ """
2385
+ @property
2386
+ def amount(self) -> Decimal:
2387
+ r"""
2388
+ Amount to withdraw
2389
+ """
2390
+ @property
2391
+ def nonce(self) -> builtins.str:
2392
+ r"""
2393
+ A salt for uniqueness of the EIP-712 hash function. May optionally have business meaning to the client.
2394
+ """
2395
+ @property
2396
+ def signature(self) -> builtins.str:
2397
+ r"""
2398
+ EIP-712 signature of the withdraw intent attributes
2399
+ """
2400
+ @signature.setter
2401
+ def signature(self, value: builtins.str) -> None:
2402
+ r"""
2403
+ EIP-712 signature of the withdraw intent attributes
2404
+ """
2405
+ @property
2406
+ def json(self) -> typing.Any: ...
2407
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
2408
+ def __new__(cls, strategy_id: builtins.str, currency: builtins.str, amount: Decimal, nonce: builtins.str, signature: typing.Optional[builtins.str] = None) -> WithdrawIntent: ...
2409
+ def __repr__(self) -> builtins.str: ...
2410
+ def hash_eip712(self, message_metadata: typing.Optional[tuple[builtins.int, builtins.str]] = None) -> builtins.str:
2411
+ r"""
2412
+ Compute the EIP-712 digest for this intent.
2413
+ Passing `message_metadata=(chain_id, verifying_contract)`
2414
+ overrides the default values used in the hash.
2415
+ """
2416
+ def recover_signer(self) -> tuple[builtins.str, builtins.str]:
2417
+ r"""
2418
+ Recover the `(eip712_hash, trader_address)` that signed
2419
+ this intent.
2420
+ """
2421
+
2422
+ @typing.final
2423
+ class InsuranceFundUpdateKind(enum.Enum):
2424
+ Unassigned = ...
2425
+ Deposit = ...
2426
+ Withdraw = ...
2427
+
2428
+ def __new__(cls, name: builtins.str) -> InsuranceFundUpdateKind:
2429
+ r"""
2430
+ Parse an `InsuranceFundUpdateKind` from its string discriminant.
2431
+ """
2432
+
2433
+ @typing.final
2434
+ class ItemKind(enum.Enum):
2435
+ Empty = ...
2436
+ Trader = ...
2437
+ Strategy = ...
2438
+ Position = ...
2439
+ BookOrder = ...
2440
+ Price = ...
2441
+ InsuranceFund = ...
2442
+ Stats = ...
2443
+ Signer = ...
2444
+ Specs = ...
2445
+ TradableProduct = ...
2446
+ InsuranceFundContribution = ...
2447
+ EpochMetadata = ...
2448
+
2449
+ discriminants: dict
2450
+ r"""
2451
+ Return a Python `dict` that maps variant names to their discriminant values.
2452
+ """
2453
+ def __new__(cls, value: builtins.int) -> ItemKind:
2454
+ r"""
2455
+ Create an `ItemKind` from its numeric discriminant (`u8`).
2456
+ Returns `PyValueError` if the value does not correspond to a variant.
2457
+ """
2458
+
2459
+ @typing.final
2460
+ class OrderSide(enum.Enum):
2461
+ r"""
2462
+ 0 - Long, 1 - Short
2463
+ """
2464
+ Bid = ...
2465
+ Ask = ...
2466
+
2467
+ def __new__(cls, name: builtins.str) -> OrderSide:
2468
+ r"""
2469
+ Parse an `OrderSide` (`"Bid"` or `"Ask"`) from its string `name`.
2470
+ """
2471
+
2472
+ @typing.final
2473
+ class PositionSide(enum.Enum):
2474
+ Empty = ...
2475
+ Long = ...
2476
+ Short = ...
2477
+
2478
+ @typing.final
2479
+ class PriceDirection(enum.Enum):
2480
+ r"""
2481
+ Direction of the price movement compared to the last price update executed.
2482
+ """
2483
+ Up = ...
2484
+ Down = ...
2485
+ Flat = ...
2486
+ Unknown = ...
2487
+ r"""
2488
+ Not enough context to determine the direction
2489
+ """
2490
+
2491
+ @typing.final
2492
+ class Quarter(enum.Enum):
2493
+ March = ...
2494
+ June = ...
2495
+ September = ...
2496
+ December = ...
2497
+
2498
+ def __repr__(self) -> builtins.str: ...
2499
+ def __new__(cls, name: builtins.str) -> Quarter:
2500
+ r"""
2501
+ Parse a calendar quarter ("March", "June", …) from `name`.
2502
+ """
2503
+ @classmethod
2504
+ def find_quarter(cls, datetime: datetime.datetime) -> Quarter:
2505
+ r"""
2506
+ Determine the quarter in which `datetime` lies.
2507
+ """
2508
+ def expiry_date_after(self, datetime: datetime.datetime) -> datetime.datetime:
2509
+ r"""
2510
+ First expiry date for this quarter strictly after `datetime`.
2511
+ """
2512
+ @classmethod
2513
+ def upcoming_expiry_date(cls, current_time: datetime.datetime) -> datetime.datetime:
2514
+ r"""
2515
+ Next quarterly-futures expiry date from `current_time`.
2516
+ """
2517
+ def next(self) -> Quarter:
2518
+ r"""
2519
+ Return the quarter immediately following this one.
2520
+ """
2521
+
2522
+ @typing.final
2523
+ class SafetyFailure(enum.Enum):
2524
+ r"""
2525
+ Auto-generated discriminant enum variants
2526
+ """
2527
+ TraderNotFound = ...
2528
+ NotEnoughCollateral = ...
2529
+ NoStrategies = ...
2530
+ StrategyNotFound = ...
2531
+ SignatureRecoveryMismatch = ...
2532
+ InsuranceFundContributionNotFound = ...
2533
+ MaxOrderNotionalBreached = ...
2534
+ MaxTakerPriceDeviationBreached = ...
2535
+ OrderNotFound = ...
2536
+ OMFLessThanIMF = ...
2537
+ MaxWithdrawAmountBreached = ...
2538
+ MaxDDXWithdrawAmountBreached = ...
2539
+ TooMuchCollateralToWithdrawDDX = ...
2540
+ MaxInsuranceFundWithdrawBreached = ...
2541
+ OrderPriceNeg = ...
2542
+ OrderAmountZeroNeg = ...
2543
+ OrderAmountNotMultipleOfMinOrderSize = ...
2544
+ OrderTypeIncompatibleWithPrice = ...
2545
+ PriceNotMultipleOfTickSize = ...
2546
+ UnsupportedMarket = ...
2547
+ UnsupportedCurrency = ...
2548
+ TooManyOrders = ...
2549
+ WithdrawAmountZeroNeg = ...
2550
+ WithdrawDDXAmountZeroNeg = ...
2551
+ WithdrawInsuranceFundZeroNeg = ...
2552
+ AccessDenied = ...
2553
+ CancelNoLiquidityForMarket = ...
2554
+ UnsupportedTraderUpdate = ...
2555
+ MarketPriceNotAvailable = ...
2556
+
2557
+ def __new__(cls, name: builtins.str) -> SafetyFailure: ...
2558
+
2559
+ @typing.final
2560
+ class SpecsKind(enum.Enum):
2561
+ SingleNamePerpetual = ...
2562
+ SpotGateway = ...
2563
+ SpotIndex = ...
2564
+ IndexFundPerpetual = ...
2565
+ QuarterlyExpiryFuture = ...
2566
+ BinaryPredictionFuture = ...
2567
+ BinaryIndex = ...
2568
+ BinaryPredictionGateway = ...
2569
+
2570
+ def __new__(cls, kind: builtins.str) -> SpecsKind:
2571
+ r"""
2572
+ Parse a `SpecsKind` from its string representation.
2573
+ """
2574
+
2575
+ @typing.final
2576
+ class StrategyUpdateKind(enum.Enum):
2577
+ r"""
2578
+ Differentiates various types of strategy updates.
2579
+
2580
+ Enumerates different scenarios like deposits, withdrawals, and other events
2581
+ that impact a trader's strategy, enabling appropriate response and adjustment in the strategy.
2582
+ """
2583
+ Unassigned = ...
2584
+ r"""
2585
+ Used as placeholder in default events.
2586
+ """
2587
+ Deposit = ...
2588
+ r"""
2589
+ Reacts to contract deposit event.
2590
+ """
2591
+ Withdraw = ...
2592
+ r"""
2593
+ Reacts to contract withdraw event, decreasing the (claimed) locked collateral.
2594
+ """
2595
+ WithdrawIntent = ...
2596
+ r"""
2597
+ A client request to withdraw funds, which moves funds from available collateral to locked collateral.
2598
+ """
2599
+ FundingPayment = ...
2600
+ RealizedPnl = ...
2601
+
2602
+ def __new__(cls, name: builtins.str) -> StrategyUpdateKind:
2603
+ r"""
2604
+ Parse a `StrategyUpdateKind` from its string discriminant.
2605
+ """
2606
+
2607
+ @typing.final
2608
+ class TokenSymbol(enum.Enum):
2609
+ r"""
2610
+ Well-known ERC20 tokens used in the underpinning of the protocol
2611
+ """
2612
+ USDC = ...
2613
+ DDX = ...
2614
+
2615
+ @classmethod
2616
+ def from_address(cls, address: builtins.str) -> TokenSymbol:
2617
+ r"""
2618
+ Construct a `TokenSymbol` from the on-chain token `address`.
2619
+ """
2620
+ def address(self) -> builtins.str:
2621
+ r"""
2622
+ Return the canonical on-chain address for this token.
2623
+ """
2624
+
2625
+ @typing.final
2626
+ class TradeSide(enum.Enum):
2627
+ Maker = ...
2628
+ Taker = ...
2629
+
2630
+ def trading_fee(self, amount: Decimal, price: Decimal) -> Decimal:
2631
+ r"""
2632
+ Compute the trading fee for the given `amount` at `price` on this side.
2633
+ """
2634
+
2635
+ @typing.final
2636
+ class TraderUpdateKind(enum.Enum):
2637
+ r"""
2638
+ Differentiates various types of trader updates.
2639
+ """
2640
+ Unassigned = ...
2641
+ r"""
2642
+ Used as placeholder in default events.
2643
+ """
2644
+ DepositDDX = ...
2645
+ r"""
2646
+ Reacts to contract DDX deposit event.
2647
+ """
2648
+ WithdrawDDX = ...
2649
+ r"""
2650
+ Reacts to contract DDX withdraw event, decreasing the (claimed) locked collateral.
2651
+ """
2652
+ WithdrawDDXIntent = ...
2653
+ TradeMiningReward = ...
2654
+ Profile = ...
2655
+ r"""
2656
+ Trader profile parameter updates sent via a client intention.
2657
+ """
2658
+ FeeDistribution = ...
2659
+ r"""
2660
+ Fee distribution event.
2661
+ """
2662
+ Denial = ...
2663
+ r"""
2664
+ Denial of access to the platform due to KYC blacklist, expiration, or other reasons.
2665
+ """
2666
+ Admission = ...
2667
+ r"""
2668
+ Admission to the platform due to KYC re-approval, unbanned, or other reasons.
2669
+ """
2670
+
2671
+ def __new__(cls, name: builtins.str) -> TraderUpdateKind:
2672
+ r"""
2673
+ Parse a `TraderUpdateKind` from its string discriminant.
2674
+ """
2675
+
2676
+ def get_operator_context() -> OperatorContext:
2677
+ r"""
2678
+ Get the operator application context for this DerivaDEX instance.
2679
+ """
2680
+
2681
+ def reinit_operator_context() -> None:
2682
+ r"""
2683
+ Reinitialize the operator application context for this DerivaDEX instance.
2684
+ """
2685
+