Skip to content

AccountService

Describes github.com/stxapp/stx-go v0.3.1, the current release.

type AccountService struct {
// contains filtered or unexported fields
}

AccountService covers identity, balance, positions, the public profile and terms acceptance. Use it through Client.Account.

func (s *AccountService) AcceptTerms(ctx context.Context, deviceID string, opts *AcceptTermsOptions) (string, error)

AcceptTerms accepts the current terms for your own account (POST /api/v1/tnc/accept) and returns the server’s message. An app cannot accept terms for a member: with a member’s OAuth token the exchange answers 403, and the member accepts on an STX page instead.

func (s *AccountService) Balance(ctx context.Context) (*Balance, error)

Balance returns the balance, liabilities and fee schedule (GET /api/v1/account/balance), the same object the balances channel pushes.

func (s *AccountService) Me(ctx context.Context) (*Me, error)

Me returns who this key belongs to (GET /api/v1/me): the user id the account channels are keyed by, the account id, and the key’s scope (“read_only” or “read_write”).

func (s *AccountService) Positions(ctx context.Context, q *PositionsQuery) ([]Position, error)

Positions returns your open positions (GET /api/v1/positions), the same objects the positions channel sends on join. Position is positive when long, negative when short.

func (s *AccountService) UpdateProfile(ctx context.Context, update ProfileUpdate) (*Me, error)

UpdateProfile changes your public handle, avatar or leaderboard opt-in (PATCH /api/v1/me/profile) and returns the updated identity. Where the exchange has no leaderboard it returns an error matching ErrNotAvailable.

func (s *AccountService) UserID(ctx context.Context) (string, error)

UserID returns the user id from AccountService.Me, fetched once and cached. When Me is forbidden for this credential, the id comes from AccountService.Balance, which carries the same user id.

STX is operated by XV Exchange, LLC, a Designated Contract Market regulated by the U.S. Commodity Futures Trading Commission (CFTC). Contracts traded on STX are cleared by XV Clearing, LLC, a CFTC-registered Derivatives Clearing Organization. Trading involves substantial risk of loss and may not be appropriate for everyone. Members risk losing the cost to enter any transaction, including fees. Consider whether trading is appropriate for you in light of your experience and financial resources. Nothing on this site is investment advice or a recommendation to trade. Past performance is not indicative of future results.

© 2026 STX. All rights reserved.llms.txtllms-full.txtView as Markdown
Docs version v1.10.5