Skip to main content
The feed channels carry OddsPapi v5 market data. Their payloads are OddsPapi’s, unchanged except for the bookmakers, which are limited to your account.

Channels

The OddsPapi WebSocket channels documentation describes them together.

Load, then apply changes

The feed channels carry changes only. They never send the current state of a fixture. Build it in three steps:
1

Connect and log in

Open the socket and log in with the channels and fixtures you want. Keep the messages that arrive from now on.
2

Load the state

Read the fixtures and their odds from /v1/{lang}, for example GET /v1/en/fixtures/odds.
3

Apply the changes

Apply the messages you kept, then every new one, on top of what you loaded.
Connecting before loading means no change is lost between the two. A change that was already in the loaded state is harmless to apply again.

Reload on snapshot_required

When Apexium cannot guarantee that you received every change, it tells you which channels to reload:
Load the state of these channels again from /v1/{lang}, then keep applying the messages. This happens when:
  • The feed source was interrupted and Apexium has just subscribed to it again.
  • Apexium fell behind the feed by more than one second: it discards what it could not send in time rather than send old prices, and asks the clients concerned to reload.
Every message sent before snapshot_required is older than the state you reload. A connection receives snapshot_required at most once every 10 seconds, which leaves you time to reload. Channels that need a reload within those 10 seconds come in one snapshot_required when they end.

What you receive

  • odds and bookmakers come for the fixtures in your fixtureIds only. Following a sport or a tournament does not bring its odds.
  • fixtures, scores and clocks come for your fixtureIds, and for every fixture of your tournamentIds and sportIds.
  • currencies comes to every connection on the channel.
  • Bookmakers. Odds carry only the bookmakers of your account, except any closed to the API. A message left with none of them is not sent.
  • Language. fixtures follows the lang of your login. See Languages.
Odds are most of the feed, so you follow them fixture by fixture, within the fixture limit of your account. To trade a whole tournament:
  1. Log in with its tournamentIds on fixtures, or read its fixtures from /v1/{lang}.
  2. Send { "type": "subscribe", "fixtureIds": [...] } with the fixtures you trade, and their odds start.
  3. Send unsubscribe for a fixture once it is over, to free its place.

Read too slowly, get closed

Apexium sends each client what it can absorb. A connection whose send buffer stays full is closed with 4002, and the other clients are not slowed down. See Close codes. To keep up:
  • Use zstd. It makes the feed about four times smaller. See Encodings.
  • Read in its own task. Decode and store each message quickly; do the slow work, such as pricing or database writes, elsewhere.
  • Follow what you use. Every fixture in fixtureIds adds its odds to your stream.