A comprehensive, type-safe, and fully documented Go SDK for interacting with the Wallex cryptocurrency exchange API.
This SDK provides a clean and intuitive interface for accessing market data, managing balances, and performing spot trading.
This SDK is unofficial and not affiliated with Wallex.
Use at your own risk — the author(s) assume no liability for financial losses or incorrect API usage.
- Full implementation of public and private Wallex endpoints
- Strongly typed request/response models
- Simple, static API-key authentication (
X-API-Key) - Real-time market data: order books, latest trades, market metadata
- Wallet (balance) retrieval
- Full order lifecycle: create, cancel, fetch, open orders, trade history
- Structured error handling (
APIError,RequestError) - Clean and maintainable Go codebase
go get github.com/darhelm/go-wallexpackage main
import (
"fmt"
wallex "github.com/darhelm/go-wallex"
)
func main() {
client, err := wallex.NewClient(wallex.ClientOptions{
ApiKey: "YOUR_WALLEX_API_KEY",
})
if err != nil {
panic(err)
}
markets, err := client.GetMarketsInfo()
if err != nil {
panic(err)
}
fmt.Println("Symbols:", len(markets.Result["symbols"]))
}- Go SDK docs: https://pkg.go.dev/github.com/darhelm/go-wallex
- Wallex API: https://api-docs.wallex.ir/
- Full examples:
EXAMPLES.md
be mindful that there is currently no way to auto refresh your tokens, you have to regenerate new tokens based on allowed set timestamp and recreate the client.
client, err := wallex.NewClient(wallex.ClientOptions{
ApiKey: "YOUR_WALLEX_API_KEY",
})markets, err := client.GetMarketsInfo()
fmt.Println(markets.Result["symbols"]["BTCUSDT"])orderBook, err := client.GetOrderBook("BTCUSDT")
fmt.Println(orderBook.Result.Ask[0], orderBook.Result.Bid[0])recentTrades, err := client.GetRecentTrades("BTCUSDT")
fmt.Println(recentTrades.Result.LatestTrades[0])balances, err := client.GetWallets()
fmt.Println(balances.Wallets["USDT"].Balance)createOrder, err := client.CreateOrder(types.CreateOrderParams{
Symbol: "BTCUSDT",
Type: "LIMIT",
Side: "BUY",
Price: "10000",
Quantity: "0.001",
})
fmt.Println(createOrder.Result.Status)cancelRes, err := client.CancelOrder("my-order-id")
fmt.Println(cancelRes.Result.Status)openOrders, _ := client.GetOpenOrders("BTCUSDT")
fmt.Println(openOrders.Result.Orders)orderStatus, _ := client.GetOrderStatus("my-order-id")
fmt.Println(orderStatus.Result)userTrades, _ := client.GetUserTrades(types.UserTradesParams{
Symbol: "BTCUSDT",
})
fmt.Println(userTrades.Result.AccountLatestTrades)if err != nil {
if apiErr, ok := err.(*wallex.APIError); ok {
fmt.Println("HTTP Status:", apiErr.StatusCode)
fmt.Println("Code:", apiErr.Code)
fmt.Println("Message:", apiErr.Message)
fmt.Println("Fields:", apiErr.Fields)
}
}- Fork the repository
- Create a branch, e.g.
feat/new-feature - Commit changes
- Open a Pull Request
Before pushing:
go vet ./...
golangci-lint runMIT License.