Documentation
¶
Overview ¶
Package bitget is the entry point of the Bitget exchange Go SDK.
Install: go get github.com/UnipayFI/go-bitget Import: import bitget "github.com/UnipayFI/go-bitget"
The SDK covers BOTH of Bitget's account systems:
- Unified Trading Account (UTA): the /api/v3/* REST API and the v3 WebSocket streams, exposed through package uta.
- Classic account: the /api/v2/* REST API and the v2 WebSocket streams, split by product line into packages under classic/ (spot, mix (futures), margin, copy, earn, common, broker, affiliate, insloan, tax, p2p) plus the shared classic/ws stream client.
Authentication uses the HMAC-SHA256 scheme (ACCESS-KEY / ACCESS-SIGN / ACCESS-TIMESTAMP / ACCESS-PASSPHRASE); the core client/request/sign layers are shared by every product.
Quick start (UTA):
c := bitget.NewUTAClient(client.WithAuth(apiKey, apiSecret, passphrase))
if err := c.SyncServerTime(ctx); err != nil { /* ... */ }
assets, err := c.NewGetAccountAssetsService().Do(ctx)
Quick start (classic spot):
sp := bitget.NewSpotClient(client.WithAuth(apiKey, apiSecret, passphrase))
if err := sp.SyncServerTime(ctx); err != nil { /* ... */ }
tickers, err := sp.NewGetTickersService().Do(ctx)
Index ¶
- func NewAffiliateClient(options ...client.Options) *affiliate.AffiliateClient
- func NewBrokerClient(options ...client.Options) *broker.BrokerClient
- func NewClassicWebSocketClient(options ...client.WebSocketOptions) *ws.WebSocketClient
- func NewCommonClient(options ...client.Options) *common.CommonClient
- func NewCopyClient(options ...client.Options) *copy.CopyClient
- func NewEarnClient(options ...client.Options) *earn.EarnClient
- func NewInsLoanClient(options ...client.Options) *insloan.InsLoanClient
- func NewMarginClient(options ...client.Options) *margin.MarginClient
- func NewMixClient(options ...client.Options) *mix.MixClient
- func NewP2PClient(options ...client.Options) *p2p.P2PClient
- func NewSpotClient(options ...client.Options) *spot.SpotClient
- func NewTaxClient(options ...client.Options) *tax.TaxClient
- func NewUTAClient(options ...client.Options) *uta.UTAClient
- func NewUTAWebSocketClient(options ...client.WebSocketOptions) *uta.UTAWebSocketClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAffiliateClient ¶ added in v0.20260618.1
func NewAffiliateClient(options ...client.Options) *affiliate.AffiliateClient
NewAffiliateClient constructs a classic-account Affiliate REST client.
func NewBrokerClient ¶ added in v0.20260618.1
func NewBrokerClient(options ...client.Options) *broker.BrokerClient
NewBrokerClient constructs a classic-account Broker REST client.
func NewClassicWebSocketClient ¶ added in v0.20260618.1
func NewClassicWebSocketClient(options ...client.WebSocketOptions) *ws.WebSocketClient
NewClassicWebSocketClient constructs a WebSocket client for the classic-account v2 public and private streams (spot, futures, margin), including WebSocket order entry.
func NewCommonClient ¶ added in v0.20260618.1
func NewCommonClient(options ...client.Options) *common.CommonClient
NewCommonClient constructs a classic-account common REST client (server time, announcements, convert, trade-rate, virtual sub-accounts, big-data insights).
func NewCopyClient ¶ added in v0.20260618.1
func NewCopyClient(options ...client.Options) *copy.CopyClient
NewCopyClient constructs a classic-account Copy-Trading REST client.
func NewEarnClient ¶ added in v0.20260618.1
func NewEarnClient(options ...client.Options) *earn.EarnClient
NewEarnClient constructs a classic-account Earn REST client.
func NewInsLoanClient ¶ added in v0.20260618.1
func NewInsLoanClient(options ...client.Options) *insloan.InsLoanClient
NewInsLoanClient constructs a classic-account Institutional-Loan REST client.
func NewMarginClient ¶ added in v0.20260618.1
func NewMarginClient(options ...client.Options) *margin.MarginClient
NewMarginClient constructs a classic-account Margin (cross + isolated) REST client.
func NewMixClient ¶ added in v0.20260618.1
NewMixClient constructs a classic-account Futures (Mix) REST client.
func NewP2PClient ¶ added in v0.20260618.1
NewP2PClient constructs a classic-account P2P REST client.
func NewSpotClient ¶ added in v0.20260618.1
func NewSpotClient(options ...client.Options) *spot.SpotClient
NewSpotClient constructs a classic-account Spot REST client.
func NewTaxClient ¶ added in v0.20260618.1
NewTaxClient constructs a classic-account Tax REST client.
func NewUTAClient ¶
NewUTAClient constructs a REST client for the unified-account /api/v3/* endpoints.
func NewUTAWebSocketClient ¶
func NewUTAWebSocketClient(options ...client.WebSocketOptions) *uta.UTAWebSocketClient
NewUTAWebSocketClient constructs a WebSocket client for the unified-account public and private streams.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
classic
|
|
|
affiliate
Package affiliate implements the Bitget classic-account Affiliate/agent customer-info REST endpoints under /api/v2/broker/.
|
Package affiliate implements the Bitget classic-account Affiliate/agent customer-info REST endpoints under /api/v2/broker/. |
|
broker
Package broker implements the Bitget classic-account Broker REST endpoints (commission, sub-accounts, api-keys) under /api/v2/broker/.
|
Package broker implements the Bitget classic-account Broker REST endpoints (commission, sub-accounts, api-keys) under /api/v2/broker/. |
|
common
Package common implements the Bitget classic-account "common" REST endpoints: the cross-product utilities that are not specific to a single trading product — server time, announcements, trade fee rates, the all-account balance overview, coin conversion (Convert / BGB-Convert), virtual sub-account management, and the public big-data trading-insight feeds.
|
Package common implements the Bitget classic-account "common" REST endpoints: the cross-product utilities that are not specific to a single trading product — server time, announcements, trade fee rates, the all-account balance overview, coin conversion (Convert / BGB-Convert), virtual sub-account management, and the public big-data trading-insight feeds. |
|
copy
Package copy implements the Bitget classic-account Copy-Trading REST endpoints (futures + spot, trader/follower/broker) under /api/v2/copy/.
|
Package copy implements the Bitget classic-account Copy-Trading REST endpoints (futures + spot, trader/follower/broker) under /api/v2/copy/. |
|
earn
Package earn implements the Bitget classic-account Earn REST endpoints (savings, sharkfin, loan) under /api/v2/earn/.
|
Package earn implements the Bitget classic-account Earn REST endpoints (savings, sharkfin, loan) under /api/v2/earn/. |
|
insloan
Package insloan implements the Bitget classic-account Institutional Loan REST endpoints under /api/v2/spot/ins-loan/.
|
Package insloan implements the Bitget classic-account Institutional Loan REST endpoints under /api/v2/spot/ins-loan/. |
|
internal/apitest
Package apitest holds the shared, test-only helpers used by every classic-account product package (classic/spot, classic/mix, classic/margin, ...) to verify that the typed endpoint structs cover every field the live Bitget API returns.
|
Package apitest holds the shared, test-only helpers used by every classic-account product package (classic/spot, classic/mix, classic/margin, ...) to verify that the typed endpoint structs cover every field the live Bitget API returns. |
|
internal/core
Package core holds the REST client base shared by every classic-account product package (classic/spot, classic/mix, classic/margin, ...).
|
Package core holds the REST client base shared by every classic-account product package (classic/spot, classic/mix, classic/margin, ...). |
|
margin
Package margin implements the Bitget classic-account Margin (cross + isolated) REST endpoints under /api/v2/margin/.
|
Package margin implements the Bitget classic-account Margin (cross + isolated) REST endpoints under /api/v2/margin/. |
|
mix
Package mix implements the Bitget classic-account Futures (Mix) REST (and, in the websocket files, the v2 Mix streams): market data, account, position, order and plan/trigger-order endpoints under the /api/v2/mix/ path namespace.
|
Package mix implements the Bitget classic-account Futures (Mix) REST (and, in the websocket files, the v2 Mix streams): market data, account, position, order and plan/trigger-order endpoints under the /api/v2/mix/ path namespace. |
|
p2p
Package p2p implements the Bitget classic-account P2P merchant REST endpoints under /api/v2/p2p/.
|
Package p2p implements the Bitget classic-account P2P merchant REST endpoints under /api/v2/p2p/. |
|
spot
Package spot implements the Bitget classic-account Spot REST (and, in the websocket files, the v2 Spot streams): market data, spot trading, plan (trigger) orders, account information and the wallet/transfer endpoints under the /api/v2/spot/ path namespace.
|
Package spot implements the Bitget classic-account Spot REST (and, in the websocket files, the v2 Spot streams): market data, spot trading, plan (trigger) orders, account information and the wallet/transfer endpoints under the /api/v2/spot/ path namespace. |
|
tax
Package tax implements the Bitget classic-account Tax transaction-record REST endpoints under /api/v2/tax/.
|
Package tax implements the Bitget classic-account Tax transaction-record REST endpoints under /api/v2/tax/. |
|
ws
Package ws implements the Bitget classic-account (non-UTA) v2 WebSocket streams: public market channels (ticker, candlestick, depth/order-book, trades, auction) and private channels (account, orders, fill, positions, plan orders, ...) for spot, futures (mix) and margin, plus WebSocket order entry (op:"trade").
|
Package ws implements the Bitget classic-account (non-UTA) v2 WebSocket streams: public market channels (ticker, candlestick, depth/order-book, trades, auction) and private channels (account, orders, fill, positions, plan orders, ...) for spot, futures (mix) and margin, plus WebSocket order entry (op:"trade"). |
|
cmd
|
|
|
bgraw
command
Command bgraw signs and executes a single Bitget UTA REST call and pretty prints the raw response.
|
Command bgraw signs and executes a single Bitget UTA REST call and pretty prints the raw response. |
|
pkg
|
|