dcex 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. dcex/__init__.py +59 -0
  2. dcex/async_support/__init__.py +113 -0
  3. dcex/async_support/okx/__init__.py +3 -0
  4. dcex/async_support/okx/_account_http.py +827 -0
  5. dcex/async_support/okx/_asset_http.py +531 -0
  6. dcex/async_support/okx/_http_manager.py +253 -0
  7. dcex/async_support/okx/_market_http.py +143 -0
  8. dcex/async_support/okx/_public_http.py +151 -0
  9. dcex/async_support/okx/_trade_http.py +1014 -0
  10. dcex/async_support/okx/client.py +54 -0
  11. dcex/async_support/okx/endpoints/account.py +34 -0
  12. dcex/async_support/okx/endpoints/asset.py +27 -0
  13. dcex/async_support/okx/endpoints/market.py +15 -0
  14. dcex/async_support/okx/endpoints/public.py +15 -0
  15. dcex/async_support/okx/endpoints/trade.py +25 -0
  16. dcex/async_support/product_table/fetch.py +944 -0
  17. dcex/async_support/product_table/manager.py +556 -0
  18. dcex/okx/__init__.py +3 -0
  19. dcex/okx/_account_http.py +825 -0
  20. dcex/okx/_asset_http.py +526 -0
  21. dcex/okx/_http_manager.py +251 -0
  22. dcex/okx/_market_http.py +139 -0
  23. dcex/okx/_public_http.py +106 -0
  24. dcex/okx/_trade_http.py +995 -0
  25. dcex/okx/client.py +66 -0
  26. dcex/okx/endpoints/account.py +49 -0
  27. dcex/okx/endpoints/asset.py +42 -0
  28. dcex/okx/endpoints/market.py +28 -0
  29. dcex/okx/endpoints/public.py +27 -0
  30. dcex/okx/endpoints/trade.py +40 -0
  31. dcex/product_table/fetch.py +560 -0
  32. dcex/product_table/manager.py +482 -0
  33. dcex/utils/address_utils.py +14 -0
  34. dcex/utils/common.py +22 -0
  35. dcex/utils/common_dataframe.py +35 -0
  36. dcex/utils/decimal_utils.py +15 -0
  37. dcex/utils/errors.py +74 -0
  38. dcex/utils/helpers.py +88 -0
  39. dcex/utils/jupyter_helper.py +105 -0
  40. dcex/utils/timeframe_utils.py +126 -0
  41. dcex-0.3.0.dist-info/METADATA +173 -0
  42. dcex-0.3.0.dist-info/RECORD +45 -0
  43. dcex-0.3.0.dist-info/WHEEL +5 -0
  44. dcex-0.3.0.dist-info/licenses/LICENSE +21 -0
  45. dcex-0.3.0.dist-info/top_level.txt +1 -0
dcex/__init__.py ADDED
@@ -0,0 +1,59 @@
1
+ """
2
+ dcex - dex & cex trading library.
3
+
4
+ A comprehensive library for cryptocurrency exchange interactions with both sync and async support.
5
+ Automatically handles Jupyter Notebook compatibility with nest_asyncio.
6
+ """
7
+
8
+ from typing import Any
9
+
10
+ from .binance.client import Client as BinanceClient
11
+ from .bitmart.client import Client as BitmartClient
12
+ from .bitmex.client import Client as BitmexClient
13
+ from .bybit.client import Client as BybitClient
14
+ from .gateio.client import Client as GateioClient
15
+ from .okx.client import Client as OKXClient
16
+ from .utils.jupyter_helper import auto_apply_nest_asyncio
17
+
18
+ auto_apply_nest_asyncio(verbose=False)
19
+
20
+
21
+ # Create callable functions for each exchange (synchronous clients)
22
+ def binance(**kwargs: Any) -> BinanceClient: # noqa: ANN401
23
+ """Create a Binance client instance."""
24
+ return BinanceClient(**kwargs)
25
+
26
+
27
+ def bitmart(**kwargs: Any) -> BitmartClient: # noqa: ANN401
28
+ """Create a BitMart client instance."""
29
+ return BitmartClient(**kwargs)
30
+
31
+
32
+ def bitmex(**kwargs: Any) -> BitmexClient: # noqa: ANN401
33
+ """Create a BitMEX client instance."""
34
+ return BitmexClient(**kwargs)
35
+
36
+
37
+ def bybit(**kwargs: Any) -> BybitClient: # noqa: ANN401
38
+ """Create a Bybit client instance."""
39
+ return BybitClient(**kwargs)
40
+
41
+
42
+ def gateio(**kwargs: Any) -> GateioClient: # noqa: ANN401
43
+ """Create a Gate.io client instance."""
44
+ return GateioClient(**kwargs)
45
+
46
+
47
+ def okx(**kwargs: Any) -> OKXClient: # noqa: ANN401
48
+ """Create an OKX client instance."""
49
+ return OKXClient(**kwargs)
50
+
51
+
52
+ __all__ = [
53
+ "binance",
54
+ "bitmart",
55
+ "bitmex",
56
+ "bybit",
57
+ "gateio",
58
+ "okx",
59
+ ]
@@ -0,0 +1,113 @@
1
+ """
2
+ Async exchange entry points.
3
+
4
+ This module exposes coroutine factory functions for each supported exchange,
5
+ which return an initialized async client (after awaiting `async_init`).
6
+ """
7
+
8
+ # Import exchange client classes and create callable functions
9
+ from typing import Any, cast
10
+
11
+ from .ascendex.client import Client as AscendexClient
12
+ from .binance.client import Client as BinanceClient
13
+ from .bingx.client import Client as BingXClient
14
+ from .bitmart.client import Client as BitmartClient
15
+ from .bitmex.client import Client as BitmexClient
16
+ from .bybit.client import Client as BybitClient
17
+ from .gateio.client import Client as GateioClient
18
+ from .hyperliquid.client import Client as HyperliquidClient
19
+ from .kucoin.client import Client as KuCoinClient
20
+ from .okx.client import Client as OKXClient
21
+ from .zoomex.client import Client as ZoomexClient
22
+
23
+
24
+ async def ascendex(
25
+ **kwargs: Any, # noqa: ANN401
26
+ ) -> AscendexClient:
27
+ """Create and initialize an AscendEX client instance."""
28
+ return cast(AscendexClient, await AscendexClient(**kwargs).async_init())
29
+
30
+
31
+ async def binance(
32
+ **kwargs: Any, # noqa: ANN401
33
+ ) -> BinanceClient:
34
+ """Create and initialize a Binance client instance."""
35
+ return cast(BinanceClient, await BinanceClient(**kwargs).async_init())
36
+
37
+
38
+ async def bingx(
39
+ **kwargs: Any, # noqa: ANN401
40
+ ) -> BingXClient:
41
+ """Create and initialize a BingX client instance."""
42
+ return cast(BingXClient, await BingXClient(**kwargs).async_init())
43
+
44
+
45
+ async def bitmart(
46
+ **kwargs: Any, # noqa: ANN401
47
+ ) -> BitmartClient:
48
+ """Create and initialize a BitMart client instance."""
49
+ return cast(BitmartClient, await BitmartClient(**kwargs).async_init())
50
+
51
+
52
+ async def bitmex(
53
+ **kwargs: Any, # noqa: ANN401
54
+ ) -> BitmexClient:
55
+ """Create and initialize a BitMEX client instance."""
56
+ return cast(BitmexClient, await BitmexClient(**kwargs).async_init())
57
+
58
+
59
+ async def bybit(
60
+ **kwargs: Any, # noqa: ANN401
61
+ ) -> BybitClient:
62
+ """Create and initialize a Bybit client instance."""
63
+ return cast(BybitClient, await BybitClient(**kwargs).async_init())
64
+
65
+
66
+ async def gateio(
67
+ **kwargs: Any, # noqa: ANN401
68
+ ) -> GateioClient:
69
+ """Create and initialize a Gate.io client instance."""
70
+ return cast(GateioClient, await GateioClient(**kwargs).async_init())
71
+
72
+
73
+ async def hyperliquid(
74
+ **kwargs: Any, # noqa: ANN401
75
+ ) -> HyperliquidClient:
76
+ """Create and initialize a Hyperliquid client instance."""
77
+ return cast(HyperliquidClient, await HyperliquidClient(**kwargs).async_init())
78
+
79
+
80
+ async def kucoin(
81
+ **kwargs: Any, # noqa: ANN401
82
+ ) -> KuCoinClient:
83
+ """Create and initialize a KuCoin client instance."""
84
+ return cast(KuCoinClient, await KuCoinClient(**kwargs).async_init())
85
+
86
+
87
+ async def okx(
88
+ **kwargs: Any, # noqa: ANN401
89
+ ) -> OKXClient:
90
+ """Create and initialize an OKX client instance."""
91
+ return cast(OKXClient, await OKXClient(**kwargs).async_init())
92
+
93
+
94
+ async def zoomex(
95
+ **kwargs: Any, # noqa: ANN401
96
+ ) -> ZoomexClient:
97
+ """Create and initialize a Zoomex client instance."""
98
+ return cast(ZoomexClient, await ZoomexClient(**kwargs).async_init())
99
+
100
+
101
+ __all__ = [
102
+ "ascendex",
103
+ "binance",
104
+ "bingx",
105
+ "bitmart",
106
+ "bitmex",
107
+ "bybit",
108
+ "gateio",
109
+ "hyperliquid",
110
+ "kucoin",
111
+ "okx",
112
+ "zoomex",
113
+ ]
@@ -0,0 +1,3 @@
1
+ from .client import Client
2
+
3
+ __all__ = ["Client"]