Skip to main content

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.

License

Apache-2.0

Metadata

Release files for agavadex 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agavadex 0.1.2
File Size Uploaded Provenance Actions
agavadex-0.1.2.tar.gz 22.8 kB Without provenance Details for agavadex-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agavadex 0.1.2
File Interpreter ABI Platform Actions
agavadex-0.1.2-py3-none-any.whl Python 3 none any Details for agavadex-0.1.2-py3-none-any.whl

Total release size: 40.9 kB

Release files / agavadex-0.1.2.tar.gz

Download URL agavadex-0.1.2.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
42fa0eeb64e212679b46c334f76f5d617489da89c317a53309fe415211848aa1
BLAKE2b-256 checksum
How to use checksums
1f2bc41a0c778f41547b770a12ffa3f815b3d294a9e1ab87c5b7ab9479791be2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / agavadex-0.1.2-py3-none-any.whl

Download URL agavadex-0.1.2-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0ae1ee67df96809d309969977e3bed6ce9436b71784c48df28b915b69ea8767
BLAKE2b-256 checksum
How to use checksums
ba1529e66feaa44b3ed07d54ec9e72325431daf7b4df176adc307677f0119c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for agavadex 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page