Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sportsxapp.com/llms.txt

Use this file to discover all available pages before exploring further.

A settlement is the final payout when a prediction market resolves. Every position you hold in a market that closes generates a settlement record on your account — won, lost, or pushed. You can query settlement history via STXSettlementService or receive live settlement events over a WebSocket channel.

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");
}

Filter options

ParameterNotes
limit / offsetPagination controls
settlementTypeSTXTradeSettlementType.won, lost, pushed, or others
marketIdsArray of market IDs — only return settlements for those markets
from / toTimestamp window for date-range queries
Combine marketIds with a date range to reconcile P&L for a specific event after it settles.

Real-time settlements

For bots that need to act immediately when a market settles — for example to redeploy freed-up capital — subscribe to STXActiveSettlementsChannelWrapper 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();
The channel pushes a settlement event as soon as the exchange resolves a market you hold a position in. It requires an authenticated session — call LoginAsync before ConnectAsync.

See also

  • Trading — order fills that accumulate into positions before settlement
  • WebSockets — full channel API and reconnection behavior