Official Python SDK for the WhiteBit API — trade, query, and manage your crypto portfolio programmatically.
| Requirement | Details |
|---|---|
| Python ≥ 3.9 | Required runtime |
| WhiteBit account | Sign up at whitebit.com |
| WhiteBit API key | Profile → API keys → Create key (Read and/or Trade permissions) |
pip install whitebit-python-sdk- Log in to whitebit.com → Profile → API keys
- Create a new key — choose Read and/or Trade permissions as needed
- Copy your API Key and Token
Public endpoints (market data, tickers, order book) work without credentials. Private endpoints (account, trading) require both.
Public endpoints only (market data, tickers, order book):
from whitebit import WhitebitApi
client = WhitebitApi(txc_apikey="", token="")Private endpoints (account, trading — requires HMAC signing):
import httpx
from whitebit import WhitebitApi
from whitebit.hmac_transport import HmacTransport
client = WhitebitApi(
txc_apikey="YOUR_API_KEY",
token="",
httpx_client=httpx.Client(
transport=HmacTransport(api_secret="YOUR_API_SECRET"),
),
)Note: WhiteBit private endpoints use HMAC-SHA512 signing (
X-TXC-PAYLOAD+X-TXC-SIGNATURE).HmacTransporthandles this automatically — no manual signing needed.
---
## Usage Examples
```python
# Market data (no credentials required)
tickers = client.public_api_v4.get_market_activity()
depth = client.public_api_v4.get_orderbook(market="BTC_USDT")
# Account
balance = client.account_endpoints.get_trading_balance()
# Spot trading
order = client.spot_trading.create_limit_order(
market="BTC_USDT", side="buy", amount="0.01", price="95000"
)
client.spot_trading.cancel_order(market="BTC_USDT", order_id=order.order_id)
# Main account — transfer & withdraw
client.transfer.transfer(from_="main", to="spot", ticker="USDT", amount="100")
client.withdraw.create_withdraw(ticker="USDT", amount="500", address="0x...")
| Module | Description |
|---|---|
public_api_v4 |
Tickers, order book, trade history, klines, assets |
spot_trading |
Limit, market, stop-limit, stop-market, bulk orders |
collateral_trading |
Collateral orders, OCO, positions |
account_endpoints |
Trading balance, open orders, order history |
main_account |
Main balances, deposit addresses, fee info |
transfer |
Transfer between main and trade accounts |
withdraw |
Withdrawal requests |
codes |
WhiteBit codes — create, apply, history |
crypto_lending_fixed |
Fixed lending plans |
crypto_lending_flex |
Flex lending plans |
fees |
Trading fees |
sub_account |
Sub-account management |
mining_pool |
Hashrate and rewards |
| WhiteBIT API Documentation | Official API reference |
| API Platform Overview | REST, WebSocket, authentication, rate limits |
| Use with AI | Use API docs with Claude, Cursor, VS Code via MCP |
| GitHub Repository | Source code |
| Releases | Binaries and changelog |
| Contributing | Development setup and contribution guide |
| Report an Issue | Bug reports and feature requests |
| WhiteBIT Exchange | The exchange |