Skip to main content

6.2 Event Messages

Available message types:

These are messages about the events MollyBet currently knows about. By default, MollyBet API sends a list of all available events upon asynchronous channel connection, and maintains that list as long as the connection is active.

Additional information about an event is sent as soon as register_event is called, up until the point where unregister_event is called. This information includes the prices available from your bookies, and for in-running events also scores, red cards and event times.

6.2.1 event: event added or updated

Asserts that an event with primary key (sport, event_id) exists, and has the details provided.

A client will typically store this information in a hash table with each key being a (sport, event_id) pair. If an event is received and its key already exists in the table, then it must replace the pre-existing entry. If a remove_event message is received, then the key must be removed from the table.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

home [ string ]

The name of the home team.

away [ string ]

The name of the away team.

competition_id [ string ]

The ID of the competition of which this event is part.

competition_name [ string ]

The name of the competition of which this event is part.

competition_country [ string ]

The country associated with the competition of which this event is part, as a two-letter ISO 3166 country code.

ir_status [ string ]

The in-running status of the event. This will be either pre_event or in_running.

start_time [ string ]

The time at which we believe the event will start, or null if it is unknown.

Example:

{
"sport": "fb",
"event_id": "2016-06-17,417,6228",
"home": "Example Home Team 1",
"away": "Example Home Team 2",
"competition_id": "1851",
"competition_name": "Test Division 3",
"competition_country": "CY",
"ir_status": "pre_event",
"start_time": "2016-06-17T16:30:00+00:00"
}

6.2.2 remove_event: event no longer exists

An event with primary key (sport, event_id) which has previously existed in our system has ceased to exist.

This may be because the event has finished, because we no longer have offers for that event, or because the event has been merged with another.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque ID of the event.

home [ string ]

The name of the home team.

away [ string ]

The name of the away team.

Example:

{
"sport": "fb",
"event_id": "2016-06-17,417,6228",
"home": "Example Home Team 1",
"away": "Example Home Team 2",
}

6.2.3 event_time: current time of an in-running event

Notification of our best guess of the current event time for in-running events in which you have registered an interest.

Note that for events with multiple sub-sports (e.g., fb, fb_ht, fb_corn etc) we will only send time information for the main event (in this instance, fb).

Because our guess at the event time is aggregated from a number of sources, it may behave in unexpected ways, such as going backwards when we receive more information that adjusts our idea of the event time.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

time [ list[string, int] ]

For football, this is either of:

  • a 2-element list of the form [half, mins], where mins is the number of elapsed minutes and half is 1h, or 2h, representing the first half or the second half respectively. During half time, the time will be ht.

  • null if the time is unknown.

Example:

{
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"time": ["1h", 35]
}

6.2.4 event_score: current score of an in-running event

Notification of our best guess of the current event score for in-running events in which you have registered an interest. As with event_time, the current score may sometimes behave in unexpected ways.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

score [ list[int, int] ]

For football, this is either of:

  • a 2-element list of the form [home, away], where home and away represent the number of goals scored by the home and away teams (or number of corners awarded, depending on the sport).

  • null if the score is unknown.

Example:

{
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"score": [1, 1]
}

6.2.5 event_red_cards: current red cards of an in-running event

Notification of our best guess of the current number of red cards received by each team in a football match. As with event_time and event_score, this may behave in unexpected ways.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

score [ list[int, int] ]

For football, this is either of:

  • a 2-element list of the form [home, away], where home and away represent the number of red cards received by the home and away teams.

  • null if the red cards are unknown.

Example:

{
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"score": [1, 1]
}

6.2.6 offer: offer added or updated

Asserts that an offer with primary key (bookie, market, selection) exists, and has the details provided.

Your local offers state will typically be stored in a hash table with each key being a (bookie, market, selection) triplet. If a offer is received and its triplet already exists in the table, then it must replace the pre-existing entry. If a remove_offer message is received, then the key must be removed from the table.

Note that the bet type associated with a specific triplet may change over time, for example when a bookie updates the score of an in-running game, or changes the handicap line.

Fields:

bookie [ string ]

The bookie making the offer.

market [ string ]

Identifier used to disambiguate bets. Occasionally, bookies will offer the same bet multiple times. In those cases, they will have different market/selection IDs. This information is needed when the offer is removed, so that the client can tell which of the two (or more) offers has been removed.

selection [ string ]

Same as market.

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

bet_type [ string ]

The bet type of the offer.

in_running [ boolean ]

true if this is an in-running offer.

price_list [ list[object, ...] ]

List of prices available from the bookie. Some bookies (for example, exchanges) will often have multiple prices available. Each price is an object with a single key called `bookie` (unlike PMMs, offers will not have an effective price). `bookie` is an object with three keys:

Exchanges may also exceptionally have empty price lists, which indicate that only an exchange order is available.

Example:

{
"bookie": "bet123",
"market": "market-id",
"selection": "selection-id",
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"bet_type": "for,h",
"in_running": false,
"price_list": [
{
"bookie": {
"price": 1.8,
"min": ["GBP", 40],
"max": ["GBP", 40000]
}
}
]
}

6.2.7 remove_offer: offer no longer exists

An offer with primary key (bookie, market, selection) which has previously existed in our system has ceased to exist.

Fields:

bookie [ string ]

Part of the primary key of the removed offer.

market [ string ]

Part of the primary key of the removed offer.

selection [ string ]

Part of the primary key of the removed offer.

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

bet_type [ string ]

The bet type for the offer.

Example:

{
"bookie": "bet123",
"market": "market-id",
"selection": "selection-id",
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"bet_type": "for,h",
}

6.2.8 event_exchange_dark_liquidity: dark liquidity availible on each line of the event

Shows a rough estimate of the available dark liquidity for each line on the event.

Fields:

sport [ string ]

The sport of the event.

event_id [ string ]

The opaque id of the event.

lines [ dict[string, tuple[string, double]] ]

Mapping of line to tuple containing a ccy string and a liquidity amount.

Example:

{
"sport": "fb",
"event_id": "2016-06-18,2879,8302",
"lines": {
"ah,3":["GBP",800.0],
"ahou,10":["GBP",500.0],
"h":["GBP",500.0]
}
}

6.2.9 clear_events: remove all events and offers

Clear all existing events and offers in the system. When this message is received, all events and offers will cease to exist, until they are added again by new event and offer messages.

Fields:

None

Example:

{}