Skip to content

Portfolio

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.

using STX.Sdk;
using var client = new STXClient();
var balance = await client.GetBalanceAsync();
Console.WriteLine(balance.AvailableBalance); // 10019994.0700
foreach (var p in await client.GetPositionsAsync())
Console.WriteLine($"{p.MarketId} {p.NetPosition}");
await foreach (var fill in client.GetAllFillsAsync(limit: 50))
Console.WriteLine($"{fill.TradeId} {fill.Action} {fill.Filled} @ {fill.Price}");
// f4bf5929-2f7d-41ff-a70b-6d8c4de57933 sell 7.00 @ 0.2371
foreach (var s in await client.GetSettlementsAsync(limit: 50))
Console.WriteLine($"{s.MarketId} {s.Type} {s.Quantity} {s.GrossPnl}");
// 4582dc69-296c-4ce3-911c-5314b00b93f7 expired_short 16.00 1.6992

NetPosition is the API’s position field: positive when long, negative when short.

Method Filters
GetBalanceAsync() none
GetPositionsAsync() marketIds
GetFillsAsync() marketIds, orderIds, status
GetSettlementsAsync() marketIds, type
GetAccountMarketStatsAsync() marketIds, eventIds, sports, competitions, fromTime, toTime, excludeZeroSettlements, unsettledOnly
GetDepositsAsync(), GetWithdrawalsAsync(), GetAdjustmentsAsync(), GetFeesAsync(), GetLoyaltyAsync() limit, cursor

GetPositionsAsync() returns every position in one list. The other list methods return one page and have a GetAll...Async twin (GetAllFillsAsync, GetAllSettlementsAsync, GetAllDepositsAsync, …) that walks all pages. See pagination.

AcceptTermsAsync() accepts the current STX terms for your own account. Requests signed with your API key keep working while new terms are pending.