Skip to content

Releases: tigusigalpa/bitget-go

Bitget Go SDK v1.2.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 07 Oct 07:39

Bitget Go SDK v1.2.0

This release adds the official UTA deep candle-history route and immutable HTTP
response evidence for historical market consumers. Recent candles, recent public
fills, funding history and injected HTTP transports retain their existing APIs.

Added

  • Market.GetHistoryCandles calls /api/v3/market/history-candles with category,
    symbol, interval, type, startTime, endTime and limit selectors. Requests support
    at most 100 candles, independently of recent GetCandles' 1,000-candle route.
    Exact numeric strings, provider ordering and extra early candles from documented
    end-time rounding are preserved.
  • GetHistoryCandlesWithReceipt and GetLiquidationsWithReceipt return immutable
    models.RESTReceipt evidence: exact bounded response-body bytes, HTTP status,
    local receipt time before decoding and allowlisted request metadata without
    credentials/headers/host. Accessors copy mutable values. Receipts retain at
    most 10 MiB; oversize/interrupted bodies fail with an incomplete receipt, and
    HTTP/API/decoding errors retain the response whenever one was received.
  • Market.GetLiquidations returns models.PartialLiquidations with exact amount,
    price and event-time strings and opaque cursor pagination. These are delayed
    observations from the last three days, not a complete liquidation history:
    stable event identity, amount units and REST aggregation are not guaranteed
    by the audited contract. No synthetic identity or unit conversion is added.
  • A public history example, source-linked synthetic fixtures, contract audit and
    boundary/error/cancellation/pagination/immutability regression tests.

Coverage boundaries

The UTA market catalog documents only recent public fills. Private
/api/v3/trade/fills is account history, and Classic v2 public history uses a
different API. This release does not substitute either for an undocumented UTA
public historical fills route.

History time selectors are forwarded unchanged. The provider does not explicitly
guarantee equality at the start/end boundaries; the SDK preserves inclusive and
exclusive responses and does not infer complete coverage from page size. A full
receipt means complete HTTP bytes, not complete market history.

Upgrade and validation

go get github.com/tigusigalpa/bitget-go@v1.2.0

Go 1.21 remains supported. Normal/race tests, vet, build and module verification
passed on Go 1.21 in Linux; Windows normal/race and module checks also passed.
golangci-lint v2.14.0 reports no issues. All fixtures are classified synthetic
inputs, not live exchange captures; live boundary behaviour is not asserted.

See README, endpoint map and
source audit for examples and limitations.

v1.1.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 03 Oct 07:56

Bitget Go SDK v1.1.0

v1.1.0 makes the SDK more useful for production integrations with public market-data endpoints, observable WebSocket lifecycle events, and safer runnable examples.

What’s new

  • New public market-data methods:
    • Candles via Market.GetCandles
    • Recent trades via Market.GetPublicFills
    • Funding-rate history via Market.GetFundingRateHistory
  • Prices, quantities, and timestamps remain strings, avoiding implicit float64 rounding.
  • New lossless WebSocket raw-frame observer with:
    • Exact payload before JSON decoding
    • Local receipt time
    • Connection generation after reconnects
  • WebSocket lifecycle events for connections, subscriptions, ACKs, provider errors, and terminal failures.
  • Subscriptions can now be considered ready only after a WSSubscribed acknowledgment for the current connection generation.
  • Added demo-only account and private WebSocket examples, plus clearer README guides for REST, subscription readiness, and raw-frame handling.
  • Improved CI and code quality: HTTP/WebSocket close errors are handled, and golangci-lint v2.14.0 reports 0 issues.

Compatibility

This is an additive release. Existing REST and WebSocket APIs remain compatible.

The regular WSPush channel still uses a bounded buffer. If message loss is unacceptable, use WithRawFrameHandler and either process frames synchronously or hand them off to your own durable queue.

Validation

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • golangci-lint v2.14.0 — 0 issues

See [`

v1.0.4

Choose a tag to compare

@tigusigalpa tigusigalpa released this 02 Sep 15:20

v1.0.4 ci.yml

v1.0.3

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Aug 08:41

v1.0.3

v1.0.2

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Aug 06:50

v1.0.2

Fixed

WebSocket

  • Serialized all outgoing WebSocket writes — login, subscribe, unsubscribe, ping, and resubscribe — to prevent concurrent write to websocket connection panics.
  • Fixed a race between push delivery and Unsubscribe that could cause a send on closed channel panic.
  • Corrected the automatic reconnection lifecycle:
    • Close() now cancels pending reconnection attempts;
    • closed clients no longer reconnect in the background;
    • reconnects no longer create duplicate ping loops.
  • WebSocket authentication failures now return Bitget’s error code and message immediately instead of waiting for the login timeout.
  • Added heartbeat monitoring: if no pong is received before the timeout, the stale connection is closed and automatically reconnected.
  • Added a 10 MiB limit for incoming WebSocket messages.
  • Connections are now properly released when login fails or a connection is lost.

REST

  • Added a 10 MiB limit for HTTP response bodies.
  • Improved non-success HTTP status handling: 4xx and 5xx responses can no longer be treated as successful API calls, including malformed responses or formally successful JSON envelopes returned by upstream infrastructure.

Tests

Added regression coverage for:

  • immediate WebSocket login error handling;
  • concurrent subscriptions;
  • safe subscription-channel closing;
  • HTTP 500 responses containing a successful API envelope;
  • oversized HTTP responses.

Verification

  • go test -count=1 ./... — passed
  • go vet ./... — passed
  • git diff --check — passed

v1.0.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Aug 06:28

Bitget Go SDK v1.0.0 — Phase 1 stable release

We’re happy to announce the first stable release of bitget-go, a clean, idiomatic Go SDK for the Bitget Unified Trading Account (UTA) API v3.


What's included

REST API coverage (Phase 1)

  • Market — GetInstruments, GetTickers, GetOrderBook
  • Account — GetAssets, GetSettings, SetLeverage
  • Trade — PlaceOrder, ModifyOrder, CancelOrder, GetOpenOrders, GetOrderHistory, GetPositions

Every endpoint uses typed models.BitgetResponse[T] envelopes and returns prices, quantities, PnL, and fees as string to avoid floating-point rounding errors.

WebSocket

  • Public and private reconnecting clients built on gorilla/websocket
  • Automatic reconnection with exponential backoff (1 s → 60 s cap)
  • Auto-resubscription to every previously active channel after reconnect
  • Private fast-fill channel implemented; other channels decode through the same Subscribe API

Developer experience

  • context.Context on every network call
  • Injectable *http.Client for proxies, custom transports, or test doubles
  • Functional options: WithHTTPClient, WithBaseURL, WithDemoTrading(), WithTimeout, WithLogger, WithLocale
  • Sentinel errors and typed *BitgetError via errors.Is / errors.As
  • Only one required runtime dependency: gorilla/websocket

Safety

  • Demo trading support through WithDemoTrading() and Demo WebSocket URLs
  • The trading example requires both BITGET_DEMO=1 and BITGET_ENABLE_TRADING=1 before placing an order
  • API keys, secrets, and signatures are never logged

Installation

go get github.com/tigusigalpa/bitget-go@v1.0.0

Requirements

  • Go 1.21 or newer

Known limitations

  • This is Phase 1, so not every UTA v3 endpoint is covered yet. See docs/endpoints.md for the current mapping.
  • WebSocket channels other than fast-fill are delivered as raw payloads; decode them from push.Data until typed models land.

Useful links


Security

If you discover a vulnerability, please email sovletig@gmail.com directly rather than opening a public issue.

Thanks for trying out bitget-go. Trade safe, and test on demo first.