Skip to main content
A settlement is the final payout when a market resolves. Query them with STXSettlementService.

Fetch settlement history

using STX.Sdk.Enums;
using STX.Sdk.Services;

var settlements = serviceProvider.GetRequiredService<STXSettlementService>();

var history = await settlements.GetMySettlementsAsync(
    limit:         50,
    sortBy:        STXSortOrder.desc,
    settlementType: STXTradeSettlementType.won);

foreach (var s in history.Settlements)
{
    Console.WriteLine($"{s.SettlementId}  {s.MarketId}  {s.Type}  P&L: {s.Amount}c");
}

Common filters

limit / offsetPagination
settlementTypeSTXTradeSettlementType.won / lost / pushed / …
marketIdsOnly settlements for these markets
from / toTimestamp window

Real-time

Subscribe to STXActiveSettlementsChannelWrapper for settlements as they land instead of polling:
var channel = serviceProvider.GetRequiredService<STXActiveSettlementsChannelWrapper>();

channel.OnSettlement += s =>
    _logger.LogInformation("Settled {MarketId}: {Type} {Amount}c", s.MarketId, s.Type, s.Amount);

await channel.ConnectAsync();

See also

  • Trading — prior-state fills that lead up to a settlement
  • WebSockets — live settlement stream