Buda Client
A typed Python client for the Buda.com REST and WebSocket APIs — sync and async.
Buda Client is a Python library that wraps the Buda.com API, giving you a clean, fully typed interface for querying markets, managing orders, checking balances, and streaming real-time data — all without having to deal with raw HTTP requests or WebSocket frames yourself. It works great for scripts, bots, data pipelines, or just poking around from a REPL.
Features
- Sync and async REST clients —
BudaClientfor synchronous code,AsyncBudaClientforasyncioworkflows. Both expose the same intuitive API. - Real-time WebSocket streaming — Subscribe to order book updates, trades, balances, orders, and deposits via
BudaWebSocketClient. - HMAC-SHA384 authentication — Secure request signing handled automatically when you provide credentials.
- Proactive rate limiting — A sliding-window limiter throttles requests before they hit the server, respecting per-second, per-minute (authenticated), and per-minute (unauthenticated) limits.
- Automatic retries — Failed requests on 429, 500, and 503 are retried with exponential backoff, honoring the server's
Retry-Afterheader when present. - Pydantic v2 models — Every API response is parsed into a strict, typed Pydantic model. No more guessing what keys a dict has.
- Flexible credential providers — Pass credentials directly, read them from environment variables, or load them from a
.envfile. - Full type safety — Developed with Pyright in strict mode. Your editor's autocomplete will thank you.
Installation
uv add git+https://github.com/mschiaff/buda-client.git
or with pip:
pip install git+https://github.com/mschiaff/buda-client.git
Requirements: Python 3.12+
Quick Start
Fetching public market data
No credentials needed — just create a client and go:
from buda import BudaClient
with BudaClient() as client:
# List all available markets
markets = client.public.markets()
for market in markets.root:
print(f"{market.id}: {market.base_currency}/{market.quote_currency}")
# Get the ticker for a specific market
ticker = client.public.tickers("btc-clp")
print(f"BTC-CLP last price: {ticker.last_price.value} {ticker.last_price.currency}")
# Fetch the order book
book = client.public.order_book("btc-clp")
print(f"Best bid: {book.bids.max().price}, Best ask: {book.asks.min().price}")
The clients also work fine without a context manager — just remember to close them when you're done:
from buda import BudaClient
client = BudaClient()
markets = client.public.markets()
client.close()
Async usage
Same API, just async:
import asyncio
from buda import AsyncBudaClient
async def main():
async with AsyncBudaClient() as client:
ticker = await client.public.tickers("btc-clp")
print(f"Last price: {ticker.last_price.value}")
asyncio.run(main())
Authentication
Choose the credential provider that fits your setup:
from buda import BudaClient, StaticCredentials, EnvCredentials, DotEnvCredentials
# Option 1: Pass credentials directly
provider = StaticCredentials(api_key="your-key", api_secret="your-secret")
# Option 2: Read from BUDA_API_KEY and BUDA_API_SECRET environment variables
provider = EnvCredentials()
# Option 3: Load from a .env file
provider = DotEnvCredentials() # looks for .env in the current directory
with BudaClient(provider=provider) as client:
# Now you can access private endpoints
balances = client.private.balances()
for balance in balances.root:
print(f"{balance.id}: {balance.available_amount.value} available")
me = client.private.me()
print(f"Logged in as: {me.email}")
Creating an order
from buda import BudaClient, DotEnvCredentials, OrderCreate
with BudaClient(provider=DotEnvCredentials()) as client:
order = client.private.create_order(
"btc-clp",
payload=OrderCreate(
type="Bid",
price_type="limit",
amount=0.001,
limit={"price": 50_000_000},
),
)
print(f"Order {order.id} created — state: {order.state}")
WebSocket streaming
Stream real-time data with an async handler:
import asyncio
from buda import BudaWebSocketClient
async def on_event(data: dict) -> None:
print(f"Event: {data}")
async def main():
ws = BudaWebSocketClient()
await ws.book("btcclp", handler=on_event)
asyncio.run(main())
For private channels (balances, orders, deposits), pass your pubsub_key:
ws = BudaWebSocketClient(pubsub_key="your-pubsub-key")
await ws.orders(handler=on_event)
Configuration
Customize client behavior through BudaSettings:
from buda import BudaClient, BudaSettings
settings = BudaSettings(
timeout=30.0, # Request timeout in seconds (default: 10)
retry_max_attempts=5, # Max retry attempts (default: 3)
rate_limit_per_second=10, # Per-second request limit (default: 20)
)
with BudaClient(settings=settings) as client:
...
See the BudaSettings class for the full list of configurable options, including retry backoff parameters, rate limit windows, and WebSocket timeouts.
Contributing
Contributions are welcome! Whether it's a bug report, feature suggestion, or pull request — every bit helps.
Check out the Contributing Guide to get started.
License
This project is licensed under the Apache License 2.0.
Metadata
Release files for buda-client 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| buda_client-0.2.0.tar.gz | 29.6 kB | With provenance | Details for buda_client-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| buda_client-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for buda_client-0.2.0-py3-none-any.whl |
Total release size: 78.0 kB
Release files / buda_client-0.2.0.tar.gz
| Download URL | buda_client-0.2.0.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ea8d3c478bbfcc6fbe3efc648aae69e42c51179bdd587bd31d98431f6c73467
|
|
BLAKE2b-256 checksum How to use checksums |
d7214ca674869be6130ecb4753aa646369a67286e508556b155c47fb3df95b5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / buda_client-0.2.0-py3-none-any.whl
| Download URL | buda_client-0.2.0-py3-none-any.whl |
|---|---|
| Size | 48.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f853df003aeeec7543e9d7e2c702d8a4f7eb1329c97356f8aaafa3ea1cec00ff
|
|
BLAKE2b-256 checksum How to use checksums |
5864e33948ac027c09f37e951bd0d97d946c942fde6978f5a0574513572e7096
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logSecurity for buda-client 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for buda_client-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logA 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.