Subscription Management

Initiating subscriptions

Sending a subscribe message allows you to start receiving events for a list of prediction types covering multiple exchanges and symbols. If you need to change your subscription, then simply send a new subscribe message with new prediction details.

Subscription message

The following is a sample message to start receiving price movement predictions for CME futures market covering E-mini S&P 500 contract expiring in September 2023.

{
  "message_type": "subscribe",
  "predictions": [
    {
      "type": "price_movement",
      "exchange_id": "cme",
      "symbol": "ESU3",
      "params": {
        "threshold": "0.00002",
        "horizon": "10"
      }
    }
  ],
  "heartbeat": True,
  "timestamp": 1689110444102,
  "api_key": "e2051b58-2030-11ee-be56-0242ac120002"
  "signature": "signature is generated dynamically"
}

Managing Subscriptions

While sending a subscribe message works in most situations, there may be times where you may want to have the flexibility to add or remove subscriptions while maintaining a live connection. In those situations, send the same subscription message (all rules apply for authentication, symbols, exchange_ids etc.) and the message type will be add_subscription or remove_subscription. If you need to remove the subscription for all markets for a given channel, just send an empty list of marketIds.

Prior to using add_subscription or remove_subscription messages, you will need an existing subscription, so make sure to send a valid subscription message at least once before updating it.

Last updated