Python SDK for the AgavaDEX exchange API (REST + WebSocket)
Project description
AgavaDEX Python SDK
Python client for the AgavaDEX exchange API — a thin, typed wrapper over the public REST + WebSocket interface.
Install
pip install agavadex
Requires Python 3.9+.
Quick start
Public market data — no key needed
from agavadex import Client
with Client() as client:
for sym in client.get_symbols():
print(sym.symbol, sym.tick_size)
book = client.get_order_book("AGAVAUSDT")
print(book.bids[0].price, book.asks[0].price)
Private account & trading
API keys are created in the AgavaDEX web app (Account → API keys). Pass them to the client — never hard-code them; read them from the environment.
import os
from agavadex import Client
with Client(api_key=os.environ["AGAVADEX_API_KEY"],
api_secret=os.environ["AGAVADEX_API_SECRET"]) as client:
for balance in client.get_balances():
print(balance.asset, balance.available)
result = client.place_order(
"AGAVAUSDT", side="buy", type="limit", price="100.00", qty="1",
)
print(result.order.id, result.order.status)
WebSocket streams
import asyncio
from agavadex import MarketDataStream
async def main():
async with MarketDataStream(channels=["trades@AGAVAUSDT"]) as stream:
async for msg in stream:
print(msg.channel, msg.type, msg.data)
asyncio.run(main())
The private UserStream takes api_key / api_secret and
authenticates in-band with a signed first frame. Subscribe to any of
orders, trades, balances:
import asyncio, os
from agavadex import UserStream
async def main():
async with UserStream(
api_key=os.environ["AGAVADEX_API_KEY"],
api_secret=os.environ["AGAVADEX_API_SECRET"],
channels=["orders", "balances"],
) as stream:
async for msg in stream:
print(msg.channel, msg.type, msg.data)
asyncio.run(main())
Both streams auto-reconnect and re-subscribe on a dropped socket.
The decimal contract
Every monetary value — price, qty, volume, fee amounts — is a
decimal.Decimal, never a float. The API sends and receives these as
JSON strings; this SDK parses them losslessly. When placing orders,
price / qty accept a Decimal, str or int.
Errors
Non-2xx responses raise a typed exception — BadRequestError,
AuthenticationError, PermissionDeniedError, NotFoundError,
RateLimitError, ServerError — all subclasses of APIError. Each
carries status_code and the API's request_id; RateLimitError adds
retry_after. Pass max_retries= to Client to auto-retry 429s.
What this SDK does not do
Withdrawals are not part of the AgavaDEX API and not in this SDK — they require a wallet signature and happen only in the web app.
Development
pip install -e ".[dev]"
pytest # offline tests run with no credentials
ruff check .
Integration tests run only when AGAVADEX_API_KEY / AGAVADEX_API_SECRET
are set, and are read-only — they never place orders.
Links
- Docs: https://docs.agavadex.com
- API reference: https://docs.agavadex.com/api/reference/
- Security policy: SECURITY.md
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agavadex-0.1.2.tar.gz.
File metadata
- Download URL: agavadex-0.1.2.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42fa0eeb64e212679b46c334f76f5d617489da89c317a53309fe415211848aa1
|
|
| MD5 |
0cefd69b205010bfea1fef6a74e85936
|
|
| BLAKE2b-256 |
1f2bc41a0c778f41547b770a12ffa3f815b3d294a9e1ab87c5b7ab9479791be2
|
File details
Details for the file agavadex-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agavadex-0.1.2-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ae1ee67df96809d309969977e3bed6ce9436b71784c48df28b915b69ea8767
|
|
| MD5 |
c465b5c4fde121cd80063bcf6137e2de
|
|
| BLAKE2b-256 |
ba1529e66feaa44b3ed07d54ec9e72325431daf7b4df176adc307677f0119c07
|