Predictions integration
Prediction markets let your users bet on the outcomes of real-world events: asset prices, politics, technology, culture, and other categories. Prediction events are delivered as sport events with markets and odds through the same trading infrastructure you already use, so most of the integration is already in place if you consume the Odds Feed and place bets through Bets.
The integration consists of the following steps:
- Consume the predictions feed - a separate feed with the same specification as the Odds Feed.
- Fetch localized fixture templates, market templates, and settlement rules from the Sport events content API.
- Calculate the bet with the player's stake through the Managed trading services API to get the real odd for this stake - see Stake-based pricing.
- Place the bet with the calculated odd and the
feed_idfield in selections. - Embed the Multi Widget for prediction events.
Prerequisites
The predictions integration builds on the trading integration:
- Authorization - the same x.509 certificate is used for all predictions endpoints.
- Odds Feed - the predictions feed follows this specification.
- Bets - bets on prediction events are placed through the same MTS API.
Predictions feed
The predictions feed is a separate feed that follows the Odds Feed specification - the same replication protocol, message format, and entities:
| Environment | Endpoint |
|---|---|
| Integration | https://predictions-feed.int.databet.cloud |
| Production | https://predictions-feed.databet.cloud |
Booking of prediction events will be added in the next iterations: for now, you receive the whole feed in both environments.
The feed carries everything you need to offer and accept bets: identity, English display strings, odds, statuses, and timings. Localized content - fixture templates, market templates, and settlement rules - is fetched on demand from the Sport events content API, which never carries betting state.
Differences from the trading feed
Prediction events differ from regular sport events in the following ways:
sport_idis a dedicated prediction sport, for example,prediction_cryptoorprediction_politics. Prediction sports are marked with the prediction sport type in the Reference data API. The set of prediction sports expands over time, so treat unknown prediction sports as not enabled until you support them.fixture.typeis2(Prediction).fixture.logois the URL of the event logo.fixture.end_time_nsis the time when the event ends.tournamentis a placeholder with the nameOther; prediction events are grouped by sport.competitorsis an empty list for now. Competitors will be added over time, and fixture and market templates will then reference them with{$competitorN}placeholders - see Competitor strategy.- Markets have
type_id: 0and emptyspecifiers. Market templates are not present in the feed - fetch them from the Sport events content API. - Outcome names come from the odds
templatevalues, for example,YesandNo. cash_out_availableis alwaysfalse.
An example of a prediction event snapshot
The output is formatted for readability; markets are truncated to two.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
Placing bets
Bets on prediction events are placed through the same Managed trading services API. To validate a bet, send POST /bets/calculate; to place it, send POST /bets - the same workflow as in Risk Management Mode.
Each selection carries the feed_id field identifying the feed the sport event belongs to: 0 - trading feed, 1 - predictions feed. Sport event ids are unique within a feed, so the pair of feed_id and sport_event_id identifies a sport event globally. Always send feed_id: 1 in selections referencing prediction events; if the field is omitted, the selection is resolved against the trading feed.
1 2 3 4 5 6 7 8 9 10 11 | |
Restrictions that reference a sport event also carry feed_id, so you can correlate them with the correct selection.
Risk management is mandatory
Bets containing prediction selections are always processed in Risk Management Mode: max_bet restrictions apply and cannot be disabled, and Integrity Mode and Advisory Mode are not available for prediction selections. Bets on the trading feed keep the MTS mode you integrated.
All bet types are supported: single, express, and system. An express or system bet may include at most one prediction selection - combining multiple prediction selections in one bet is not supported. A bet may combine trading and prediction selections; such a bet is processed in Risk Management Mode as a whole.
Stake-based pricing (slippage)
Odds published in the predictions feed are indicative: they are calculated for a small stake. The actual odd for a prediction selection depends on the stake amount, so placing a bet on a prediction selection is a two-step flow:
- Get the real odd for the stake. Send
POST /bets/calculatewith the player's stake in thestakefield. The response contains the real odd for this stake amount incalculated_bet.selections[].value- show it to the player. - Place the bet with the calculated odd. Send
POST /betswith the same stake and pass the odd fromcalculated_bet.selections[].valueas the selectionvalue.
Example of the POST /bets/calculate request:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
For prediction selections, the value passed in the POST /bets/calculate request may differ from the value returned in the response because the odd depends on the stake amount. For trading selections, the calculated odd is the same as the feed odd. Therefore, in an express or system bet that combines trading and prediction selections, you can use the calculated odds for all selections. The odd for the stake is calculated as follows:
- The stake is converted to USD at the current rate.
- The amount is matched against the available liquidity for the outcome, starting from the best price and moving to worse price levels until the full stake is covered.
- The odd is the volume-weighted average across all price levels used, with margin applied, rounded to 2 decimal places.
The larger the stake, the deeper it slips into the available liquidity, and the lower the odd may be compared to the published one. If the available liquidity is not enough to cover the full stake, the published odd is returned along with a max_bet restriction.
Recalculate when the stake changes
The calculated odd is valid only for the stake it was calculated for: if the player changes the stake, send POST /bets/calculate again and show the player the updated odd.
Widgets
For a complete integration, embed the Multi Widget for prediction events - it renders the widget corresponding to the event, for example, outcome probabilities or an asset price chart. The rule is the same as for regular sport events: render the widget when the app.data.bet/widget extensions list of the event is not empty, and do not initialize it otherwise. The possible widget types for prediction events are outcome_probabilities, asset_price_up_down, and asset_price_general. See Integrating DATA.BET Widgets.
1 2 3 4 5 | |
Managing prediction markets
Prediction markets are managed in the same Sport Trading Management panel as regular sport events. Booking of prediction events will be added in the next iterations; until then, the whole feed is always delivered.
Feature availability
| Feature | Availability |
|---|---|
| Single, express, and system bets | ✅ |
| Multiple prediction selections in one bet | ❌ |
| Mixed bets combining trading and prediction selections | ✅ (at most one prediction selection per bet) |
| Widgets (Multi Widget) | ✅ |
| Risk Management Mode | ✅ (mandatory) |
| Integrity Mode | ❌ |
| Advisory Mode | ❌ |
| Cash Out | ❌ |
| Bet Builder | ❌ |
| Booking | 🔜 Planned for the next iterations |
| Disabling max bet | ❌ |
| Stake-based pricing (slippage) | ✅ (requires stake in POST /bets/calculate) |