1 - Understanding Cashouts

Explaining the concept of cashouts in sports betting, including how to calculate cashout amounts and the conditions for full and partial cashouts.

Cloudbet allow bettors to settle bets early, securing a return before the event concludes with cashouts. This feature improves control over betting strategies, providing an opportunity to lock in profits or minimize losses based on real-time developments in the event.

Cashout Calculation

The cashout amount depends on the potential return of the original bet and the odds available for the opposite outcomes at the time of cashout. The formula used is:

$$\tag*{(1)} \text{CashoutAmount} = \text{CashedOutReturn} - \sum \left(\frac{\text{CashedOutReturn}}{\text{AgainstOdds}}\right)$$
  • The formula subtracts the sum of the potential returns from opposing odds from the exhausted potential return amount to determine the cashout amount.
  • This ensures that the cashout amount reflects current market conditions and the likely return if the bet were settled at that moment.

Note: The cashout amount must always be greater than zero.

Full Cashout Example

Consider a bet placed on a 3-way market. The initial bet was EUR 10 at odds of 1.4 (Home win), with a total potential return of EUR 14.

Suppose current odds are:

SideOdds
Home1.38
Draw4.68
Away8.81

Calculating the full cashout:

$$\tag*{(2)} \text{CashoutAmount} = 14 - \left(\frac{14}{4.68} + \frac{14}{8.81}\right) = 9.419$$

After this cashout, the potential return is zero, and the bet is fully settled.

Partial Cashout Example

For a partial cashout, consider the same initial conditions but with different subsequent odds:

In this example, we assume the odds have shifted:

SideOdds
Home1.20
Draw6.02
Away18.1

To cash out EUR 8 of the potential return:

$$\tag*{(3)} \text{CashoutAmount} = 8 - \left(\frac{8}{6.02} + \frac{8}{18.1}\right) = 6.229$$

The remaining stake (calculated based on the proportion of the potential return not cashed out):

$$\tag*{(4)} \text{RemainingStake} = 10 \times \left(\frac{6}{14}\right) = 4.286$$

This remaining stake will continue under the normal settlement process. Later, if the bettor decides to cash out the rest:

We further assume the current odds:

SideOdds
Home1.82
Draw3.51
Away4.23

Final cashout for the remaining EUR 6 potential return:

$$\tag*{(5)} \text{CashoutAmount} = 6 - \left(\frac{6}{3.51} + \frac{6}{4.23}\right) = 2.872$$

After this transaction, there is no remaining potential return, and the original bet is fully settled.

Cashouts provide a strategic tool for bettors to manage risk and secure returns under changing conditions.

2 - Odds Conversion

How to convert between different betting odds formats, including US, Decimal, and Exchange odds.

There are different ways in which odds can be displayed for sports betting markets. Aside from the three primary types — American Odds, Decimal Odds, and Fractional Odds — Cloudbet also supports Hong Kong and Malaysian odds. The Cloudbet API is offered in Decimal Odds format, but you can convert these to other formats using the formulas below.

Converting US Odds to Decimal Odds

US Odds can be converted to Decimal Odds using the following formulas based on whether the US Odds are positive or negative:

For positive US Odds:

$$\tag*{(1)} \text{DecimalOdds} = 1 + \left(\frac{\text{USOdds}}{100}\right)$$

For negative US Odds:

$$\tag*{(2)} \text{DecimalOdds} = 1 + \left(\frac{100}{|\text{USOdds}|}\right)$$

Example:

  • For US Odds of -110: \( \text{Decimal Odds} = 1 + \frac{100}{110} \approx 1.909 \)
  • For US Odds of +150: \( \text{Decimal Odds} = 1 + \frac{150}{100} = 2.5 \)

Converting Decimal Odds to US Odds

Decimal Odds can be converted to US Odds using the following formula:

If \(\text{DecimalOdds} \geq 2.0\):

$$\tag*{(3)} \text{USOdds} = (\text{DecimalOdds} - 1) \times 100$$

If \(\text{DecimalOdds} < 2.0\):

$$\tag*{(4)} \text{USOdds} = -\frac{100}{\text{DecimalOdds} - 1}$$

Example:

  • For Decimal Odds of 1.909: \( \text{US Odds} = -\frac{100}{1.909 - 1} \approx -110 \)
  • For Decimal Odds of 2.5: \( \text{US Odds} = (2.5 - 1) \times 100 = 150 \)

Converting Fractional Odds to Decimal Odds

Fractional Odds are commonly used in the UK and Ireland and represent the potential profit received on a bet relative to the stake. Here’s how to convert between Fractional Odds and other formats:

To convert Fractional Odds to Decimal Odds, add 1 to the result of dividing the numerator by the denominator:

$$\tag*{(7)} \text{DecimalOdds} = 1 + \left(\frac{\text{Numerator}}{\text{Denominator}}\right)$$

Example:

  • For Fractional Odds of 3/2: \( \text{Decimal Odds} = 1 + \frac{3}{2} = 2.5 \)

Exchange Odds to Standard Bookmaker Odds

Betting exchanges offer odds in a decimal format similar to standard bookmakers but include a commission on winnings. This section explains how to adjust exchange odds to reflect the equivalent odds offered by a standard bookmaker, accounting for the commission taken by the exchange.

For US Exchange Odds:

$$\tag*{(5)} \text{EquivalentUSOdds} = \text{USExchangeOdds} - \left(\frac{\text{USExchangeOdds} \times \text{Commission}}{100 - \text{Commission}}\right)$$

For Decimal Exchange Odds:

$$\tag*{(6)} \text{EquivalentDecimalOdds} = \frac{\text{DecimalExchangeOdds}}{1 - (\text{Commission} / 100)}$$

Example (with 1% Commission):

  • For US Odds of -110: \( \text{Adjusted US Odds} = -110 \times (1 - 0.01) \approx -111.10 \)
  • For Decimal Odds of 1.909: \( \text{Adjusted Decimal Odds} = 1.909 \times (1 - 0.01) \approx 1.88991 \)

3 - Betting Outcomes and Probability Computations

In-depth exploration of the mathematical foundations of betting probabilities and their implications for strategy.

This page provides technical details for understanding and utilizing betting odds and probabilities that are foundational for developing sophisticated betting strategies.

  • True Odds: The actual probabilities of outcomes without any bookmaker margin. True odds are rarely offered in sports betting as they do not provide any profit margin for the sportsbook.
  • Implied Odds: These odds are derived from the betting odds offered by Cloudbet, indicating the implied chances of a particular outcome to be. Implied odds include the overround or vig, which is their built-in profit margin.
  • Fair Odds: Also known as zero-vig or no-vig odds, these are calculated by removing Cloudbet’s overround from the implied odds. Fair odds show what the betting odds would be if Cloudbet did not apply a profit margin, providing a “fair” assessment of probability. Calculating fair odds is useful for bettors in assessing the value of the odds offered compared to the true likelihood of the event.

Conversion from US Odds to Probability

US odds represent the amount won on a 100 unit bet when positive, and the stake needed to win 100 units when negative. The probability implied by US odds is calculated as follows:

When odds are positive:

$$\tag*{(1)} P(Win) = \frac{100}{\text{USOdds} + 100}$$

When odds are negative:

$$\tag*{(2)} P(Win) = \frac{|\text{USOdds}|}{|\text{USOdds}| + 100}$$

Conversion from Decimal Odds to Probability

Decimal odds represent the total payout (stake + win) for each unit bet. The probability implied by decimal odds is simpler to calculate:

$$\tag*{(3)} P(Win) = \frac{1}{\text{DecimalOdds}}$$

Calculating Edge from Probability and Odds

The edge represents the expected value of a bet as a percentage of the bet amount. It indicates a player’s advantage (or disadvantage) against the odds offered by the bookmaker.

Using decimal odds:

$$\tag*{(4)} \text{Edge} = (\text{Probability} \times \text{DecimalOdds}) - 1$$

Example: Calculating Edge from Probability and Odds

Let’s say you are considering a bet on a tennis player to win a match. The bookmaker offers decimal odds of 1.8 for this player to win. You estimate that the probability of the player winning is 60% (or 0.60). Plug in your values:

\( \text{Edge} = (0.60 \times 1.8) - 1 = 1.08 - 1 = 0.08 \)

This result, 0.08 or 8%, represents your edge. It indicates that you have an 8% advantage against the odds offered by the bookmaker. This is a positive edge, suggesting that the bet has a positive expected value, making it a potentially profitable bet if your probability estimation is accurate.

From Edge to Probability

Conversely, calculating the probability required to justify a bet at given odds can help bettors decide whether the bet has positive expected value.

Using decimal odds:

$$\tag*{(5)} \text{Probability} = \frac{1 + \text{Edge}}{\text{DecimalOdds}}$$

Example: Calculating Required Probability

Suppose a bookmaker offers odds of 2.5 for a particular team to win a game. You want to calculate the probability that justifies these odds, assuming you have determined an edge of 0.04 (or 4%). Plug in the values:

\( \text{Probability} = \frac{1.04}{2.5} \approx 0.416 \)

This result, 0.416 or 41.6%, is the minimum probability at which the expected value of the bet becomes neutral or positive, given the edge of 4%. It shows that if you estimate the true probability of the team winning is greater than 41.6%, the bet has a positive expected value, making it a potentially good bet.

Decision Making

If your analysis or model suggests that the actual probability of the team winning is higher than 41.6%, say 45%, then the bet is favorable because your estimated probability exceeds the break-even probability calculated. This suggests an expected value that is positive, making it a rational bet under these assumptions.

If your estimate is lower, say 40%, the bet does not justify the odds, indicating a negative expected value, and it would be advisable to avoid placing the bet.

4 - Reduction Factors in Horse Racing

A guide to understanding and computing reduction factors in horse racing to adjust betting odds.

Reduction factors adjust the betting odds in horse racing when horses withdraw after bets have been placed. The odds offered for each remaining horse are reduced.

Settlement & Refunds

When a horse is declared a non-runner in a race, any bets placed on that horse are usually voided, and the stake is refunded to the bettor. However, the presence of a non-runner also impacts bets already placed on other horses in the race. This is where reduction factors come into play.

Without adjusting the odds, the payouts would disproportionately favor bettors in light of the new, higher probability of winning.

For the most current rules and settlement guidelines, please consult the Cloudbet Sportsbook Rules.

Computing Reduction Factors

Reduction factors are calculated based on the odds of the non-runners. The factor reflects the impact of the withdrawn horse on the race:

$$\tag*{(1)} \text{ReductionFactor} = \frac{1}{\text{DecimalOdds}}$$

Where DecimalOdds are the odds of the non-runner.

Application Threshold

It’s worth noting that if the reduction factor for the withdrawn horse is less than 2.5% it is not applied. This policy is in place to avoid minor adjustments that have negligible impact on the odds and payouts.

Applying Reduction Factors to Adjust Odds

The adjusted odds for remaining horses after a withdrawal can be computed using the formula:

$$\tag*{(2)} \text{AdjustedOdds} = (\text{OriginalOdds} - 1) \times (1 - \text{ReductionFactor}) + 1$$

Example: Assume a non-runner had odds of 5.0, generating a reduction factor of:

\( \text{ReductionFactor} = \frac{1}{5.0} = 0.20 \)

If another horse in the race originally had odds of 8.0, the adjusted odds would be:

\( \text{AdjustedOdds} = (8.0 - 1) \times (1 - 0.20) + 1 = 6.6 \)

These adjusted odds now reflect the new potential payout considering the changed race conditions.

5 - Cloudbet API

Programmatic access to Cloudbet’s sportsbook and services.

Swagger/OpenAPI documentation can be found at https://www.cloudbet.com/api/

The docs are split into the following sections:

  • Account: Account management functions
  • Feed: Real-time sportsbook data
  • Trading: Trading API
  • Trading B2B: Trading B2B API enabling you to set your own odds based on the data we supply

Cloudbet API Keys

Trading API Key

The Trading API (aka Betting API) is meant for developers who want to place bets and allows you to perform sports betting programatically.

You should deposit the equivalent of 10 EUR in a currency of your choice and can navigate to the API key section in your account menu. You can generate and revoke keys here in case you leak it, but be careful as there is a penalty for rotating keys too often.

Cloudbet Trading API Key

Affiliate API Key

The Affiliate API is primarily meant if you want to consume Cloudbet odds without needing to place bets programatically. You can obtain the Cloudbet Affiliate API Key by logging into your Cloudbet Affiliate account and then visiting the Affiliate API Token page. Please note that there are 2 tokens on this page. Make sure to generate the token in the API Key section.

Using this Cloudbet Affiliate API Key you can then go back to https://www.cloudbet.com/api/ to test the Feed API endpoints.

If you authenticate with the Cloudbet Affiliate API Key, then the Feed API responses may be cached and up to 1 minute behind the latest updates. This is in contrast to using the Cloudbet Trading API Key, which gives you real-time updates.

5.1 - Markets

How to work with markets from Cloudbet API Feed and using the corresponding market URLs in the Cloudbet Trading API to place bets.

Terminology

Market Key

  • The market_key is the unique identifier for a market and optionally time period with its own settlement rules.

  • The submarket_key is a logical period grouping of the market selections and is primarily useful as an indicator of when the market is settled. It is not required for the definition of a line as explained below.

Market and Submarket Key Example

"markets": {
  "soccer.asian_handicap": {
    "submarkets": {
      "period=ft": {
        "sequence": "4441",
        "selections": [
          {
...

Outcomes, Grouping Parameters and Lines

  • The outcome identifies a unique selection on the market, e.g. 0:0 or home.

  • grouping_parameters include grouping information such as handicap and totals values.

  • If no grouping_parameters are present (empty string), omit the query string and format as <market_key>/<outcome>

  • A line is determined by the market_key and the grouping_parameters, all selections on a line sum up to 100% true probability, e.g. soccer.asian_handicap?handicap=-0.5 includes the home and away outcome.

Outcomes, Grouping Parameters and Lines Example

"selections": [
  {
    "outcome": "home",
    "params": "handicap=-0.75",
    "price": 1.98,
    "minStake": 0.1,
    "maxStake": 13386.98032,
    "probability": 0.488,
    "status": "SELECTION_ENABLED",
    "side": "BACK"
  }
...

Market URL

The market url can be compiled from the feed and takes the form of <market_key>/<outcome>?<grouping_parameters>. This can be sent in the payload of the /v3/bets/place endpoint when placing a bet.

Market URL Example

"marketUrl": soccer.total_goals/over?total=3

Split and Variables

This is static information available in our market list below, while it is not provided dynamically on the Cloudbet API. This information is primarily meant for market settlement, but can also be used by you to visually separate markets by using the Cloudbet Feed API, if you use our API to display markets on your website.

  • Split: List of periods and teams which affect market settlement.

  • Variables: List of variables which affect settlement of a specific market. These can also be used to visually separate lines, e.g. the handicap values on an Asian Handicap market.

Split and Variables Example

	"soccer.asian_handicap_period_extratime": {
		"Name": "Asian Handicap - Extra Time",
		"Variables": [
			"handicap"
		],
		"Split": "period=et",
		"Outcomes": {
			"away": "{{away}} {{-handicap}}",
			"home": "{{home}} {{handicap}}"
		}
	},

A list of markets is available on Github and is also made available below.

If you would like to request addition of new markets, then please create a discussion thread in the Cloudbet Docs Discussions section.

Full List of available markets on the Cloudbet API

5.2 - Examples

Examples showing how to query the Cloudbet API

There are several steps to fetching odds from the Cloudbet Feed API and using these to place bets afterwards with the Cloudbet Trading API. Here, we will show you how to fetch these odds after creating a Cloudbet Trading or Affiliate API Key.

In general you would follow these steps to get the latest odds:

  1. Get details about upcoming events for your desired sports. The Events or Fixtures endpoint can be used to get a list of upcoming events and competitions for a specific sport on a specific date.

  2. Obtain odds for all events of an upcoming competition that you found from the fixtures endpoint by accessing the competitions endpoint. This allows you to batch ingest odds for multiple events if desired. There is also an event endpoint if you want to get odds for a specific event.

Sports Fixtures

Information about listed events is what we refer to as “fixtures”. We break these down into sports, competitions and events that can be queried from the feed API.

Please substitute X-API-Key with your actual Cloudbet API key.

List of sports

Get a list of sports. Sports are ordered by alphabetical order.

curl -X "GET" "https://sports-api.cloudbet.com/pub/v2/odds/sports" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>"
-H "Content-Type: application/json"

Sample response:

    {
        "sports": [
            {
                "name": "American Football",
                "key": "american-football",
                "competitionCount": 2,
                "eventCount": 92
            },
            {
                "name": "Archery",
                "key": "archery",
                "competitionCount": 0,
                "eventCount": 0
            },
            .
            .
            .
            {
                "name": "Soccer",
                "key": "soccer",
                "competitionCount": 142,
                "eventCount": 1239
            }
        ]
    }

Competitions for a given sport

Get active competitions for a sport. Competitions are grouped by categories.

curl -X "GET" "https://sports-api.cloudbet.com/pub/v2/odds/sports" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>"
-H "Content-Type: application/json"

Sample response:

{
    "name": "Soccer",
    "key": "soccer",
    "competitionCount": 141,
    "eventCount": 1240,
    "categories": [
    {
        "name": "England",
        "key": "england",
        "competitions": [
            {
                "name": "Premier League",
                "key": "soccer-england-premier-league",
                "eventCount": 29
            },
            {
                "name": "FA Cup",
                "key": "soccer-england-fa-cup",
                "eventCount": 3
            },
            .
            .
            .
        ]
    },
    {
        "name": "International",
        "key": "international",
        "competitions": [
            {
                "name": "UEFA Euro 2024",
                "key": "soccer-international-euro-cup",
                "eventCount": 146
            },
            {
                "name": "World Cup",
                "key": "soccer-international-world-cup",
                "eventCount": 1
            },
            .
            .
            .
        ]
    ]
}

Fixtures for a given competition

  • Fetch Match Odds, Asian Handicap and Total Goals markets for EPL
curl -X "GET" "https://sports-api.cloudbet.com/pub/v2/odds/competitions/soccer-england-premier-league?markets=soccer.matchOdds&markets=soccer.asianHandicap&markets=soccer.totalGoals" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>"
-H "Content-Type: application/json"
  • Fetch Moneyline, Totals and Run Line markets for MLB:
curl -X "GET" "https://sports-api.cloudbet.com/pub/v2/odds/competitions/baseball-usa-mlb?markets=baseball.moneyline&markets=baseball.totals&markets=baseball.runLine" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>"
-H "Content-Type: application/json"

Sample response for NBA with Moneyline and Handicap markets:

{
  "name": "NBA",
  "key": "basketball-usa-nba",
  "sport": {
    "name": "Basketball",
    "key": "basketball"
  },
  "events": [
    {
      "sequence": "97",
      "id": 6473660,
      "home": {
        "name": "Miami Heat",
        "key": "c672-miami-heat",
        "abbreviation": "MIA"
      },
      "away": {
        "name": "Los Angeles Lakers",
        "key": "c655-los-angeles-lakers",
        "abbreviation": "LAL"
      },
      "players": {
        "c4a879-jared-dudley": {
          "name": "Jared Dudley",
          "team": "AWAY",
          "position": {
            "name": "F",
            "key": "f"
          }
        },
        "c4b25d-andre-drummond": {
          "name": "Andre Drummond",
          "team": "AWAY",
          "position": {
            "name": "C",
            "key": "c"
          }
        },
        .
        .
        .
      },
      "status": "TRADING_LIVE",
      "markets": {
        "basketball.handicap": {
          "submarkets": {
            "period=ot&period=ft": {
              "sequence": "97",
              "selections": [
                {
                  "outcome": "home",
                  "params": "handicap=-8",
                  "price": 1.915,
                  "minStake": 0.0001,
                  "probability": 0.505,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                },
                {
                  "outcome": "away",
                  "params": "handicap=-8",
                  "price": 1.95,
                  "minStake": 0.0001,
                  "probability": 0.495,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                },
                {
                  "outcome": "home",
                  "params": "handicap=-10",
                  "price": 2.248,
                  "minStake": 0.0001,
                  "probability": 0.427,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                },
                {
                  "outcome": "away",
                  "params": "handicap=-10",
                  "price": 1.672,
                  "minStake": 0.0001,
                  "probability": 0.573,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                },
                .
                .
                .
              ]
            }
          },
          "liability": 1262.505
        },
        "basketball.moneyline": {
          "submarkets": {
            "period=ot&period=ft": {
              "sequence": "97",
              "selections": [
                {
                  "outcome": "home",
                  "params": "",
                  "price": 1.264,
                  "minStake": 0.0001,
                  "probability": 0.76,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                },
                {
                  "outcome": "away",
                  "params": "",
                  "price": 4.001,
                  "minStake": 0.0001,
                  "probability": 0.24,
                  "status": "SELECTION_ENABLED",
                  "side": "BACK"
                }
              ]
            }
          },
          "liability": 631.2525
        },
      },
      "name": "Miami Heat V Los Angeles Lakers",
      "key": "c672-miami-heat-v-c655-los-angeles-lakers",
      "cutoffTime": "2021-04-08T23:30:00Z",
      "metadata": {
        "opinion": []
      },
      "startTime": "2021-04-08T23:30:00Z"
    },
    {
      "sequence": "1873",
      "id": 5030846,
      "home": null,
      "away": null,
      "players": {
          .
          .
          .
      },
      "status": "TRADING",
      "markets": {
      .
      .
      .
      },
      "name": "NBA - Awards - Coach Of The Year (reg. season)",
      "key": "nba-awards-coach-of-the-year-reg-season",
      "cutoffTime": "2021-04-08T23:30:00Z",
      "metadata": {
        "opinion": []
      },
      "startTime": "2021-04-08T23:30:00Z"
    }
  ]
}

Query a single event

For a single event, the API provides you all available markets. To delve into details about how our markets are structured, please look at the Cloudbet markets page.

curl -X 'GET' "https://sports-api.cloudbet.com/pub/v2/odds/events/6473660" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"

Sample response for a single event

{
  "sequence": "97",
  "id": 6473660,
  "sport": {
    "name": "Basketball",
    "key": "basketball"
  },
  "competition": {
    "name": "NBA",
    "key": "basketball-usa-nba",
    "category": {
      "name": "USA",
      "key": "usa"
    }
  },
  "home": {
    "name": "Miami Heat",
    "key": "c672-miami-heat",
    "abbreviation": "MIA"
  },
  "away": {
    "name": "Los Angeles Lakers",
    "key": "c655-los-angeles-lakers",
    "abbreviation": "LAL"
  },
  "players": {
    "c4a879-jared-dudley": {
      "name": "Jared Dudley",
      "team": "AWAY",
      "position": {
        "name": "F",
        "key": "f"
      }
    },
    "c4b25d-andre-drummond": {
      "name": "Andre Drummond",
      "team": "AWAY",
      "position": {
        "name": "C",
        "key": "c"
      }
    },
    "c4b269-kentavious-caldwell-pope": {
      "name": "Kentavious Caldwell-Pope",
      "team": "AWAY",
      "position": {
        "name": "G",
        "key": "g"
      }
    },
    "c4b58e-ben-mclemore": {
      "name": "Ben McLemore",
      "team": "AWAY",
      "position": {
        "name": "G",
        "key": "g"
      }
    },
    .
    .
    .
  },
  "status": "TRADING",
  "markets": {
    "basketball.handicap": {
      "submarkets": {
        "period=ot&period=ft": {
          "sequence": "97",
          "selections": [
            {
              "outcome": "home",
              "params": "handicap=-8",
              "price": 1.915,
              "minStake": 0.0001,
              "probability": 0.505,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "away",
              "params": "handicap=-8",
              "price": 1.95,
              "minStake": 0.0001,
              "probability": 0.495,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "home",
              "params": "handicap=-10",
              "price": 2.248,
              "minStake": 0.0001,
              "probability": 0.427,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "away",
              "params": "handicap=-10",
              "price": 1.672,
              "minStake": 0.0001,
              "probability": 0.573,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            .
            .
            .
          ]
        }
      },
      "liability": 1262.505
    },
    "basketball.moneyline": {
      "submarkets": {
        "period=ot&period=ft": {
          "sequence": "97",
          "selections": [
            {
              "outcome": "home",
              "params": "",
              "price": 1.264,
              "minStake": 0.0001,
              "probability": 0.76,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "away",
              "params": "",
              "price": 4.001,
              "minStake": 0.0001,
              "probability": 0.24,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            }
          ]
        }
      },
      "liability": 631.2525
    },
    "basketball.totals": {
      "submarkets": {
        "period=ot&period=ft": {
          "sequence": "97",
          "selections": [
            {
              "outcome": "over",
              "params": "total=204.5",
              "price": 1.924,
              "minStake": 0.0001,
              "probability": 0.502,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "under",
              "params": "total=204.5",
              "price": 1.942,
              "minStake": 0.0001,
              "probability": 0.498,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "over",
              "params": "total=202",
              "price": 1.682,
              "minStake": 0.0001,
              "probability": 0.57,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            {
              "outcome": "under",
              "params": "total=202",
              "price": 2.228,
              "minStake": 0.0001,
              "probability": 0.43,
              "status": "SELECTION_ENABLED",
              "side": "BACK"
            },
            .
            .
            .
            .
          ]
        }
      },
      "liability": 420.83500000000004
    }
  },
  "name": "Miami Heat V Los Angeles Lakers",
  "key": "c672-miami-heat-v-c655-los-angeles-lakers",
  "cutoffTime": "2021-04-08T23:30:00Z",
  "metadata": {
    "opinion": []
  },
  "startTime": "2021-04-08T23:30:00Z"
}

Account API for Balance Tracking

Query list of available currencies

The first thing for automated betting is knowing about our funds available. Using the endpoint below, you can find out the list of currencies available.

curl -X 'GET' "https://sports-api.cloudbet.com/pub/v1/account/currencies" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"

Sample response:

{
  "currencies": ["BONUS_EUR", "BTC", "ETH", "PLAY_EUR"]
}

Query balance for a currency

This allows you to query your balance in a specific currency. Here we query PLAY_EUR, our test funds currency that currently can be enabled on your account upon request.

curl -X 'GET' "https://sports-api.cloudbet.com/pub/v1/account/currencies/PLAY_EUR/balance" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"

Sample response:

{
  "amount": "984.69"
}

Trading API to place bets

Once you know which currency you want to place bets in, as well as the markets you want to place your bet on, you can call the place bet endpoint.

Place Bet Request

This is a POST endpoint where the request body contains details about your desired market and currency. Use a unique, randomly generated uuid in the referenceId field of your request.

Sample Place Bet request on an Asian Handicap market for a Soccer event:

curl -X 'POST' "https://sports-api.cloudbet.com/pub/v3/bets/place" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"
-d '{"acceptPriceChange":"BETTER","currency":"PLAY_EUR","eventId":"7190563","marketUrl":"soccer.asian_handicap/home?handicap=0.5","price":"1.65","referenceId":"1891d3a0-0af8-11ec-b536-11ca86b8c5a4","stake":"1.1"}'

Sample success response:

{
  "referenceId": "1891d3a0-0af8-11ec-b536-11ca86b8c5a4",
  "price": "1.652",
  "eventId": "7190563",
  "marketUrl": "soccer.asian_handicap/home?handicap=0.5",
  "side": "BACK",
  "currency": "PLAY_EUR",
  "stake": "1.1",
  "status": "ACCEPTED",
  "error": ""
}

NOTE: Quite often, your bet will not be immediately accepted while we process your betting request. Thus you will receive a PENDING_ACCEPTANCE response instead:

{
  "referenceId": "1891d3a0-0af8-11ec-b536-11ca86b8c5a4",
  "price": "1.652",
  "eventId": "7190563",
  "marketUrl": "soccer.asian_handicap/home?handicap=0.5",
  "side": "BACK",
  "currency": "PLAY_EUR",
  "stake": "1.1",
  "status": "PENDING_ACCEPTANCE",
  "error": ""
}

Bet Status Request

If you receive a PENDING_ACCEPTANCE response, you can then check the status of the bet with the referenceId field from your place bet request to confirm if it got accepted or rejected. This bet status request can also be used generally to query the status of your bets.

curl -X 'POST' "https://sports-api.cloudbet.com/pub/v3/bets/1891d3a0-0af8-11ec-b536-11ca86b8c5a4/status
" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"
-d '{"acceptPriceChange":"BETTER","currency":"PLAY_EUR","eventId":"7190563","marketUrl":"soccer.asian_handicap/home?handicap=0.5","price":"1.65","referenceId":"1891d3a0-0af8-11ec-b536-11ca86b8c5a4","stake":"1.1"}'

The response for the above bet status request will have a similar format to the bet placement request above.

NOTE: Your bet might get rejected for different reasons, with recommended new stake and price on the rejection payload. Please update your payload with a new referenceId and try again with updated fields if this happens.

Bet History for settlements

You can obtain a full history of your API bets, in addition to being able to view your settled bets in the Bet History section of the Cloudbet Website.

curl -X 'POST' "https://sports-api.cloudbet.com/pub/v3/bets/history?limit=5&offset=0
" \
-H "accept: application/json" \
-H "X-API-Key: <API Key>" \
-H "Content-Type: application/json"
-d '{"acceptPriceChange":"BETTER","currency":"PLAY_EUR","eventId":"7190563","marketUrl":"soccer.asian_handicap/home?handicap=0.5","price":"1.65","referenceId":"1891d3a0-0af8-11ec-b536-11ca86b8c5a4","stake":"1.1"}'

Sample response:

{
  "bets": [
    {
      "referenceId": "1891d3a0-0af8-11ec-b536-11ca86b8c5a4",
      "price": "1.652",
      "eventId": "7190563",
      "marketUrl": "soccer.asian_handicap/home?handicap=0.5",
      "side": "BACK",
      "currency": "PLAY_EUR",
      "stake": "1.1",
      "createTime": "2024-05-29T03:53:02Z",
      "status": "ACCEPTED",
      "returnAmount": "0.0",
      "eventName": "Manchester City v Manchester United",
      "sportsKey": "soccer",
      "competitionId": "18",
      "categoryKey": "usa",
      "customerReference": "5b1eb89f-5c87-4bd2-b8e9-82197fd6b986",
      "error": ""
    }
  ],
  "totalBets": "1"
}

5.3 - Handicap Odds

How to work with handicap markets on the Cloudbet API.

Special care should be taken when working with all handicap markets.

In the Cloudbet API, the handicap value refers to the home team value and is inverted on the away side.

Example:

market_key: “soccer.asian_handicap”
outcome: "away",
params: "handicap=0.5",
price: 3.3

Handicap Odds

5.4 - Margin Adjustments in Sports Betting

Learn how to adjust margins in sports betting to set your own odds based on the data the Cloudbet B2B API supplies.

You can integrate the Cloudbet B2B API and set your own odds based on the data supplied, enabling you to carve out a profitable margin for each transaction. Alongside margins, you can also take control of and share liability from the individual bets that players or customers place through your platform.

Basic Implied Probability Calculation

The implied probability of an outcome is initially calculated from the given odds and the overround. For a specific betting market:

$$\tag*{(1)} \text{Implied Probability} = \frac{1}{\text{Odds} \times \text{Overround}}$$

This calculation gives a base probability adjusted for the bookmaker’s initial margin embedded within the odds.

Adjusting the Overround

To reflect changes in market conditions, event specifics, or risk assessments, the overround is adjusted by adding a margin percentage:

$$\tag*{(2)} \text{Adjusted Overround} = \text{Overround} + \text{Margin Percentage}$$

This formula ensures that the total market margin is adaptive and adjusts with the origin.

Recalculating Odds with Adjusted Overround

After adjusting the overround, new odds are recalculated as follows:

$$\tag*{(3)} \text{New Odds} = \frac{1}{\text{Implied Probability} \times \text{Adjusted Overround}}$$

This method of recalculating the odds maintains the relative value between different outcomes while adjusting the overall margin.

Example Calculation

If the initial odds for a team winning are 2.0 with an overround of 1.05, the implied probability is:

$$\text{Implied Probability} = \frac{1}{2.0 \times 1.05} = 0.4762$$

If the margin percentage is adjusted to 1.10, the new odds would be:

$$\text{New Odds} = \frac{1}{0.4762 \times 1.10} = 1.91$$

These recalculated odds reflect the adjusted margin and provide a new market price for the outcome.

5.5 - Simulated Betting with Test Funds

This page provides information on accessing and using test funds with Cloudbet’s API for simulated betting. This allows users to experiment with betting strategies without risking real money.

First, ensure your account balance meets the minimum requirement of 10 EUR equivalent. This can be in any supported currency such as BTC, ETH, USDC, USDT, etc.

Once an API key is generated, a new currency option, PLAY_EUR, can be found in the account menu. A request button to credit the account with Play EUR 100 will be available. This process is self-serve, allowing users to request more funds when needed.

If you require larger amounts or wish to test the API before funding your account, please contact customer support. This ensures you can fully explore Cloudbet’s offerings and refine your strategies without risk.