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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ __pycache__/
ddx/__init__.py ADDED
@@ -0,0 +1,58 @@
1
+ """
2
+ ddx/__init__.py
3
+
4
+ Package initializer for the mixed Rust/Python ddx library.
5
+
6
+ Responsibilities:
7
+ * Dynamically load the compiled Rust extension module (`ddx._rust`).
8
+ * In development/editable mode (when APP_SHARE is set), prepend the
9
+ on-disk wheel directory so that `import ddx._rust` resolves locally.
10
+ * Re-export all public symbols from the Rust extension module,
11
+ plus Python helpers `reinit_operator_context` and `load_testnet`.
12
+ * Configure the application data directory via APP_CONFIG and
13
+ enforce CONTRACT_DEPLOYMENT when a custom config is used.
14
+ * Define constants like `DDX_APPLICATION_ID`.
15
+ """
16
+
17
+ import os
18
+ import importlib
19
+ from importlib.resources import files
20
+
21
+ # Step 1: Load the installed ddx package (the Rust wheel).
22
+ _pkg = importlib.import_module("ddx")
23
+
24
+ # Step 2: If APP_SHARE is set (dev mode), include the local wheel so ddx._rust resolves
25
+ if share := os.environ.get("APP_SHARE"):
26
+ wheel_dir = os.path.join(share, "ddx", "wheels", "ddx")
27
+ _pkg.__path__.append(wheel_dir)
28
+
29
+ # Step 3: Application configuration
30
+ from .config import *
31
+
32
+ if "APP_CONFIG" not in os.environ:
33
+ default_cfg = files("ddx") / "app_config"
34
+ os.environ["APP_CONFIG"] = str(default_cfg)
35
+
36
+ # To use testnet or other environments in the default `app_config` set that variable upfront.
37
+ # Otherwise, it defaults to "derivadex" (mainnet).
38
+ if not os.environ.get("CONTRACT_DEPLOYMENT"):
39
+ os.environ["CONTRACT_DEPLOYMENT"] = "derivadex"
40
+
41
+ reinit_operator_context()
42
+ else:
43
+ # HACK: This happens during the docker build state when validating the install.
44
+ if not os.environ.get("CONTRACT_DEPLOYMENT"):
45
+ os.environ["CONTRACT_DEPLOYMENT"] = "snapshot"
46
+
47
+ # Step 4: Import the Rust extension and re-export its public API
48
+ # This internally reads APP_CONFIG nd CONTRACT_DEPLOYMENT so it must be done after step 3.
49
+ import ddx._rust as _rust # noqa: F401,F403
50
+
51
+ __doc__ = _rust.__doc__ # mirror the Rust module's docstring
52
+ __all__ = list(getattr(_rust, "__all__", []))
53
+ __all__.extend(["load_mainnet", "load_testnet"])
54
+
55
+ # Step 5: Constants
56
+ from eth_abi.utils.padding import zpad32_right
57
+
58
+ DDX_APPLICATION_ID = zpad32_right(b"exchange-operator")