whitebit-typescript-sdk
v1.0.10
Published
A TypeScript SDK for WhiteBit cryptocurrency exchange API
Maintainers
Readme
Prerequisites
| Requirement | Details | |-------------|---------| | TypeScript Node.js ≥ 18 | Required runtime | | WhiteBit account | Sign up at whitebit.com | | WhiteBit API key | Profile → API keys → Create key (Read and/or Trade permissions) |
Installation
npm install whitebit-typescript-sdkQuick Start
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.
2. Initialize the client
Public endpoints only (market data, tickers, order book):
import { WhitebitApiClient } from "whitebit-typescript-sdk";
const client = new WhitebitApiClient({ txcApikey: "" });Private endpoints (account, trading — requires HMAC signing):
import { WhitebitApiClient } from "whitebit-typescript-sdk";
import { createHmacFetch } from "whitebit-typescript-sdk/auth";
const client = new WhitebitApiClient({
txcApikey: "YOUR_API_KEY",
fetch: createHmacFetch("YOUR_API_SECRET"),
});Note: WhiteBit private endpoints use HMAC-SHA512 signing (
X-TXC-PAYLOAD+X-TXC-SIGNATURE).createHmacFetchhandles this automatically — no manual signing needed.
---
## Usage Examples
```ts
// Market data (no credentials required)
const tickers = await client.publicApiV4.getMarketActivity();
const depth = await client.publicApiV4.getOrderbook({ market: "BTC_USDT" });
// Account
const balance = await client.accountEndpoints.getTradingBalance();
// Spot trading
const order = await client.spotTrading.createLimitOrder({
market: "BTC_USDT",
side: "buy",
amount: "0.01",
price: "95000",
});
await client.spotTrading.cancelOrder({ market: "BTC_USDT", orderId: order.orderId });
// Main account — transfer & withdraw
await client.transfer.transfer({ from: "main", to: "spot", ticker: "USDT", amount: "100" });
await client.withdraw.createWithdraw({ ticker: "USDT", amount: "500", address: "0x..." });Available Modules
| 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 |
| fees | Trading fees |
| subAccount | Sub-account management |
Resources
| | | |---|---| | 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 |
