Official Go SDK for the WhiteBit API — trade, query, and manage your crypto portfolio programmatically.
| Requirement | Details |
|---|---|
| Go ≥ 1.21 | Required runtime |
| WhiteBit account | Sign up at whitebit.com |
| WhiteBit API key | Profile → API keys → Create key (Read and/or Trade permissions) |
go get github.com/whitebit-exchange/go-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):
import (
"context"
whitebitclient "github.com/whitebit-exchange/go-sdk/client"
)
client := whitebitclient.NewClient()Private endpoints (account, trading — requires HMAC signing):
import (
"context"
whitebitclient "github.com/whitebit-exchange/go-sdk/client"
"github.com/whitebit-exchange/go-sdk/option"
wbauth "github.com/whitebit-exchange/go-sdk/auth"
)
client := whitebitclient.NewClient(
option.WithTxcApikey("YOUR_API_KEY"),
option.WithHTTPClient(wbauth.NewHmacClient("YOUR_API_SECRET")),
)Note: WhiteBit private endpoints use HMAC-SHA512 signing (
X-TXC-PAYLOAD+X-TXC-SIGNATURE).wbauth.NewHmacClienthandles this automatically — no manual signing needed.
ctx := context.Background()
// Market data (no credentials required)
tickers, _ := client.PublicAPIV4.GetMarketActivity(ctx)
depth, _ := client.PublicAPIV4.GetOrderbook(ctx, &publicapiv4.GetOrderbookRequest{Market: "BTC_USDT"})
// Account
balance, _ := client.AccountEndpoints.GetTradingBalance(ctx)
// Spot trading
order, _ := client.SpotTrading.CreateLimitOrder(ctx, &spottrading.CreateLimitOrderRequest{
Market: "BTC_USDT",
Side: "buy",
Amount: "0.01",
Price: "95000",
})
client.SpotTrading.CancelOrder(ctx, &spottrading.CancelOrderRequest{
Market: "BTC_USDT",
OrderId: order.OrderId,
})
// Main account — transfer & withdraw
client.Transfer.Transfer(ctx, &transfer.TransferRequest{From: "main", To: "spot", Ticker: "USDT", Amount: "100"})
client.Withdraw.CreateWithdraw(ctx, &withdraw.CreateWithdrawRequest{Ticker: "USDT", Amount: "500", Address: "0x..."})| Module | Description |
|---|---|
PublicAPIV4 |
Tickers, order book, trade history, klines, assets |
SpotTrading |
Limit, market, stop-limit, stop-market, bulk orders |
CollateralTrading |
Collateral orders, OCO, positions |
AccountEndpoints |
Trading balance, open orders, order history |
MainAccount |
Main balances, deposit addresses, fee info |
Transfer |
Transfer between main and trade accounts |
Withdraw |
Withdrawal requests |
Codes |
WhiteBit codes — create, apply, history |
CryptoLendingFixed |
Fixed lending plans |
CryptoLendingFlex |
Flex lending plans |
Fees |
Trading fees |
SubAccount |
Sub-account management |
MiningPool |
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 |