AccountService
Describes github.com/stxapp/stx-go v0.3.1, the current release.
AccountService
Section titled “AccountService”type AccountService struct { // contains filtered or unexported fields}AccountService covers identity, balance, positions, the public profile and terms acceptance. Use it through Client.Account.
AcceptTerms
Section titled “AcceptTerms”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.
Balance
Section titled “Balance”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”).
Positions
Section titled “Positions”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.
UpdateProfile
Section titled “UpdateProfile”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.
UserID
Section titled “UserID”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.

