Skip to content

Commit 34d3547

Browse files
committed
docs: show mounted maxi.telegram/maxi.naver form
Refs #184
1 parent 79b3283 commit 34d3547

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ the others.
100100
<details markdown="1"><summary>Sync</summary>
101101

102102
```python
103-
from datamaxi import Datamaxi, Telegram, Naver
103+
from datamaxi import Datamaxi
104104

105-
# Clients read DATAMAXI_API_KEY from the environment automatically.
106-
# Alternatively, pass api_key="your_api_key" explicitly to each client.
105+
# The client reads DATAMAXI_API_KEY from the environment automatically.
106+
# Alternatively, pass api_key="your_api_key" explicitly.
107107
maxi = Datamaxi()
108-
telegram = Telegram()
109-
naver = Naver()
108+
109+
# Telegram and Naver are mounted as `maxi.telegram` / `maxi.naver`
110+
# (standalone `Telegram` / `Naver` clients remain available too).
111+
channels, _ = maxi.telegram.channels()
112+
trend = maxi.naver.trend(symbol="BTC")
110113

111114
# Fetch CEX candle data (returns pandas DataFrame)
112115
df = maxi.cex.candle(
@@ -188,14 +191,16 @@ The package ships these clients, all configured the same way (see
188191

189192
| Client | Import | Purpose |
190193
| ----------------- | --------------------------------------------- | ---------------------------------------------------------- |
191-
| `Datamaxi` | `from datamaxi import Datamaxi` | Synchronous client for all crypto REST data. |
192-
| `Telegram` | `from datamaxi import Telegram` | Telegram channel messages and metadata. |
193-
| `Naver` | `from datamaxi import Naver` | Naver search-trend data (South Korea). |
194+
| `Datamaxi` | `from datamaxi import Datamaxi` | Synchronous client for all REST data, incl. `maxi.telegram` / `maxi.naver`. |
195+
| `Telegram` | `from datamaxi import Telegram` | Standalone Telegram client (also mounted as `maxi.telegram`). |
196+
| `Naver` | `from datamaxi import Naver` | Standalone Naver search-trend client (also mounted as `maxi.naver`). |
194197
| `AsyncDatamaxi` | `from datamaxi.aio import AsyncDatamaxi` | Async twin of `Datamaxi` (needs the `[async]` extra). |
195198
| `AsyncDatamaxiWS` | `from datamaxi.aio.ws import AsyncDatamaxiWS` | Async WebSocket streaming (needs the `[ws]` extra). |
196199

197-
`AsyncTelegram` and `AsyncNaver` are the async twins of `Telegram` / `Naver`,
198-
also imported from `datamaxi.aio`.
200+
Telegram and Naver are mounted on `Datamaxi` / `AsyncDatamaxi` (`maxi.telegram`,
201+
`maxi.naver`) so they reuse the client's shared session. The standalone
202+
`Telegram` / `Naver` (and their async twins `AsyncTelegram` / `AsyncNaver`,
203+
imported from `datamaxi.aio`) remain available for independent use.
199204

200205
## REST API Reference
201206

@@ -495,12 +500,11 @@ Off-exchange signals: Telegram channels and Naver search trends.
495500
Fetch Telegram channel messages and metadata.
496501

497502
```python
498-
# Initialize Telegram client
499-
from datamaxi import Telegram
500-
telegram = Telegram(api_key=api_key)
503+
# Telegram is mounted on the client as `maxi.telegram`
504+
# (a standalone `from datamaxi import Telegram` client also works).
501505

502506
# Fetch channels
503-
data, next_request = telegram.channels(
507+
data, next_request = maxi.telegram.channels(
504508
page=1, # Optional: page number
505509
limit=1000, # Optional: items per page
506510
category=None, # Optional: filter by category
@@ -509,7 +513,7 @@ data, next_request = telegram.channels(
509513
)
510514

511515
# Fetch messages
512-
data, next_request = telegram.messages(
516+
data, next_request = maxi.telegram.messages(
513517
channel_name=None, # Optional: filter by channel
514518
page=1, # Optional: page number
515519
limit=1000, # Optional: items per page
@@ -524,15 +528,14 @@ data, next_request = telegram.messages(
524528
Fetch Naver search trend data (South Korea).
525529

526530
```python
527-
# Initialize Naver client
528-
from datamaxi import Naver
529-
naver = Naver(api_key=api_key)
531+
# Naver is mounted on the client as `maxi.naver`
532+
# (a standalone `from datamaxi import Naver` client also works).
530533

531534
# Get supported symbols
532-
symbols = naver.symbols()
535+
symbols = maxi.naver.symbols()
533536

534537
# Fetch trend data
535-
data = naver.trend(
538+
data = maxi.naver.trend(
536539
symbol="BTC", # Required: symbol to search
537540
pandas=True # Optional: return DataFrame or list
538541
)
@@ -757,7 +760,8 @@ Use `AsyncDatamaxi` as an async context manager (shown above) or call
757760
`await client.aclose()` yourself. Paginated endpoints return an async
758761
`next_request``await` it too
759762
(`data, next_request = await client.cex.announcement(...)`). Telegram and Naver
760-
have standalone `AsyncTelegram` / `AsyncNaver` clients.
763+
are mounted as `client.telegram` / `client.naver`; standalone
764+
`AsyncTelegram` / `AsyncNaver` clients remain available too.
761765

762766
Every endpoint in the [REST API Reference](#rest-api-reference) works the same
763767
under the async client — see the [docs](https://datamaxi.readthedocs.io/) where

0 commit comments

Comments
 (0)