Skip to main content
The BetDEX Stream API provides methods for clients to subscribe to exchange events. Clients connect to the Stream API, authenticate their connection, and then subscribe to the updates they wish to receive.

Connection details

WebSocket host:

Message types

There are two types of messages that can be sent to the Stream API:

Authentication

To authenticate, clients must send an AuthenticationRequest after connecting. The accessToken is available from the REST API when creating a session.

AuthenticationRequest

Subscription

To subscribe to updates, clients must send a SubscriptionRequest describing the type of update and the IDs they are interested in.
  • The subscriptionType field defines the type for which subscription is made. Allowed values are:
    • EventUpdate
    • MarketUpdate
    • MarketPriceUpdate- all price changes in a market, both direct and derived prices (cross matching liquidity)
    • MarketDirectPriceUpdate - direct only price changes in a market (excluding derived prices/cross matching liquidity triggered updates)
    • MarketStatusUpdate
    • OrderUpdate
    • WalletUpdate
  • The subscriptionIds field determines the entities to subscribe to. Allowed values are:
    • For EventUpdate, it can be set to
    • * - all events
    • event-id - specific events
    • ForMarketUpdate, MarketPriceUpdate, MarketDirectPriceUpdateand MarketStatusUpdate it can be set to:
    • * - all markets
    • market-id - specific markets
Please note for Market subscriptions:If you are subscribing to get a large set of markets, then you should subscribe using the wildcard * as otherwise you will hit subscription limits (max 500).COMING SOON: We will also be soon introducing ability to subscribe at a sport and league level too (ie. to subscribe to all Football or all NFL price updates in one subscription, rather than having to do the wildcard for all markets and then filtering down to what you need on your side)
  • For OrderUpdate it can be set to:
    • *
    • order-id — subscribe to updates for an order identified by its id.
    • app-id:* — subscribe to all orders owned by app-id (only the connection’s app-id is allowed).
    • app-id:wallet-id — subscribe to all orders owned by app-id and wallet-id (only the connection’s app-id is allowed, and the wallet must be owned by that app-id).
  • For WalletUpdate it can be set to
    • * - all wallets owned by your app
    • wallet-id - specific wallet owned by your app
Setting subscriptionId to * means the client will be subscribed to all updates of the given type.

SubscriptionRequest

Subscription Limits

To keep the system performance strong for every client, we’re introducing the following limits:
  • 10 active connections at any one time
  • 500 active individual subscriptions at any one time - these can be spread across the number of active connections as needed.​
  • 500 subscriptions per minute.
Recommendation: for Stream API connections & subscriptions, if you are currently subscribing to markets by single market ids, then look at utilising the wildcard "*" instead.For example, if you are subscribing just for a few markets, then
makes sense.However if you are subscribing to 501+ markets, you’ll need to use

UnsubscriptionRequest

Update messages

After authentication and subscription, clients will receive update messages when markets, orders, or wallets are updated on the platform. The supported update message formats are listed below.

EventUpdateMessage

Example:

MarketUpdateMessage

MarketStatusUpdateMessage

Example:

MarketPriceUpdateMessage & MarketDirectPriceUpdateMessage

Snapshot Example:
Incremental Example:

OrderUpdateMessage

Order Created Example:
Order Cancelled Example:

WalletUpdateMessage

Next steps

For session creation and access tokens, refer to the REST API (BetDEX) documentation.