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
| Parameter | Notes |
|---|
limit / offset | Pagination controls |
settlementType | STXTradeSettlementType.won, lost, pushed, or others |
marketIds | Array of market IDs — only return settlements for those markets |
from / to | Timestamp 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