Skip to content

Account Management

Igor Sazonov edited this page Aug 9, 2026 · 1 revision

The Account service provides the SDK's implemented private UTA account endpoints. Construct RestClient with an API key, secret key, and passphrase that have the account permissions appropriate for the requested action. Bitget distinguishes account-management and trading permissions, so a key that can read account data may not be allowed to change leverage. 1 2

Supported methods

Method Signature Returns HTTP endpoint
GetAssets GetAssets(ctx) *models.AccountAssets GET /api/v3/account/assets
GetSettings GetSettings(ctx) *models.AccountSettings GET /api/v3/account/settings
SetLeverage SetLeverage(ctx, req) error POST /api/v3/account/set-leverage

All three methods are signed by the shared REST client. An API-level failure can be inspected as *bitget.BitgetError, while known error codes also map to sentinel errors; see Errors and Reliability. 1 3

Read the unified-account asset snapshot

GetAssets returns aggregate account metrics together with a per-coin Assets slice. Monetary and risk-related values, including AccountEquity, UnrealisedPnl, MgnRatio, and every AssetHolding balance, remain strings. 1 4

assets, err := client.Account.GetAssets(ctx)
if err != nil {
    return err
}

fmt.Printf("account equity: %s\n", assets.AccountEquity)
fmt.Printf("margin ratio: %s\n", assets.MgnRatio)

for _, asset := range assets.Assets {
    fmt.Printf(
        "%s balance=%s available=%s equity=%s USD=%s\n",
        asset.Coin,
        asset.Balance,
        asset.Available,
        asset.Equity,
        asset.UsdValue,
    )
}
Type Selected fields Meaning in the SDK model
models.AccountAssets AccountEquity, UsdtEquity, BtcEquity, UnrealisedPnl, Mmr, Imr, MgnRatio, Assets Account-level equity, PnL, margin, and risk snapshot.
models.AssetHolding Coin, Equity, UsdValue, Balance, Available, Debt, Locked, Bonus Balance and related amounts for one asset.

Interpret the financial and risk semantics according to Bitget's UTA documentation and the selected account mode, rather than assuming that a field has the same behavior across products. 2

Read account settings

GetSettings returns the account mode, asset mode, hold mode, and configured leverage/margin details at the symbol and coin levels. 1 4

settings, err := client.Account.GetSettings(ctx)
if err != nil {
    return err
}

fmt.Printf("account mode: %s; hold mode: %s\n", settings.AccountMode, settings.HoldMode)

for _, cfg := range settings.SymbolConfigList {
    fmt.Printf(
        "%s %s mode=%s leverage=%s\n",
        cfg.Category,
        cfg.Symbol,
        cfg.MarginMode,
        cfg.Leverage,
    )
}
Model Fields Use
models.AccountSettings UID, AccountMode, AssetMode, AccountLevel, HoldMode, StpMode Account-wide mode and configuration view.
models.SymbolConfig Category, Symbol, MarginMode, Leverage Futures-related configuration for one symbol.
models.CoinConfig Coin, Leverage Margin-trading leverage configuration for one coin.

Change leverage

SetLeverage accepts a models.SetLeverageRequest and returns only an error. The fields Bitget requires depend on the category and account configuration, so read the applicable official endpoint specification before submitting a change. 1 5

err := client.Account.SetLeverage(ctx, models.SetLeverageRequest{
    Category:   models.CategoryUSDTFutures,
    Symbol:     "BTCUSDT",
    MarginMode: models.MarginModeCrossed,
    Leverage:   "3",
})
if err != nil {
    return err
}
Request field Type Notes
Category models.Category Required by the SDK request model.
Symbol string Optional in Go; requiredness depends on the Bitget scenario.
Leverage string Single leverage value where applicable.
Coin string Used for applicable coin-level settings.
PosSide models.PosSide Use models.PosSideLong or models.PosSideShort where relevant.
MarginMode models.MarginMode Use models.MarginModeCrossed or models.MarginModeIsolated.
LongLeverage, ShortLeverage string Side-specific values where supported.

Operational caution. A leverage change can alter trading risk. Validate account mode, existing positions, symbol configuration, API permissions, and the live Bitget rules before invoking SetLeverage from automated workflows.

References

Clone this wiki locally