Official Python SDK for the Cryptohopper API
Project description
cryptohopper
Official Python SDK for the Cryptohopper API.
Status: 0.1.0a1 — early access. Covers 6 core domains:
user,hoppers,exchange,strategy,backtest,market.
Install
pip install cryptohopper
Requires Python 3.10+.
Quickstart
import os
from cryptohopper import CryptohopperClient
with CryptohopperClient(api_key=os.environ["CRYPTOHOPPER_TOKEN"]) as ch:
me = ch.user.get()
print(me["email"])
ticker = ch.exchange.ticker(exchange="binance", market="BTC/USDT")
print(ticker["last"])
Authentication
Cryptohopper uses OAuth2 bearer tokens. To get one:
- Sign in at cryptohopper.com and open the developer dashboard.
- Create an OAuth application — you'll receive a
client_idandclient_secret. - Drive the OAuth consent flow (
/oauth-consent?app_id=<client_id>&redirect_uri=<your_uri>&state=<csrf>) to receive a 40-character bearer token scoped to the permissions you requested.
Pass the token as api_key. Optionally pass your OAuth client_id as app_key — it's sent as the x-api-app-key header.
ch = CryptohopperClient(
api_key=os.environ["CRYPTOHOPPER_TOKEN"],
app_key=os.environ.get("CRYPTOHOPPER_CLIENT_ID"), # optional
)
Resources
# User
ch.user.get()
# Hoppers
ch.hoppers.list(exchange="binance")
ch.hoppers.get(42)
ch.hoppers.create({"name": "My Bot", "exchange": "binance"})
ch.hoppers.update(42, {"name": "Renamed"})
ch.hoppers.delete(42)
ch.hoppers.positions(42)
ch.hoppers.orders(42)
ch.hoppers.buy({"hopper_id": 42, "market": "BTC/USDT", "amount": 0.001})
ch.hoppers.sell({"hopper_id": 42, "market": "BTC/USDT", "amount": 0.001})
ch.hoppers.config_get(42)
ch.hoppers.config_update(42, {"strategy_id": 99})
ch.hoppers.panic(42)
# Exchange (public — no auth required)
ch.exchange.ticker(exchange="binance", market="BTC/USDT")
ch.exchange.candles(exchange="binance", market="BTC/USDT", timeframe="1h")
ch.exchange.orderbook(exchange="binance", market="BTC/USDT")
ch.exchange.markets("binance")
ch.exchange.exchanges()
# Strategy
ch.strategy.list()
ch.strategy.get(5)
ch.strategy.create({"name": "My Strategy"})
ch.strategy.update(5, {"name": "Renamed"})
ch.strategy.delete(5)
# Backtest
ch.backtest.create({"hopper_id": 42, "from_date": "2026-01-01", "to_date": "2026-03-01"})
ch.backtest.get(1)
ch.backtest.list()
ch.backtest.cancel(1)
ch.backtest.limits()
# Marketplace (public — no auth required)
ch.market.signals(type="buy")
ch.market.signal(99)
ch.market.items(type="strategy")
ch.market.homepage()
Client options
| Option | Default | Description |
|---|---|---|
api_key |
— (required) | OAuth2 bearer token |
app_key |
— | Optional OAuth client_id, sent as x-api-app-key |
base_url |
https://api.cryptohopper.com/v1 |
Override for staging/dev |
timeout |
30.0 |
Per-request timeout in seconds |
max_retries |
3 |
Retries on HTTP 429 (respects Retry-After). Set to 0 to disable. |
user_agent |
— | Appended after cryptohopper-sdk-python/<version> |
http_client |
— | Inject a custom httpx.Client |
Errors
Every non-2xx response becomes a CryptohopperError:
from cryptohopper import CryptohopperClient, CryptohopperError
try:
ch.user.get()
except CryptohopperError as err:
print(err.code) # "UNAUTHORIZED" | "FORBIDDEN" | "RATE_LIMITED" | ...
print(err.status) # HTTP status
print(err.server_code) # Numeric unique error code from the server, if any
print(err.ip_address) # Client IP the server saw (IP-whitelist debug help)
print(err.retry_after_ms) # Milliseconds to wait on 429 (if server sent Retry-After)
Unknown server-side codes pass through as-is on .code.
Rate limiting
The server enforces three buckets (normal 30/min, order 8/8s, backtest 1/2s). On HTTP 429 the SDK retries with exponential backoff up to max_retries (default 3), respecting Retry-After. Pass max_retries=0 to disable auto-retry.
Development
pip install -e ".[dev]"
ruff check .
mypy src
pytest -q
Release
Push a py-v<version> git tag. The release workflow runs ruff + mypy + pytest, verifies tag-version parity, builds sdist + wheel, and publishes via PyPI Trusted Publishing (OIDC) — no long-lived API token needed. Configure the publisher at pypi.org/manage/account/publishing before the first release.
License
MIT — see 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 cryptohopper-0.2.0a1.tar.gz.
File metadata
- Download URL: cryptohopper-0.2.0a1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43917eda43d98e0a4e8f89f4df8954161260344f244cec6e769790862a4bc0ab
|
|
| MD5 |
36a9ad3b819fabda8b5e68308f79af78
|
|
| BLAKE2b-256 |
d3a49fc38fb2cba5659a4822d5af54821b02070352b8437ad6c784b034144861
|
Provenance
The following attestation bundles were made for cryptohopper-0.2.0a1.tar.gz:
Publisher:
release.yml on cryptohopper/cryptohopper-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cryptohopper-0.2.0a1.tar.gz -
Subject digest:
43917eda43d98e0a4e8f89f4df8954161260344f244cec6e769790862a4bc0ab - Sigstore transparency entry: 1369284437
- Sigstore integration time:
-
Permalink:
cryptohopper/cryptohopper-python-sdk@38ee48f8f1c7255f1bf456ebb6f04fbb5ddcd6bc -
Branch / Tag:
refs/tags/py-v0.2.0a1 - Owner: https://github.com/cryptohopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@38ee48f8f1c7255f1bf456ebb6f04fbb5ddcd6bc -
Trigger Event:
push
-
Statement type:
File details
Details for the file cryptohopper-0.2.0a1-py3-none-any.whl.
File metadata
- Download URL: cryptohopper-0.2.0a1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bf31309611efd1ff527a9cbeaf821ac9085e185ad646d94341a959894d76f80
|
|
| MD5 |
416443c159644e63dd7d2c4a17ac63f3
|
|
| BLAKE2b-256 |
ba7e7e7daba709bc580357293d3abb1e2a0fc2afe1b9bd422442251831a7737f
|
Provenance
The following attestation bundles were made for cryptohopper-0.2.0a1-py3-none-any.whl:
Publisher:
release.yml on cryptohopper/cryptohopper-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cryptohopper-0.2.0a1-py3-none-any.whl -
Subject digest:
7bf31309611efd1ff527a9cbeaf821ac9085e185ad646d94341a959894d76f80 - Sigstore transparency entry: 1369284512
- Sigstore integration time:
-
Permalink:
cryptohopper/cryptohopper-python-sdk@38ee48f8f1c7255f1bf456ebb6f04fbb5ddcd6bc -
Branch / Tag:
refs/tags/py-v0.2.0a1 - Owner: https://github.com/cryptohopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@38ee48f8f1c7255f1bf456ebb6f04fbb5ddcd6bc -
Trigger Event:
push
-
Statement type: