Skip to content

tigusigalpa/zoomex-go

Repository files navigation

zoomex-go

Zoomex Golang Client SDK

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.

Install

go get github.com/tigusigalpa/zoomex-go

Requires Go 1.21+.

Usage

REST

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)

WebSocket

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 {} // block

More examples in examples/.

Supported endpoints

Market (public)

  • 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

Trade

  • Place / Amend / Cancel Order
  • Get Open Orders, Cancel All Orders
  • Order History, Trade History

Position

  • Position Info, Set Leverage
  • Switch Isolated/Cross Margin
  • Set Trading Stop, Set Risk Limit

Account

  • Wallet Balance, Upgrade Status

Asset

  • 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

WebSocket

  • Public: Orderbook
  • Private: Order, Position, Execution, Wallet

Configuration

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

Authentication

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.

Docs

License

MIT

Author

Igor Sazonov — sovletig@gmail.com

Contributing

PRs welcome. See CONTRIBUTING.md.

About

Go client for Zoomex cryptocurrency exchange API v3. Supports all REST and WebSocket endpoints: market data, trading, positions, account, assets. HMAC_SHA256 authentication, testnet/mainnet support, real-time orderbook and private streams. Built for trading bots and market data pipelines.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages