Official Python SDK for the Bitculator Data API
Project description
Bitculator Data API — Python SDK
bitculator.com · API documentation · Get an API key
PyPI — bitculator · GitHub
The official Python SDK for the Bitculator Data API. Zero dependencies (standard-library only), typed, works on Python 3.9+.
Keep your API key server-side. It is a Bearer token with the
data-apiability and is not meant for client-side embedding.
Install
pip install bitculator
Quick start
import os
from bitculator import Bitculator
client = Bitculator(os.environ["BITCULATOR_API_KEY"])
# Single resource — the {"data": ...} envelope is unwrapped for you.
bitcoin = client.coins.get("bitcoin")
print(bitcoin["price"]) # "63520.780763913" — a decimal string, never rounded
# A paginated list.
page = client.coins.list(per_page=50, sort="-marketcap")
print(page.data, page.meta["total"])
Prices are decimal strings
Prices, rates, and supplies come back as strings (e.g. "63520.780763913")
to preserve full precision. Use decimal.Decimal if you need to do math — do
not pass them through float(), which silently loses precision.
Pagination
Every paginated method returns a Page. Read one page, or iterate to walk them all:
# One page at a time.
page = client.exchanges.list(per_page=100)
while page is not None:
for exchange in page.data:
print(exchange["name"])
page = page.next_page()
# Or auto-paginate across every page (iterating a Page walks all pages).
for coin in client.coins.list(sort="-marketcap"):
print(coin["symbol"])
Errors
Every failure derives from BitculatorError; HTTP failures raise a status-specific
subclass carrying the {"error": {"code", "message", "details"}} envelope.
from bitculator import ValidationError, RateLimitError, APIError
try:
client.coins.list(per_page=9999) # over the plan cap -> 422
except ValidationError as err:
print(err.code, err.details)
except RateLimitError as err:
print("retry after", err.retry_after)
except APIError as err:
print(err.status, err.message)
| Status | Exception |
|---|---|
| 401 | AuthenticationError |
| 403 | PermissionDeniedError (plan does not include this endpoint) |
| 404 | NotFoundError |
| 422 | ValidationError (.details holds the field errors) |
| 429 | RateLimitError (.retry_after) |
| 5xx | ServerError |
Timeouts raise APITimeoutError; network failures raise APIConnectionError.
Quota
Every response carries X-Quota-* headers, surfaced on the client after each call:
client.coins.list()
print(client.quota) # Quota(limit=..., remaining=..., reset=..., raw={...})
Configuration
Bitculator(
api_key, # required (positional)
base_url="https://bitculator.com", # default
timeout=30.0, # seconds, default
max_retries=2, # auto-retry 429 / 5xx / network; 0 to disable
)
Passing parameters
Query parameters are keyword arguments and mirror the API's names exactly
(per_page, min_price, ...). For the reserved word from (in convert), pass
from_ — the SDK maps it back to from on the wire:
client.conversion.convert(from_="btc", to="usd", amount=1)
Resources
coins · prices · markets · exchanges · wallets · global_market ·
sentiment · indicators · liquidations · conversion · calculators ·
editorial · alarms · webhooks · meta
Full endpoint reference: https://bitculator.com/en/documentation/api/v1.
License
MIT
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 bitculator-1.0.1.tar.gz.
File metadata
- Download URL: bitculator-1.0.1.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e1191c5666f831367745b3f46a3db1d6739b294367ce4f8c861c8d4ffc481c
|
|
| MD5 |
3cd7fdcc9d74d1a7985b5acb25845ad4
|
|
| BLAKE2b-256 |
2010c266b44c1031a30b9e9ee52ae35d059105b03accfb439de709ef05334ebd
|
File details
Details for the file bitculator-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bitculator-1.0.1-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68eaa6a40fcd8bbfe1903946f92ba3bcc722c6bca1742147608fc7104cb8d888
|
|
| MD5 |
e1be21c1692149775099d00e8dcb7a16
|
|
| BLAKE2b-256 |
6ce2d026bb3140b5e54e9b9dc784c788c90fe72e93569e35ee1e7b0f80b4c41b
|