SDKs
Two official clients, Python and TypeScript, generated from the OpenAPI contract: every route is a typed method named after its path, pagination is followed for you, errors are typed exceptions carrying the stable error.code, retries respect Retry-After, and the WebSocket stream reconnects by itself.
#Install
The packages are published as assets of each release of the public repository github.com/bytnode/bytnode-SDK, with their source and changelog. They are not on PyPI and npm yet: install the release asset, by its URL.
pip install https://github.com/bytnode/bytnode-SDK/releases/download/v0.2.1/bytnode-0.2.1-py3-none-any.whl
# with pandas: pip install "bytnode[pandas] @ https://github.com/bytnode/bytnode-SDK/releases/download/v0.2.1/bytnode-0.2.1-py3-none-any.whl"
export BYTNODE_API_KEY="your_key"Both read the key from the BYTNODE_API_KEY environment variable, the name every example of this documentation uses.
#First calls
from bytnode import Bytnode
client = Bytnode() # reads BYTNODE_API_KEY
rate = client.funding.rate("BTCUSDT")
print(rate.data.rate_pct, rate.data.time)
# every page of a history, followed for you, into one DataFrame
df = client.klines.iter("BTCUSDT", "1h", since="2026-10-01").to_pandas()#What the clients do for you
- The URL is the method.
/v1/funding/rate/historyisclient.funding.rate.history(...); each row is a typed model with the API’s own field names, dates already converted. - Pagination.
.iter()followsnextpage after page until it isnull, with the largest pages the route allows; time bounds as a date, an ISO string or epoch milliseconds. - Errors. One exception per situation (invalid request, permission denied, rate limit...) carrying
code,paramand the API’s message. - Retries. 429 and 503 wait for
Retry-After; 502, 503, 504 and network errors back off with jitter; a spent monthly quota fails fast. - Stream. Reconnection with backoff, re-subscription, typed messages and loss detection from
seq.
#Generate your own client
The contract is built for code generators: every operation has a readable operationId (getFundingRateHistory), every response a named schema (FundingRate, Kline, Trade...), and closed values are enums (timeframe, asset, order). For another language, generate from https://api.bytnode.com/openapi.json:
# TypeScript types
npx openapi-typescript https://api.bytnode.com/openapi.json -o bytnode.d.ts
# Python client
pipx run openapi-python-client generate --url https://api.bytnode.com/openapi.json#Versions
The SDK version follows its own changelog; each release is generated from one version of the contract, which every API response announces in the BytNode-Contract-Version header. Compare the two to know whether the API has moved since your client was generated. See Versioning.
bytnode 0.2.1 · contract 2.0.0