Skip to content

darhelm/go-nobitex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Nobitex

Go Reference Go Report Card License: MIT Go Version

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.

Disclaimer

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.

Features

  • 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 remember mode)
  • 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

Installation

go get github.com/darhelm/go-nobitex

Quick Start

package 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)
}

Documentation


Examples

Authentication

client, err := nobitex.NewClient(nobitex.ClientOptions{
    Username:  "user@example.com",
    Password:  "pass",
    OtpCode:   "123456",
    Remember:  "yes",
    UserAgent: "Bot/1.0",
})

Get Nobitex Config

cfg, err := client.GetNobitexConfig()
fmt.Println(cfg.Nobitex.AllCurrencies)

Get Tickers

tickers, err := client.GetTickers(types.GetTickersParams{
    SrcCurrency: "btc",
    DstCurrency: "usdt",
})
for symbol, t := range tickers.Stats {
    fmt.Println(symbol, t.Latest)
}

Get Order Book

orderBook, err := client.GetOrderBook("btc-usdt")
fmt.Println(ob.Asks[0], ob.Bids[0])

Get Recent Trades

recentTrades, err := client.GetRecentTrades("btc-usdt")

Get Wallets

balances, err := client.GetWallets(types.GetWalletParams{
    Currencies: []string{"BTC", "USDT"},
})

Create Order

createOrder, err := client.CreateOrder(types.CreateOrderParams{
    Execution:   "limit",
    Type:        "buy",
    SrcCurrency: "btc",
    DstCurrency: "usdt",
    Amount:      "0.01",
    Price:       "2000000000",
})

Cancel Order

cancel, err = client.CancelOrder(types.CancelOrderParams{
    Id: 123,
})

Bulk Cancel

bulkCancel, err = client.CancelOrderBulk(types.CancelOrderBulkParams{
    Hours:       1,
    Execution:   "limit",
    TradeType:   types.TradeTypeSpot,
    SrcCurrency: "btc",
    DstCurrency: "usdt",
})

Order History

orderHistory, _ := client.GetOrdersHistory(types.GetOrdersListParams{
    SrcCurrency: "btc",
    DstCurrency: "usdt",
})

Open Orders

openOrders, _ := client.GetOpenOrders(types.GetOrdersListParams{})

Order Status

orderStatus, _ := client.GetOrderStatus(types.GetOrderStatusParams{
    Id: 123456,
})

User Trades

userTrades, _ := client.GetUserTrades(types.GetUserTradesParams{
    SrcCurrency: "btc",
    DstCurrency: "usdt",
})

Error Handling

if err != nil {
    if apiErr, ok := err.(*nobitex.APIError); ok {
        fmt.Println(apiErr.Status, apiErr.Code, apiErr.Message, apiErr.Detail)
    }
}

Contributing

  1. Fork the repository
  2. Create a branch in this example feat/new-feature
  3. Commit changes
  4. Open Pull Request

Before pushing:

go vet ./...
golangci-lint run

License

MIT License.

About

Nobitex Exchange GoLang Client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages