Skip to content

Active trades

The Active Trades Channel delivers information to the subscriber on a trade executed against an order that is filled against an active market in the system.

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://bet_stack.com/active_trade_schema",
"title": "ActiveOrder",
"type": "object",
"description": "Information on a trade in the active trades channel",
"properties": {
"id": {
"description": "The unique ID of the trade",
"type": "string",
"format": "uuid"
},
"market_id": {
"description": "The unique id of the market the order was placed on.",
"type": "string",
"format": "uuid"
},
"order_id": {
"description": "The unique id of the order the trade is assosiated with.",
"type": "string",
"format": "uuid"
},
"action": {
"description": "Whether to buy contracts or sell them.",
"type": "string",
"enum": [
"buy",
"sell"
]
},
"price": {
"description": "The price used to buy or sell the contracts.",
"type": [
"number",
"null"
],
"format": "integer",
"exclusiveMinimum": 0
},
"filled": {
"description": "The amount of contracts to bought or sold.",
"type": "number",
"format": "integer",
"exclusiveMinimum": 0
},
"remaining": {
"description": "The amount of contracts not settled.",
"type": "number",
"format": "integer",
"exclusiveMinimum": 0
},
"premium": {
"description": "The premium paid to execute the trade.",
"type": "number",
"format": "integer"
},
"remaining_premium": {
"description": "The remaining premium after settlements.",
"type": "number",
"format": "integer"
},
"max_potential_fee": {
"description": "The max potential fee on a trade based on settlements and remaining part.",
"type": "number",
"format": "integer"
},
"time": {
"description": "Time when the order was placed.",
"type": "string",
"format": "datetime"
},
"liquidity_action": {
"description": "Indicates the linked order was a liquidity provider or taker.",
"type": "string",
"enum": [
"provider",
"taker"
]
},
"inserted_at": {
"description": "Time when the order was placed.",
"type": "number",
"format": "integer"
}
}
}

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

[null, null, "active_orders:fbNZHhLfj8Ts2jxDczSQrOEBSdg1", "all_trades", { "trades": [ActiveTrade]}]

Example 1:

[
null,
null,
"active_trades:fbNZHhLfj8Ts2jxDczSQrOEBSdg1",
"all_trades",
{
"trades": []
}
]

Example 2:

[
null,
null,
"active_trades:cW7UI52lToTDbIEYaXAFtqYYaZB2",
"all_trades",
{
"trades": [
{
"action": "sell",
"filled": 20,
"id": "787582ec-3863-4760-bbcb-398d3dca8fe5",
"market_id": "687e9cdb-a391-4118-aa80-1122bb14779f",
"premium": 480,
"price": 24,
"liquidity_action": "provider",
"time": "2020-11-01T19:20:34.890853Z"
},
{
"action": "buy",
"filled": 20,
"id": "c1c3614c-32ae-4bea-bae4-fc3f52047790",
"market_id": "687e9cdb-a391-4118-aa80-1122bb14779f",
"premium": -420,
"price": 21,
"liquidity_action": "taker",
"time": "2020-11-01T01:55:26.857931Z"
}
]
}
]