Skip to content

Get account market stats

Your exposure and realized result per market: liability, projected fees and worst-case loss. status, title and event_start_time come from the live market index and are null for a market no longer held there.

GET
/api/v1/account/market_stats
Try it

Every endpoint, in one place: the full Try it.

Signing happens in your browser with WebCrypto. Your private key is never sent anywhere; Send request sends your key ID and the signature to the demo host above. Only demo hosts are offered. The key ID and private key are saved in this browser's local storage, per jurisdiction, until you click Clear saved key. Use a demo key here, never a production one.

Name In Type Required Description
market_ids query string no Comma-separated market UUIDs.
event_ids query string no Comma-separated event UUIDs.
exclude_zero_settlements query boolean no Omit markets whose settlement count is zero. An unrecognized value is silently ignored rather than rejected: the filter is dropped.
from_time query integer no Inclusive lower bound on last_settled_at, as UNIX microseconds.
to_time query integer no Inclusive upper bound on last_settled_at, as UNIX microseconds.
sports query string no Comma-separated sports, case-insensitive.
competitions query string no Comma-separated competitions, case-insensitive.
limit query integer no Rows per page. Defaults to 100 and is silently clamped to 200; a larger value is not an error.
cursor query string no Cursor from the previous response. Omit for the first page.
Status Description Schema
200 Success object
400 A parameter was missing or invalid. Error
401 Missing, malformed or unrecognized signature, or a timestamp outside the 30-second window. Body: {“error”:“Missing or invalid API key credentials”} Error
403 The account behind this key is not active, for example it is pending approval or suspended. Body: {“error”:“Your account is suspended. Contact support.”}, the message naming the account’s status. Error

Request:

curl --request GET \
--url 'https://demo.stxapp.io/api/v1/account/market_stats' \
--header 'X-STX-ACCESS-KEY: <key-id>' \
--header 'X-STX-ACCESS-TIMESTAMP: <unix-ms>' \
--header 'X-STX-ACCESS-SIGNATURE: <base64-ed25519>'

Response 200:

{
"cursor": null,
"market_stats": [
{
"account_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"archived_at": null,
"available_position": "2.00",
"average_open_premium": "0.6700",
"buy_contracts_closed": "2.00",
"buy_contracts_expired": "2.00",
"buy_contracts_settled": "2.00",
"buy_contracts_traded": "2.00",
"buy_order_liability": "0.6700",
"buy_orders": 0,
"buy_original_risk": "0.6700",
"buy_settlements": 0,
"buy_trade_count": 0,
"cancelled_buy_contracts": "2.00",
"cancelled_buy_orders": 0,
"cancelled_contracts": "2.00",
"cancelled_orders": 0,
"cancelled_sell_contracts": "2.00",
"cancelled_sell_orders": 0,
"closed_buy_premium": "0.6700",
"closed_fees": "0.6700",
"closed_gross_pnl": "0.6700",
"closed_net_pnl": "0.6700",
"closed_premium": "0.6700",
"closed_sell_premium": "0.6700",
"competition": "string",
"contracts_closed": "2.00",
"contracts_expired": "2.00",
"contracts_in_buy_orders": "2.00",
"contracts_in_orders": "2.00",
"contracts_in_sell_orders": "2.00",
"contracts_settled": "2.00",
"contracts_traded": "2.00",
"event_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"event_start_time": null,
"expired_buy_premium": "0.6700",
"expired_fees": "0.6700",
"expired_gross_pnl": "0.6700",
"expired_net_pnl": "0.6700",
"expired_premium": "0.6700",
"expired_sell_premium": "0.6700",
"fee_plugin": null,
"inserted_at": 0,
"last_settled_at": null,
"market_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"market_max_price": "1.0000",
"max_liability_loss": "0.6700",
"max_liability_win": "0.6700",
"max_potential_fee": "0.6700",
"max_potential_profit": "0.6700",
"max_risk": "0.6700",
"needs_rebuild": false,
"open_order_count": 0,
"open_potential_fee": "0.6700",
"open_potential_profit": "0.6700",
"open_premium": "0.6700",
"open_risk": "0.6700",
"open_trade_count": 0,
"order_liability": "0.6700",
"orders": 0,
"original_risk": "0.6700",
"pending_close_fee": "0.6700",
"pending_close_pnl": "0.6700",
"position": "2.00",
"position_accountability_alert_id": null,
"position_premium_liability": "0.6700",
"potential_order_trade_fee": "0.6700",
"rejected_buy_orders": 0,
"rejected_orders": 0,
"rejected_sell_orders": 0,
"sell_contracts_closed": "2.00",
"sell_contracts_expired": "2.00",
"sell_contracts_settled": "2.00",
"sell_contracts_traded": "2.00",
"sell_order_liability": "0.6700",
"sell_orders": 0,
"sell_original_risk": "0.6700",
"sell_settlements": 0,
"sell_trade_count": 0,
"settled_at": null,
"settlements": 0,
"sport": "string",
"status": null,
"title": null,
"total_fees": "0.6700",
"total_liability": "0.6700",
"total_net_pnl": "0.6700",
"total_settlement_pnl": "0.6700",
"trade_count": 0,
"updated_at": 0
}
]
}
Field Type Description
cursor string Opaque cursor for the next page. Pass the value from the previous response; omit for the first page. null once there are no more pages.
account_id uuid The account the record belongs to.
archived_at int64 When the record was marked as archived. null until the market is archived. UNIX microseconds.
available_position decimal The amount of the position that is not reserved for pending orders. In contracts.
average_open_premium decimal The average premium of all open contracts. In dollars.
buy_contracts_closed decimal The total number of buy contracts that were closed.
buy_contracts_expired decimal The total number of buy contracts that were expired.
buy_contracts_settled decimal The total number of buy contracts settled in the position.
buy_contracts_traded decimal The total number of buy contracts the account has traded. Only opening trade’s contracts are included.
buy_order_liability decimal The order liability on this position from buy orders. In dollars.
buy_orders integer Count of all buy orders.
buy_original_risk decimal The original risk incurred by buy trades. In dollars.
buy_settlements integer Count of all settlements from buy trades.
buy_trade_count integer The total number of buy trades the account has made on the market.
cancelled_buy_contracts decimal Sum of all not matched contracts in buy cancelled orders.
cancelled_buy_orders integer Number of buy orders that were cancelled.
cancelled_contracts decimal Sum of all not matched contracts in all cancelled orders.
cancelled_orders integer Number of orders that were cancelled.
cancelled_sell_contracts decimal Sum of all not matched contracts in sell cancelled orders.
cancelled_sell_orders integer Number of sell orders that were cancelled.
closed_buy_premium decimal Total premium from closed buy trade contracts. In dollars.
closed_fees decimal The total value of fees from closed settlements. In dollars.
closed_gross_pnl decimal The profit or loss the account has made in closed settlements. In dollars.
closed_net_pnl decimal The net profit or loss after subtracting closed_fees. In dollars.
closed_premium decimal Total premium from closed contracts. In dollars.
closed_sell_premium decimal Total premium from closed sell trade contracts. In dollars.
competition string The competition of this market
contracts_closed decimal The total number of all contracts that were closed.
contracts_expired decimal The total number of all contracts that were expired.
contracts_in_buy_orders decimal Sum of all not matched contracts in buy orders.
contracts_in_orders decimal Sum of all unmatched contracts in all orders: each order’s quantity minus its filled.
contracts_in_sell_orders decimal Sum of all not matched contracts in sell orders.
contracts_settled decimal The number of contracts that have been settled.
contracts_traded decimal The total number of contracts traded (the sum of each fill’s filled). Only opening trades’ contracts are counted, not contracts closing other trades.
event_id uuid The event the market belongs to.
event_start_time int64 The start time of the event. UNIX microseconds.
expired_buy_premium decimal Total premium from expired buy trade contracts. In dollars.
expired_fees decimal The total value of fees from expired settlements. In dollars.
expired_gross_pnl decimal The profit or loss the account has made in expired settlements. In dollars.
expired_net_pnl decimal The net profit or loss after subtracting expired_fees. In dollars.
expired_premium decimal Total premium from expired contracts. In dollars.
expired_sell_premium decimal Total premium from expired sell trade contracts. In dollars.
fee_plugin string Internal. Virtual field naming the fee module in use, not part of the supported contract.
inserted_at int64 Creation time, as UNIX microseconds.
last_settled_at int64 When the last settlement was created. UNIX microseconds.
market_id uuid The market this record relates to.
market_max_price decimal The market’s maximum price: the settlement value of one winning contract. In dollars.
max_liability_loss decimal Worst-case loss if this market settles against the position you hold. In dollars.
max_liability_win decimal Worst-case loss if this market settles in favor of the position you hold. In dollars.
max_potential_fee decimal The maximum potential fees including all actual fees paid. In dollars.
max_potential_profit decimal The maximum potential profit, including all actual profit. In dollars.
max_risk decimal The total amount of risk on unsettled contracts. In dollars.
needs_rebuild boolean Internal. Consistency flag used by position rebuilds, not part of the supported contract.
open_order_count integer The number of open orders the account has on the market.
open_potential_fee decimal The amount of potential fee that is related to unsettled contracts. In dollars.
open_potential_profit decimal The potential profit from the outstanding contracts. In dollars.
open_premium decimal Total premium on the user’s current position in the market. In dollars.
open_risk decimal The amount of risk associated with outstanding contracts. In dollars.
open_trade_count integer The number of open trades the account has on the market.
order_liability decimal The order liability on this position from all orders. In dollars.
orders integer Count of all orders.
original_risk decimal The original risk incurred by all trades. In dollars.
pending_close_fee decimal Fees that would be charged if the resting close orders all filled. In dollars.
pending_close_pnl decimal Profit or loss that would be realized if the resting close orders all filled. In dollars.
position decimal The numerical position of the account in the market. In contracts.
position_accountability_alert_id uuid Internal. Links to a position-accountability alert, not part of the supported contract.
position_premium_liability decimal The liability of the position that affects available balance. In dollars.
potential_order_trade_fee decimal Fees that would be charged if every open order on this market filled. In dollars.
rejected_buy_orders integer Number of buy orders that were rejected.
rejected_orders integer Number of orders that were rejected.
rejected_sell_orders integer Number of sell orders that were rejected.
sell_contracts_closed decimal The total number of sell contracts that were closed.
sell_contracts_expired decimal The total number of sell contracts that were expired.
sell_contracts_settled decimal The total number of sell contracts settled in the position.
sell_contracts_traded decimal The total number of sell contracts the account has traded in the market. Only opening trade’s contracts are included.
sell_order_liability decimal The order liability on this position from sell orders. In dollars.
sell_orders integer Count of all sell orders.
sell_original_risk decimal The original risk incurred by sell trades. In dollars.
sell_settlements integer Count of all settlements from sell trades.
sell_trade_count integer The total number of sell trades the account has made on the market.
settled_at int64 When the expired settlements were recorded. null if the market has not resulted or voided yet. UNIX microseconds.
settlements integer Count of all settlements from all trades.
sport string The sport of this market
status string The status of the market this record covers, merged in from the live market index. null when the market is no longer held there.
title string The title of the market this record covers, merged in from the live market index. null when the market is no longer held there.
total_fees decimal The total fees that have been collected on the settlements. In dollars.
total_liability decimal The liability affecting available balance from open orders and position. In dollars.
total_net_pnl decimal The net profit or loss after subtracting total_fees. In dollars.
total_settlement_pnl decimal The total profit or loss on all settlements. In dollars.
trade_count integer The total number of trades the account has made on the market.
updated_at int64 Time of the last change, as UNIX microseconds.
v1.5.9Changelogllms.txtllms-full.txt