Go client for Zoomex cryptocurrency exchange API v3. Covers REST and WebSocket endpoints.
If you're building a trading bot, market data collector, or portfolio tracker in Go and need to interact with Zoomex — this package wraps the whole v3 API so you don't have to deal with raw HTTP requests, signature generation, or WebSocket connection management yourself.
Works with both testnet and mainnet. Supports linear and inverse perpetual contracts.
go get github.com/tigusigalpa/zoomex-goRequires Go 1.21+.
client := zoomex.NewClient(
zoomex.WithTestnet(true),
zoomex.WithAPIKey("your-api-key"),
zoomex.WithSecretKey("your-secret-key"),
)
serverTime, err := client.Market.GetServerTime(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Printf("Server time: %s\n", serverTime.TimeNano)
tickers, err := client.Market.GetTickers(context.Background(), &zoomex.GetTickersRequest{
Category: zoomex.CategoryLinear,
Symbol: "BTCUSDT",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Last price: %s\n", tickers.List[0].LastPrice)ws := zoomex.NewWebSocket(
zoomex.WithTestnet(true),
zoomex.WithAPIKey("your-api-key"),
zoomex.WithSecretKey("your-secret-key"),
)
defer ws.Close()
err := ws.SubscribeOrderbook("BTCUSDT", func(data *zoomex.OrderbookData) {
log.Printf("Orderbook: %+v\n", data)
})
if err != nil {
log.Fatal(err)
}
select {} // blockMore examples in examples/.
- Server Time, Kline, Mark Price Kline, Index Price Kline, Premium Index Price Kline
- Instruments Info, Orderbook, Tickers
- Funding Rate History, Public Trading History, Risk Limit
- Place / Amend / Cancel Order
- Get Open Orders, Cancel All Orders
- Order History, Trade History
- Position Info, Set Leverage
- Switch Isolated/Cross Margin
- Set Trading Stop, Set Risk Limit
- Wallet Balance, Upgrade Status
- Coin Exchange History, Delivery Record, Settlement Record
- Asset Info, All Coins Balance, Single Coin Balance
- Internal Transfer Records, Sub UID List
- Create Internal Transfer, Create Subaccount Transfer
- Deposit Records, Withdrawal Records, Coin Info
- Withdraw, Cancel Withdrawal
- Public: Orderbook
- Private: Order, Position, Execution, Wallet
The client is configured through functional options:
client := zoomex.NewClient(
zoomex.WithTestnet(true), // use testnet (default: mainnet)
zoomex.WithAPIKey("..."), // API key for private endpoints
zoomex.WithSecretKey("..."), // secret for HMAC signing
zoomex.WithRecvWindow(10000), // request validity window in ms (default: 5000)
zoomex.WithHTTPClient(customClient), // bring your own http.Client
)For WebSocket, the same options apply:
ws := zoomex.NewWebSocket(
zoomex.WithTestnet(true),
zoomex.WithAPIKey("..."),
zoomex.WithSecretKey("..."),
)Base URLs used under the hood:
| REST | WebSocket | |
|---|---|---|
| Mainnet | https://openapi.zoomex.com |
wss://stream.zoomex.com/v3/private |
| Testnet | https://openapi-testnet.zoomex.com |
wss://stream-testnet.zoomex.com/v3/private |
Private endpoints are signed with HMAC_SHA256. Pass your API key and secret via WithAPIKey / WithSecretKey — the
client builds the signature and sets X-BAPI-* headers on each request automatically. You don't need to calculate
timestamps or sign anything manually.
Public endpoints (market data) don't require credentials.
Testnet and mainnet are toggled with WithTestnet(true|false). Get your testnet keys
at testnet.zoomex.com.
MIT
Igor Sazonov — sovletig@gmail.com
PRs welcome. See CONTRIBUTING.md.
