Skip to main content

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-api ability 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

Metadata

Release files for bitculator 1.1.0

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

Source distribution (sdist)

Source distribution for bitculator 1.1.0
File Size Uploaded
bitculator-1.1.0.tar.gz 18.9 kB Details

Built distribution (wheel)

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

Total release size: 37.3 kB

Release files / bitculator-1.1.0.tar.gz

Download URL bitculator-1.1.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1ea9a412aa0111533ff5645dc9c903bbd224dac4899c9701ce9d456fb39d5ce8
BLAKE2b-256 checksum
How to use checksums
a891a8c0be7aecb1ef4e61f9eec31eaf75c841c600731f5fa5859d2354c37e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / bitculator-1.1.0-py3-none-any.whl

Download URL bitculator-1.1.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b05f08d08c02f9fcff9f63b013f1ceabe61196144dd8acba8e8291f5ac6bf100
BLAKE2b-256 checksum
How to use checksums
f5a506dc8b09c0098ce17d19d3f1b81837736a8ec43d01df5e6576b0b426fd33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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