|
16 | 16 |
|
17 | 17 | Mirrors the full sync surface (``cex.*``, ``funding_rate``, ``forex``, |
18 | 18 | ``premium``, ``liquidation``, ``open_interest``, ``margin_borrow``, |
19 | | -``index_price``, ``telegram``, ``naver``). The standalone |
20 | | -``AsyncTelegram`` / ``AsyncNaver`` classes stay exported for back-compat. |
21 | | -Reuses |
22 | | -the sync client's endpoint resolution and error handling (``datamaxi._dispatch``) |
23 | | -and the shared DataFrame / ResponseMeta helpers, so the two clients can't drift |
24 | | -on request building or error semantics. |
| 19 | +``index_price``, ``telegram``, ``naver``). Reuses the sync client's endpoint |
| 20 | +resolution and error handling (``datamaxi._dispatch``) and the shared DataFrame |
| 21 | +/ ResponseMeta helpers, so the two clients can't drift on request building or |
| 22 | +error semantics. |
25 | 23 | """ |
26 | 24 |
|
27 | | -from typing import Any |
28 | | - |
29 | | -from datamaxi.lib.constants import BASE_URL |
30 | | -from datamaxi.aio._core import AsyncAPI, AsyncResource |
31 | | -from datamaxi.aio.cex import ( |
| 25 | +from datamaxi.aio._client import AsyncDatamaxi # noqa: F401 |
| 26 | +from datamaxi.aio._core import AsyncAPI, AsyncResource # noqa: F401 |
| 27 | +from datamaxi.aio.cex import ( # noqa: F401 |
32 | 28 | AsyncCex, |
33 | 29 | AsyncCexCandle, |
34 | 30 | AsyncCexTicker, |
|
38 | 34 | AsyncCexToken, |
39 | 35 | AsyncCexSymbol, |
40 | 36 | ) |
41 | | -from datamaxi.aio.funding_rate import AsyncFundingRate |
42 | | -from datamaxi.aio.forex import AsyncForex |
43 | | -from datamaxi.aio.premium import AsyncPremium |
44 | | -from datamaxi.aio.liquidation import AsyncLiquidation |
45 | | -from datamaxi.aio.open_interest import AsyncOpenInterest |
46 | | -from datamaxi.aio.margin_borrow import AsyncMarginBorrow |
47 | | -from datamaxi.aio.index_price import AsyncIndexPrice |
48 | | -from datamaxi.aio.telegram import AsyncTelegram |
49 | | -from datamaxi.aio.naver import AsyncNaver |
50 | | - |
51 | | - |
52 | | -class AsyncDatamaxi: |
53 | | - """Async entrypoint — full mirror of the sync :class:`datamaxi.Datamaxi`. |
54 | | -
|
55 | | - Use as an async context manager so the underlying ``httpx`` client is |
56 | | - closed, or call :meth:`aclose` explicitly. |
57 | | - """ |
58 | | - |
59 | | - def __init__(self, api_key=None, **kwargs: Any): |
60 | | - if "base_url" not in kwargs: |
61 | | - kwargs["base_url"] = BASE_URL |
62 | | - api = AsyncAPI(api_key, **kwargs) |
63 | | - self._api = api |
64 | | - |
65 | | - self.cex = AsyncCex(api) |
66 | | - self.funding_rate = AsyncFundingRate(api) |
67 | | - self.forex = AsyncForex(api) |
68 | | - self.premium = AsyncPremium(api) |
69 | | - self.liquidation = AsyncLiquidation(api) |
70 | | - self.open_interest = AsyncOpenInterest(api) |
71 | | - self.margin_borrow = AsyncMarginBorrow(api) |
72 | | - self.index_price = AsyncIndexPrice(api) |
73 | | - self.telegram = AsyncTelegram(api=api) |
74 | | - self.naver = AsyncNaver(api=api) |
75 | | - |
76 | | - async def aclose(self): |
77 | | - await self._api.aclose() |
78 | | - |
79 | | - async def __aenter__(self): |
80 | | - return self |
81 | | - |
82 | | - async def __aexit__(self, *exc): |
83 | | - await self.aclose() |
84 | | - |
85 | | - def __repr__(self): |
86 | | - return "AsyncDatamaxi(base_url={!r}, has_key={})".format( |
87 | | - self._api.base_url, bool(self._api.api_key) |
88 | | - ) |
89 | | - |
| 37 | +from datamaxi.aio.funding_rate import AsyncFundingRate # noqa: F401 |
| 38 | +from datamaxi.aio.forex import AsyncForex # noqa: F401 |
| 39 | +from datamaxi.aio.premium import AsyncPremium # noqa: F401 |
| 40 | +from datamaxi.aio.liquidation import AsyncLiquidation # noqa: F401 |
| 41 | +from datamaxi.aio.open_interest import AsyncOpenInterest # noqa: F401 |
| 42 | +from datamaxi.aio.margin_borrow import AsyncMarginBorrow # noqa: F401 |
| 43 | +from datamaxi.aio.index_price import AsyncIndexPrice # noqa: F401 |
90 | 44 |
|
91 | 45 | __all__ = [ |
92 | 46 | "AsyncDatamaxi", |
93 | | - "AsyncTelegram", |
94 | | - "AsyncNaver", |
95 | 47 | "AsyncAPI", |
96 | 48 | "AsyncResource", |
97 | 49 | "AsyncCex", |
|
0 commit comments