Skip to content

Portfolio

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

These calls read your own account. The fields are described in the API reference. To keep these figures current without polling, use the live account view.

balance, err := client.Account.Balance(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println(balance.AvailableBalance) // 746.8600
positions, err := client.Account.Positions(ctx, nil)
if err != nil {
log.Fatal(err)
}
for _, p := range positions {
fmt.Println(p.MarketID, p.Position) // e00651a3-10cb-4bc1-9e1f-c5ea1796c83b 40.00
}
for f, err := range client.Portfolio.AllFills(ctx, &stx.FillsQuery{MarketIDs: []string{marketID}}) {
if err != nil {
log.Fatal(err)
}
fmt.Println(f.TradeID, f.Action, f.Filled, "@", f.Price)
// a7469e3a-b608-483d-b12f-1c1534793274 buy 40.00 @ 0.5800
}
settlements, err := client.Portfolio.Settlements(ctx, &stx.SettlementsQuery{Limit: 50})
if err != nil {
log.Fatal(err)
}
for _, s := range settlements.Items {
fmt.Println(s.MarketID, s.Type, s.Quantity, s.GrossPnL)
// fd6a5668-ffda-4f97-b8fe-7aa6d79d9c5f expired_long 50.00 32.0000
}
Method Query
Account.Balance none
Account.Positions MarketIDs
Portfolio.Fills MarketIDs, OrderIDs, Status
Portfolio.Settlements MarketIDs, Type
Portfolio.MarketStats your profit and loss per market: MarketIDs, EventIDs, Sports, Competitions, FromTime, ToTime (Unix seconds), ExcludeZeroSettlements
Portfolio.Deposits, Withdrawals, Adjustments, Fees, Loyalty Limit, Cursor

Every list method returns one page and has an All twin (AllFills, AllSettlements, AllDeposits, …) that walks every page. See pagination.

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