# Portfolio

> Read your balance, positions, fills, settlements and account history.

Source: https://docs.stxapp.io/sdks/go/portfolio/

These calls read your own account. The fields are described in the [API reference](/api/rest/). To keep these figures current without polling, use the [live account view](/sdks/go/websockets#live-account-view).

```go
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](/sdks/go/markets#pagination).
