Skip to main content

5.1 Common Objects

Small structures that recur across the endpoints.

5.1.1 Selection ID

A string that uniquely identifies a selection.

There will never be two identical selection ID strings. Uniqueness is global, not per-event.

The format is:

<event_id>|<market_id>|<selection_id>|<bet_side>

where <bet_side> is either for or against. If you are not an exchange, always use for.

5.1.1.1 Worked example

Suppose there is a Real Madrid vs FC Barcelona event with a "Correct Score" market offering the scores 0-1, 1-0 and 2-1. The event ID is 1009283, the market ID is 2098120, and the three score selection IDs are 9182890, 6182321 and 1807610.

That gives three selection ID strings:

1009283|2098120|9182890|for
1009283|2098120|6182321|for
1009283|2098120|1807610|for

5.1.1.2 Why the segments matter

Two mechanisms depend on the internal structure of the selection ID:

  • The delete messages on the WebSocket address events and markets by the first and second segments.
  • The selection ID is the field where your own internal identifiers belong. It is echoed back to you unchanged when we place a bet, so whatever you need to route that bet internally can be encoded here.

Elsewhere in the payload, id fields must carry MollyBet IDs or null — never your own.

5.1.2 Quotes

A quote is a price together with the liquidity available at it.

price [ number ]:

Decimal odds, to three places after the decimal point.

min_stake [ array ]:

The smallest stake accepted at this price.

max_stake [ array ]:

The largest stake accepted at this price.

{
"price": 1.891,
"min_stake": ["EUR", 1.01],
"max_stake": ["EUR", 500.02]
}

Wherever a list of quotes appears — in an offer, or in the /price_and_stake response — the quotes must be in descending order with respect to price.

5.1.3 Currency amounts

Every monetary value is a two-element array: the currency code first, the amount second.

["EUR", 1.23]

This applies to stakes, balances, minimum and maximum liquidity, and profit or loss. The currency should match the ccy_code reported by /account, and must be one of the supported currencies.

5.1.4 Leagues, sides and runners

Four objects share the same two-field shape — a display name and an optional id.

ObjectUsed for
leagueThe competition the event belongs to.
homeThe home side. In tennis, player 1.
awayThe away side. In tennis, player 2.
runnerA single competitor in a multirunner event.

name [ string ]:

The name of the league, side or runner. This may be your own internal name, provided it is consistent and descriptive enough for us to match it to our data.

id [ integer ]:

The MollyBet ID associated with that name, obtainable from the MollyBet API data feeds. If no MollyBet ID is available, send null.

{"name": "Spain | La Liga", "id": 16}

Runner objects are used only for multirunner competitions that have an outright winner market.