WebSocket Events

Understand ProphetX WebSocket event types, change_type values, payload structures, and broadcast and private channel behavior using CFTC trading terminology in the guide prose.

Trading API — WebSocket Events

Use this page to understand ProphetX WebSocket event types, payload structures, and channel behavior. For common implementation patterns, see ProphetX Service API WebSocket Use Cases.

WebSocket Event Messages’ Data Structure

{
  "timestamp": int64,
  "change_type": string,
  "payload": base64 encoded string,
  "op": string
}

The payload value varies by change_type, as detailed below.

The available op values are:

  • c stands for create
  • u stands for update
  • d stands for delete

There are two channel types: the Broadcast channel and the Private channel.

Broadcast Channel

Messages sent through this channel are also delivered to all other API users actively listening on the same channel.

As of June 10th, 2024, there are 6 types of events pushed through this broadcast channel:

  • tournament
    Sent when a new tournament becomes available, an existing tournament is disabled, or tournament data is updated.
    Payload structure:

    {
      "id": string, // unique tournament identifier
      "info": {
        "banner": string,
        "category": {
          "countryCode": string,
          "id": integer,
          "name": string
        },
        "id": integer, // tournament id
        "image": string,
        "name": string,
        "sport": {
          "id": integer,
          "name": string
        },
        "sequence_number": int
      }
    }
  • market
    Sent when a new market becomes available for an event, a market is removed from an event, or market data is updated.
    Payload structure:

    {
      "id": string, // unique event identifier
      "info": {
        "id": int, // market id
        "sport_event_id": int, // event id, same as outer id
        "name": string,
        "status": string,
        "description": string,
        "sequence_number": int
      }
    }
  • sport_event
    Sent when a new event becomes available in a tournament, an existing event is removed, or event data is updated.
    Payload structure:

    {
      "id": string, // unique event identifier
      "tournament_id": string,
      "info": {
        "competitors": [
          {
            "abbreviation": string,
            "country": string,
            "display_name": string,
            "id": integer, // competitor id
            "name": string,
            "side": string
          }
        ],
        "display_name": string,
        "event_id": integer,
        "name": string,
        "scheduled": string,
        "sport_name": string,
        "status": string,
        "tournament_name": string,
        "type": string,
        "sequence_number": int
      }
    }
  • market_strike
    Sent when a market has a new strike, an existing strike is removed, or strike data is updated.
    Payload structure:

    {
      "id": int, // market_strike id
      "info": {
        "id": int,
        "sport_event_id": int,
        "market_id": int,
        "outcome_id": int,
        "strike": float,
        "strike_id": string,
        "type": string,
        "name": string,
        "status": string,
        "favourite": bool,
        "sequence_number": int
      }
    }
  • market_selections
    Sent for all selections on a strike when selection liquidity changes, such as new resting orders, filled orders, voided orders, or canceled orders. Liquidity is calculated from resting cost on a strike.
    Payload structure:

    {
      "sport_event_id": int,
      "market_id": int,
      "info": {
        "id": int,
        "name": string, // market name
        "selections": [
          // Contains two arrays of best selections
          // The current system limits each array to the 10 best selections for this event
          // If no best selection exists, the system returns one placeholder selection
          [
            {
              "outcome_id": int,
              "name": string,
              "competitor_id": int,
              "strike": float,
              "strike_id": string,
              "price": float,
              "display_price": string,
              "display_strike": string,
              "display_name": string,
              "value": float,
              "quantity": float,
              "updated_at": int
            }
          ],
          [
            {
              "outcome_id": int,
              "name": string,
              "competitor_id": int,
              "strike": float,
              "strike_id": string,
              "price": float,
              "display_price": string,
              "display_strike": string,
              "display_name": string,
              "value": float,
              "quantity": float,
              "updated_at": int
            }
          ]
        ],
        "type": string,
        "line": float,
        "sequence_number": int
      }
    }
  • matched_order
    Sent when a successful fill occurs. This event broadcasts the filled price details to all listeners.
    Payload example:

    {
      "info": {
        "strike": 0,
        "strike_id": "cffa7ddc4fd50acbe51684e7addabe00",
        "market_id": 219,
        "fill_price": 124,
        "filled_quantity": 45.3,
        "price": 124,
        "origin_market_strike": 0,
        "outcome_id": 4,
        "sequence_number": 1709130007835319000,
        "sport_event_id": 44285780
      }
    }

Private Channel

Messages sent through this channel are available only to you.

As of June 10th, 2024, there are 2 event types sent through this private channel:

  • order
    Sent when your order status changes. You receive updates when an order is activated, canceled, or filled, including updated order metadata.
    Payload structure:

    {
      "info": {
        "id": string,
        "user_id": string,
        "market_id": int,
        "sport_event_id": int,
        "outcome_id": int,
        "price": float,
        "strike": float,
        "quantity": float,
        "profit": float,
        "matched_quantity": float,
        "fill_price": float,
        "total_filled_quantity": float,
        "open_quantity": float,
        "matching_status": string,
        "winning_status": string,
        "status": string,
        "external_id": string,
        "strike_id": string,
        "update_type": string,
        "sequence_number": int
      }
    }
  • health_check
    Sent to all WebSocket sessions every 5 seconds to help you monitor connection health.
    Payload example:

    {
      "event": "health_check",
      "data": {
        "change_type": "private_system_signal",
        "op": "u",
        "payload": "e30=",
        "timestamp": 1717689526365275600
      }
    }