Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 72 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,74 +84,78 @@ the key stays out of source code):
export DATAMAXI_API_KEY="your_api_key"
```

=== "Sync"

```python
from datamaxi import Datamaxi, Telegram, Naver

# Clients read DATAMAXI_API_KEY from the environment automatically.
# Alternatively, pass api_key="your_api_key" explicitly to each client.
maxi = Datamaxi()
telegram = Telegram()
naver = Naver()

# Fetch CEX candle data (returns pandas DataFrame)
df = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot"
)
print(df.head())

# Fetch ticker data
ticker = maxi.cex.ticker.get(
exchange="binance",
symbol="BTC-USDT",
market="spot"
)
print(ticker)

# Fetch premium data
premium = maxi.premium(asset="BTC")
print(premium.head())
```

=== "Async"

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi


async def main():
# Reads DATAMAXI_API_KEY from the environment automatically.
# Alternatively, pass api_key="your_api_key" explicitly.
async with AsyncDatamaxi() as client:
# Fetch CEX candle data (returns pandas DataFrame)
df = await client.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
)
print(df.head())

# Fetch ticker data
ticker = await client.cex.ticker.get(
exchange="binance",
symbol="BTC-USDT",
market="spot",
)
print(ticker)

# Fetch premium data
premium = await client.premium(asset="BTC")
print(premium.head())


asyncio.run(main())
```
<details markdown="1"><summary>Sync</summary>

```python
from datamaxi import Datamaxi, Telegram, Naver

# Clients read DATAMAXI_API_KEY from the environment automatically.
# Alternatively, pass api_key="your_api_key" explicitly to each client.
maxi = Datamaxi()
telegram = Telegram()
naver = Naver()

# Fetch CEX candle data (returns pandas DataFrame)
df = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot"
)
print(df.head())

# Fetch ticker data
ticker = maxi.cex.ticker.get(
exchange="binance",
symbol="BTC-USDT",
market="spot"
)
print(ticker)

# Fetch premium data
premium = maxi.premium(asset="BTC")
print(premium.head())
```

</details>

<details markdown="1"><summary>Async</summary>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi


async def main():
# Reads DATAMAXI_API_KEY from the environment automatically.
# Alternatively, pass api_key="your_api_key" explicitly.
async with AsyncDatamaxi() as client:
# Fetch CEX candle data (returns pandas DataFrame)
df = await client.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
)
print(df.head())

# Fetch ticker data
ticker = await client.cex.ticker.get(
exchange="binance",
symbol="BTC-USDT",
market="spot",
)
print(ticker)

# Fetch premium data
premium = await client.premium(asset="BTC")
print(premium.head())


asyncio.run(main())
```

</details>

## Async Client

Expand Down
62 changes: 33 additions & 29 deletions docs/cex-announcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,50 @@ Exchange announcements such as listings and delistings.

## Usage

=== "Sync"
<details markdown="1"><summary>Sync</summary>

```python
from datamaxi import Datamaxi
```python
from datamaxi import Datamaxi

maxi = Datamaxi(api_key="YOUR_API_KEY")
maxi = Datamaxi(api_key="YOUR_API_KEY")

data, next_request = maxi.cex.announcement(
exchange="binance",
category="listing",
page=1,
limit=50,
sort="desc",
)
data, next_request = maxi.cex.announcement(
exchange="binance",
category="listing",
page=1,
limit=50,
sort="desc",
)

more_data, _ = next_request()
```
more_data, _ = next_request()
```

=== "Async"
</details>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi
<details markdown="1"><summary>Async</summary>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi

async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
data, next_request = await client.cex.announcement(
exchange="binance",
category="listing",
page=1,
limit=50,
sort="desc",
)

more_data, _ = await next_request()
async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
data, next_request = await client.cex.announcement(
exchange="binance",
category="listing",
page=1,
limit=50,
sort="desc",
)

more_data, _ = await next_request()

asyncio.run(main())
```

asyncio.run(main())
```

</details>

## Notes

Expand Down
74 changes: 39 additions & 35 deletions docs/cex-candle.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,56 @@ Historical OHLCV candle data for centralized exchanges.

## Usage

=== "Sync"
<details markdown="1"><summary>Sync</summary>

```python
from datamaxi import Datamaxi
```python
from datamaxi import Datamaxi

maxi = Datamaxi(api_key="YOUR_API_KEY")
maxi = Datamaxi(api_key="YOUR_API_KEY")

exchanges = maxi.cex.candle.exchanges(market="spot")
symbols = maxi.cex.candle.symbols(exchange="binance", market="spot")
intervals = maxi.cex.candle.intervals()
exchanges = maxi.cex.candle.exchanges(market="spot")
symbols = maxi.cex.candle.symbols(exchange="binance", market="spot")
intervals = maxi.cex.candle.intervals()

df = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
from_unix=1704067200,
to_unix=1706745600,
)
```
df = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
from_unix=1704067200,
to_unix=1706745600,
)
```

=== "Async"
</details>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi
<details markdown="1"><summary>Async</summary>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi

async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
exchanges = await client.cex.candle.exchanges(market="spot")
symbols = await client.cex.candle.symbols(exchange="binance", market="spot")
intervals = await client.cex.candle.intervals()

df = await client.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
from_unix=1704067200,
to_unix=1706745600,
)
async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
exchanges = await client.cex.candle.exchanges(market="spot")
symbols = await client.cex.candle.symbols(exchange="binance", market="spot")
intervals = await client.cex.candle.intervals()

df = await client.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
from_unix=1704067200,
to_unix=1706745600,
)

asyncio.run(main())
```

asyncio.run(main())
```

</details>

## Notes

Expand Down
42 changes: 23 additions & 19 deletions docs/cex-fee.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,40 @@ Trading fee schedules for centralized exchanges.

## Usage

=== "Sync"
<details markdown="1"><summary>Sync</summary>

```python
from datamaxi import Datamaxi
```python
from datamaxi import Datamaxi

maxi = Datamaxi(api_key="YOUR_API_KEY")
maxi = Datamaxi(api_key="YOUR_API_KEY")

exchanges = maxi.cex.fee.exchanges()
symbols = maxi.cex.fee.symbols(exchange="binance")
exchanges = maxi.cex.fee.exchanges()
symbols = maxi.cex.fee.symbols(exchange="binance")

fees = maxi.cex.fee(exchange="binance", symbol="BTC-USDT")
```
fees = maxi.cex.fee(exchange="binance", symbol="BTC-USDT")
```

=== "Async"
</details>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi
<details markdown="1"><summary>Async</summary>

```python
import asyncio
from datamaxi.aio import AsyncDatamaxi

async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
exchanges = await client.cex.fee.exchanges()
symbols = await client.cex.fee.symbols(exchange="binance")

fees = await client.cex.fee(exchange="binance", symbol="BTC-USDT")
async def main():
async with AsyncDatamaxi(api_key="YOUR_API_KEY") as client:
exchanges = await client.cex.fee.exchanges()
symbols = await client.cex.fee.symbols(exchange="binance")

fees = await client.cex.fee(exchange="binance", symbol="BTC-USDT")

asyncio.run(main())
```

asyncio.run(main())
```

</details>

## Notes

Expand Down
Loading
Loading