Settlements and payouts
A settlement is the final money-movement event for a set of contracts. Every settlement results in a realized profit or loss and the release of the corresponding position liability back into your available balance.
When Settlements Are Created
Section titled “When Settlements Are Created”Settlements are generated in two situations:
-
You close a position by trading. If you bought 10 contracts and then sell 5, those 5 contracts are settled against each other at the prices you paid and received. The remaining 5 stay open.
-
A market expires. When STX resolves a market, outstanding contracts settle at the market’s
max_pricefor a win, or $0 for a loss. Apushorsettledresult pays out between the two.
Settlement Fields
Section titled “Settlement Fields”| Field | Description |
|---|---|
id |
Unique settlement ID |
type |
closed_long, closed_short, expired_long or expired_short: whether a trade or the market’s result closed the position, and which side it was |
opening_trade_id |
The trade that opened the position |
closing_trade_id |
The trade that closed it; null when the market’s result closed it |
opening_price |
Price of the opening trade, as a dollar string |
closing_price |
Price of the closing trade, or the market’s settlement price (max_price, 0, or between them) on expiry |
quantity |
Number of contracts settled, as a quantity string |
fee |
Exchange fee charged on this settlement |
gross_pnl |
(closing_price − opening_price) × quantity for a long; the sign is inverted for a short |
realized_pnl |
gross_pnl − fee |
settled_premium |
Premium settled: negative for a long, positive for a short |
settled_risk |
Risk released by the settlement |
market_id |
Market the settlement belongs to |
account_id |
Account the settlement belongs to |
time |
When the settlement was created, ISO 8601 |
inserted_at |
The same instant, as an integer of UNIX microseconds |
Money fields are dollar strings, the same format as every other REST field; see Wire format.
Example Settlement
Section titled “Example Settlement”A member sold 100 contracts at $0.10 (opening a short) on a market whose max_price is
"1.0000", and later bought 100 contracts back at $0.20 (closing the short): a loss,
because the price moved against the short. The settlement looks like:
{ "id": "801d773e-fecc-418a-b377-155605595178", "type": "closed_short", "opening_trade_id": "17aa760d-50c0-4c1a-a5c6-fe4af4adb4bb", "closing_trade_id": "7f959093-6a30-4b48-9a59-d1e09f004340", "opening_price": "0.1000", "closing_price": "0.2000", "quantity": "100.00", "fee": "0.5000", "gross_pnl": "-10.0000", "realized_pnl": "-10.5000", "settled_premium": "10.0000", "settled_risk": "90.0000", "market_id": "687e9cdb-a391-4118-aa80-1122bb14779f", "account_id": "c1c3614c-32ae-4bea-bae4-fc3f52047790", "time": "2026-11-01T19:02:28.125460Z", "inserted_at": 1793559748125460}Gross P&L: (0.10 − 0.20) × 100 = −$10.00. After a $0.50 fee: −$10.50 net realized P&L.
Querying Settlement History
Section titled “Querying Settlement History”Use GET /api/v1/portfolio/settlements to retrieve past settlements. Each one
names its opening_trade_id and closing_trade_id, which you can match against your
fills from GET /api/v1/fills while both are still listed:
see History retention below.
History retention
Section titled “History retention”The API keeps the orders, fills and settlements of a market for at least 30 days after the
market is archived, which happens some time after it settles (the market’s archived field
becomes true). After those 30 days, its history can be removed at any time:
| Request | Once a market’s history is removed |
|---|---|
GET /api/v1/orders |
Its orders are not listed, and no filter matches them. |
GET /api/v1/orders/{order_id} |
404 {"error":"Order not found"}, as for any order the account does not have. |
GET /api/v1/fills |
Its fills are not listed, and no filter matches them. |
GET /api/v1/portfolio/settlements |
Its settlements are not listed, and no filter matches them. |
Response formats do not change. A cursor saved earlier keeps working: the next page skips the
removed rows.
Everything else stays: balances and positions; the per-market trade counts, profit and loss and
fees of GET /api/v1/account/market_stats, for every market; transactions, whose
settlement_id still names a settlement that is no longer listed; markets and events, archived
ones included; and every WebSocket channel.
If you reconcile your full history, save the orders, fills and settlements you need within
30 days of a market’s archive. Do not treat a missing older row, or a 404 for an old order
id, as an error.
Real-Time Settlement Notifications
Section titled “Real-Time Settlement Notifications”Subscribe to the settlements channel to
receive settlement records the instant they are created. This is the most reliable way to
keep a running P&L in your integration; polling settlement history will always lag behind
the live state of the exchange.

