Skip to content

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.

Predictions integration scheme

The integration consists of the following steps:

  1. Consume the predictions feed - a separate feed with the same specification as the Odds Feed.
  2. Fetch localized fixture templates, market templates, and settlement rules from the Sport events content API.
  3. 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.
  4. Place the bet with the calculated odd and the feed_id field in selections.
  5. 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_id is a dedicated prediction sport, for example, prediction_crypto or prediction_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.type is 2 (Prediction).
  • fixture.logo is the URL of the event logo.
  • fixture.end_time_ns is the time when the event ends.
  • tournament is a placeholder with the name Other; prediction events are grouped by sport.
  • competitors is 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: 0 and empty specifiers. Market templates are not present in the feed - fetch them from the Sport events content API.
  • Outcome names come from the odds template values, for example, Yes and No.
  • cash_out_available is always false.
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
{
  "sport_event_id": "23784",
  "sport_id": "prediction_politics",
  "version": "0000000004b8ae57",
  "timestamp_ns": 1785329056296000000,
  "event_type": "sport_event_snapshot",
  "payload": {
    "fixture": {
      "type": 2,
      "status": 0,
      "streams": [],
      "sport_id": "prediction_politics",
      "template": "What will happen before GTA VI?",
      "logo": "https://static.databet.cloud/predictions/23784.png",
      "tournament": {
        "id": "prediction:prediction_politics:other",
        "name": "Other"
      },
      "venue": { "country_code": "" },
      "competitors": [],
      "live_coverage": false,
      "start_time_ns": 1746200890582000000,
      "end_time_ns": 1798761599000000000,
      "updated_at_ns": 1781888515173224000
    },
    "markets": [
      {
        "id": "540817",
        "status": 1,
        "type_id": 0,
        "specifiers": "",
        "odds": [
          {
            "id": "1",
            "value": "1.82",
            "probability": "0.505",
            "status": 0,
            "is_active": true,
            "template": "Yes",
            "cash_out_available": false
          },
          {
            "id": "2",
            "value": "1.85",
            "probability": "0.495",
            "status": 0,
            "is_active": true,
            "template": "No",
            "cash_out_available": false
          }
        ]
      },
      {
        "id": "540818",
        "status": 1,
        "type_id": 0,
        "specifiers": "",
        "odds": [
          {
            "id": "1",
            "value": "1.82",
            "probability": "0.505",
            "status": 0,
            "is_active": true,
            "template": "Yes",
            "cash_out_available": false
          },
          {
            "id": "2",
            "value": "1.85",
            "probability": "0.495",
            "status": 0,
            "is_active": true,
            "template": "No",
            "cash_out_available": false
          }
        ]
      }
    ],
    "bet_stop": false,
    "game_state": {},
    "competitors_score": [],
    "extensions": {
      "app.data.bet/widget": {
        "types": ["outcome_probabilities"]
      }
    }
  }
}

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
{
  "selections": [
    {
      "sport_event_id": "659757",
      "market_id": "701491",
      "odd_id": "1",
      "value": "25.75",
      "feed_id": 1
    }
  ]
}

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:

  1. Get the real odd for the stake. Send POST /bets/calculate with the player's stake in the stake field. The response contains the real odd for this stake amount in calculated_bet.selections[].value - show it to the player.
  2. Place the bet with the calculated odd. Send POST /bets with the same stake and pass the odd from calculated_bet.selections[].value as the selection value.

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
{
  "type": {
    "code": 0,
    "size": [1]
  },
  "player_id": "player-123",
  "client_ip": "192.0.2.1",
  "currency_code": "EUR",
  "stake": {
    "value": "20.00",
    "currency_code": "EUR"
  },
  "selections": [
    {
      "sport_event_id": "659757",
      "market_id": "701491",
      "odd_id": "1",
      "value": "25.75",
      "feed_id": 1
    }
  ]
}

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:

  1. The stake is converted to USD at the current rate.
  2. 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.
  3. 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
"extensions": {
  "app.data.bet/widget": {
    "types": ["outcome_probabilities", "asset_price_up_down"]
  }
}

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)