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
1. Get your API credentials
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.
from whitebit import WhitebitApi
client = WhitebitApi (
txc_apikey = "YOUR_API_KEY" ,
token = "YOUR_TOKEN" ,
)
# 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
Apache 2.0