A comprehensive, type-safe, and fully documented Go SDK for interacting with the Nobitex cryptocurrency exchange API.
This SDK provides a clean and intuitive interface for authentication, wallet access, order execution, and real-time market data.
This SDK is unofficial and not officially affiliated with Nobitex.
Use at your own risk — the author(s) assume no responsibility for any losses resulting from API usage or trading logic.
- Full implementation of public and private Nobitex endpoints
- Strongly typed request/response models
- Full OTP authentication support (TOTP, compatible with
github.com/pquerna/otp) - Auto-refresh of API keys (4 hours or ~30 days depending on
remembermode) - Real-time market data: tickers, order books, recent trades
- Wallet management
- Full order lifecycle: create, cancel, bulk-cancel, history, status
- Structured error handling (
APIError,RequestError) - Clean and maintainable Go codebase
go get github.com/darhelm/go-nobitexpackage main
import (
"fmt"
nobitex "github.com/darhelm/go-nobitex"
)
func main() {
client, err := nobitex.NewClient(nobitex.ClientOptions{
Username: "user@example.com",
Password: "your-password",
OtpCode: "123456",
Remember: "yes",
UserAgent: "MyBot/1.0",
AutoRefresh: true,
})
if err != nil {
panic(err)
}
cfg, err := client.GetNobitexConfig()
if err != nil {
panic(err)
}
fmt.Println(cfg.Nobitex.ActiveCurrencies)
}- Go SDK docs: https://pkg.go.dev/github.com/darhelm/go-nobitex
- Nobitex API: https://apidocs.nobitex.ir/
- Full examples:
EXAMPLES.md
client, err := nobitex.NewClient(nobitex.ClientOptions{
Username: "user@example.com",
Password: "pass",
OtpCode: "123456",
Remember: "yes",
UserAgent: "Bot/1.0",
})cfg, err := client.GetNobitexConfig()
fmt.Println(cfg.Nobitex.AllCurrencies)tickers, err := client.GetTickers(types.GetTickersParams{
SrcCurrency: "btc",
DstCurrency: "usdt",
})
for symbol, t := range tickers.Stats {
fmt.Println(symbol, t.Latest)
}orderBook, err := client.GetOrderBook("btc-usdt")
fmt.Println(ob.Asks[0], ob.Bids[0])recentTrades, err := client.GetRecentTrades("btc-usdt")balances, err := client.GetWallets(types.GetWalletParams{
Currencies: []string{"BTC", "USDT"},
})createOrder, err := client.CreateOrder(types.CreateOrderParams{
Execution: "limit",
Type: "buy",
SrcCurrency: "btc",
DstCurrency: "usdt",
Amount: "0.01",
Price: "2000000000",
})cancel, err = client.CancelOrder(types.CancelOrderParams{
Id: 123,
})bulkCancel, err = client.CancelOrderBulk(types.CancelOrderBulkParams{
Hours: 1,
Execution: "limit",
TradeType: types.TradeTypeSpot,
SrcCurrency: "btc",
DstCurrency: "usdt",
})orderHistory, _ := client.GetOrdersHistory(types.GetOrdersListParams{
SrcCurrency: "btc",
DstCurrency: "usdt",
})openOrders, _ := client.GetOpenOrders(types.GetOrdersListParams{})orderStatus, _ := client.GetOrderStatus(types.GetOrderStatusParams{
Id: 123456,
})userTrades, _ := client.GetUserTrades(types.GetUserTradesParams{
SrcCurrency: "btc",
DstCurrency: "usdt",
})if err != nil {
if apiErr, ok := err.(*nobitex.APIError); ok {
fmt.Println(apiErr.Status, apiErr.Code, apiErr.Message, apiErr.Detail)
}
}- Fork the repository
- Create a branch in this example
feat/new-feature - Commit changes
- Open Pull Request
Before pushing:
go vet ./...
golangci-lint runMIT License.