How-to use the predictions API

We have discussed how our prediction API works in-depth in our tutorial. In this how-to guide, we’ll show you how to implement the predictions of the Champions League group stage. Our prediction API is based on the latest machine learning techniques, which will give you the best predictions possible.

We’ll only be discussing probabilities per match. For the value bet and player contribution models, you can refer to our prediction tutorial.

Step 1: Make our request

First some general information about the Champions League:

  • League id: 2

  • Current season id: 17299

  • Current stage (Group stage) id: 77448760

  • Current round id: 211704

At the time of writing, the Champions League is in its third round of the group stages. The dates are from 2020-11-03 to 2020-11-04

We use the following URL:

 https://soccer.sportmonks.com/api/v2.0/fixtures/between/2020-11-03/2020-11-04?api_token={API_TOKEN}&include=localTeam,visitorTeam&leagues=2

This URL requests all the Champion League matches of the third round of the group stages. Now that you have an overview of all the Champion League fixture ids, we can start implementing our Prediction API.

Remember the two endpoints?

See our tutorial again for a refresher, in case you forgot. You have multiple options. Including the options to either use the probabilities by fixture id endpoint or to use the fixtures between dates endpoint with probability as include. We’ll analyze the following match between Real Madrid and Inter with fixture id #17361029.

https://soccer.sportmonks.com/api/v2.0/predictions/probabilities/fixture/17361029/?api_token={API_TOKEN}

Step 2: The API response

"fixture_id": 17361029,
        "predictions": {
            "btts": 63.087,
            "over_2_5": 61.667,
            "under_2_5": 38.33,
            "over_3_5": 39.384,
            "under_3_5": 60.614,
            "HT_over_0_5": 82.125,
            "HT_under_0_5": 17.872,
            "HT_over_1_5": 51.346,
            "HT_under_1_5": 48.651,
            "AT_over_0_5": 76.818,
            "AT_under_0_5": 23.18,
            "AT_over_1_5": 42.932,
            "AT_under_1_5": 57.066,
            "home": 43.903,
            "away": 32.803,
            "draw": 23.29,
            "correct_score": {
                "0-0": 4.143,
                "0-1": 6.057,
                "0-2": 4.427,
                "0-3": 2.157,
                "0-4": 0.788,
                "0-5": 0.231,
                "0-6": 0.056,
                "0-7": 0.012,
                "0-8": 0.002,
                "1-0": 7.134,
                "1-1": 10.42,
                "1-2": 7.623,
                "1-3": 3.715,
                "1-4": 1.358,
                "1-5": 0.397,
                "1-6": 0.097,
                "1-7": 0.02,
                "1-8": 0.004,
                "1-9": 0.001,
                "2-0": 6.141,
                "2-1": 8.978,
                "2-2": 6.563,
                "2-3": 3.198,
                "2-4": 1.169,
                "2-5": 0.342,
                "2-6": 0.083,
                "2-7": 0.017,
                "2-8": 0.003,
                "2-9": 0.001,
                "3-0": 3.525,
                "3-1": 5.153,
                "3-2": 3.767,
                "3-3": 1.836,
                "3-4": 0.671,
                "3-5": 0.196,
                "3-6": 0.048,
                "3-7": 0.01,
                "3-8": 0.002,
                "4-0": 1.517,
                "4-1": 2.218,
                "4-2": 1.621,
                "4-3": 0.79,
                "4-4": 0.289,
                "4-5": 0.084,
                "4-6": 0.021,
                "4-7": 0.004,
                "4-8": 0.001,
                "5-0": 0.523,
                "5-1": 0.764,
                "5-2": 0.558,
                "5-3": 0.272,
                "5-4": 0.099,
                "5-5": 0.029,
                "5-6": 0.007,
                "5-7": 0.001,
                "6-0": 0.15,
                "6-1": 0.219,
                "6-2": 0.16,
                "6-3": 0.078,
                "6-4": 0.029,
                "6-5": 0.008,
                "6-6": 0.002,
                "7-0": 0.037,
                "7-1": 0.054,
                "7-2": 0.039,
                "7-3": 0.019,
                "7-4": 0.007,
                "7-5": 0.002,
                "7-6": 0.001,
                "8-0": 0.008,
                "8-1": 0.012,
                "8-2": 0.008,
                "8-3": 0.004,
                "8-4": 0.002,
                "9-0": 0.002,
                "9-1": 0.002,
                "9-2": 0.002,
                "9-3": 0.001
            }
        }

Summary of the data:

BTTS (Both teams to score) = 63.01% Over 2,5 goals scored = 61.67% Under 3,5 goals scored = 60.14% Home team (Real Madrid) over 0,5 goals scored = 82,13% Away team (Inter) over 0,5 goals scored = 76.82% Real Madrid win probability = 43.90% Inter win probability = 32.80% Draw probability = 23.29% A final score of 1-1 has the highest probability = 10.42% If you used the probabilities by fixture id endpoint, you will have to repeat this step for all the other Champion League matches.

But, if you used the probability include on one of our fixtures or livescores endpoints, you won’t have to.

Predictions are updated multiple times a day. Take this into account when you start implementing.

Step 3: Example Page

Need some inspiration? The website below shows how you can display the various market predictions for one specific match.

Conclusion

Our prediction API uses cutting-edge technology developed by Sportmonks’ very own data scientists and development team. If you’re interested in the technology behind our predictions, you can have a look at our prediction API blog.

Last updated