Skip to content

Active settlements

The Active Settlements Channel delivers information to the subscriber on a settlement recorded against on an account for an active market in the system.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://bet_stack.com/active_trade_schema",
"title": "ActiveSettlement",
"type": "object",
"description": "Information on a settlement in the active settements channel",
"properties": {
"id": {
"description": "The unique ID of the settlement",
"type": "string",
"format": "uuid"
},
"account_id": {
"description": "The unique id of the account the trade that was settled was on.",
"type": "string",
"format": "uuid"
},
"market_id": {
"description": "The unique id of the market the trade that was settled was on.",
"type": "string",
"format": "uuid"
},
"opening_trade_id": {
"description": "The unique id of the trade used to open the settlement.",
"type": "string",
"format": "uuid"
},
"closing_trade_id": {
"description": "The unique id of the trade used to close the settlement if not expired.",
"type": [
"string",
"null"
],
"format": "uuid"
},
"type": {
"description": "The type of settlement.",
"type": "string",
"enum": [
"closed_short",
"closed_long",
"expired_short",
"expired_long"
]
},
"opening_price": {
"description": "The price that the settled trade opened on.",
"type": "number",
"format": "integer",
"minimum": 1,
"maximum": 100
},
"closing_price": {
"description": "The price used to close the settlement",
"type": "number",
"format": "integer",
"minimum": 0,
"maximum": 100
},
"quantity": {
"description": "The amount of contracts settled.",
"type": "number",
"format": "integer",
"minimum": 1
},
"fee": {
"description": "The fee paid to settle the trades.",
"type": "number",
"format": "integer",
"minimum": 0
},
"gross_pnl": {
"description": "Profit and loss before fees.",
"type": "number",
"format": "integer",
"minimum": 0,
"maximum": 0
},
"realized_pnl": {
"description": "Profit and loss after fees.",
"type": "number",
"format": "integer",
"minimum": 0,
"maximum": 0
},
"inserted_at": {
"description": "Time when the settlement was recorded.",
"type": "number",
"format": "integer"
}
}
}

["3","3","active_settlements:{{UID}}","phx_join", ""]

[
null,
null,
"active_settlements:fbNZHhLfj8Ts2jxDczSQrOEBSdg1",
"new_settlements", {
"settlements": [ActiveSettlement]
}
]

Example:

[
null,
null,
"active_settlements:cW7UI52lToTDbIEYaXAFtqYYaZB2",
"new_settlements",
{
"settlements": [
{
"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: 10,
"closing_price: 20,
"quantity: 100,
"fee": 50,
"gross_pnl: 1000,
"realized_pnl: 950,
"inserted_at: "2020-11-01T19:02:28.125460Z",
"market_id: "687e9cdb-a391-4118-aa80-1122bb14779f",
"account_id: "c1c3614c-32ae-4bea-bae4-fc3f52047790"
}
]
}
]