Announcement

Collapse
No announcement yet.

How to interpret data returned from listMarketBook into readable odds?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to interpret data returned from listMarketBook into readable odds?

    So I'm very new to the Betfair API and a little confused...apologies if this sounds like an obvious question but I'd appreciate people's help here...I have managed to get a set of filtered "MATCH_ODDS" data out of the API for a number of football/soccer games happening this weekend (at time or writing).

    So I understand that you have three "selections" represented by selectionid - these being Home win, away win and draw. The listMarketBook call gives me "price" and "size" for each of these outcomes linked to the respective back/lay for each outcome.

    How do you translate the information returned in this call into readable odds like you see in the bookies i.e. 5/2, 2/1 etc. It isn't striking out as obvious to me? I'm using the API demo tool at the moment, but will be building something in a Laravel/PHP environment so if there are caluclations that I need to make etc from the data please let me know.

    Result set is currently looking like this:

    apisnap.PNG
    Last edited by kaanu; 12-03-2021, 12:42 AM.

  • #2
    The returned odds are called decimal odds (computers don't do fractions very well).

    The decimal odds equate to fractional odds plus one, so if mutiplying backs odds by stake gives you your return if the bet wins.

    So, for the examples you mention, 5/2 is 3.5, 2/1 is 3.0. And 2.0 is evens.

    Clearly, some traditional odds can't be easily represented in decimal format, but as long as you're fairly adept with mental arithmetic, it's not too hard to see roughly what odds are. A list of equivalents on the wall would make an easy cross-reference guide.

    The smallest odds that you can back or lay is 1.01 and the highest is 1000.

    Increments (or "ticks") between allowable odds depend on the range, and are as follows:

    1.01 to 2.00 - 0.01
    2.00 to 3.00 - 0.02
    3.00 to 4.00 - 0.05
    4.0 to 6.0 - 0.1
    6.0 to 10.0 - 0.2
    10.0 to 20.0 - 0.5
    20 to 30 - 1
    30 to 50 - 2
    50 to 100 - 5
    100 to 1000 - 10

    If you put an invalid value in, a bet will be rejected.

    With these increments, it means the number of different possible odds is limited. You could put the two numbers from traditional fractional odds into a spreadsheet and have it work out the decimal odds, and print a list in sorted sequence. Probably best to do it in a few columns. There may well be such a list somewhere on the internet already, or even in the API documentation.

    Comment


    • #3
      Originally posted by jabe View Post
      The returned odds are called decimal odds (computers don't do fractions very well).

      The decimal odds equate to fractional odds plus one, so if mutiplying backs odds by stake gives you your return if the bet wins.

      So, for the examples you mention, 5/2 is 3.5, 2/1 is 3.0. And 2.0 is evens.

      Clearly, some traditional odds can't be easily represented in decimal format, but as long as you're fairly adept with mental arithmetic, it's not too hard to see roughly what odds are. A list of equivalents on the wall would make an easy cross-reference guide.

      The smallest odds that you can back or lay is 1.01 and the highest is 1000.

      Increments (or "ticks") between allowable odds depend on the range, and are as follows:

      1.01 to 2.00 - 0.01
      2.00 to 3.00 - 0.02
      3.00 to 4.00 - 0.05
      4.0 to 6.0 - 0.1
      6.0 to 10.0 - 0.2
      10.0 to 20.0 - 0.5
      20 to 30 - 1
      30 to 50 - 2
      50 to 100 - 5
      100 to 1000 - 10

      If you put an invalid value in, a bet will be rejected.

      With these increments, it means the number of different possible odds is limited. You could put the two numbers from traditional fractional odds into a spreadsheet and have it work out the decimal odds, and print a list in sorted sequence. Probably best to do it in a few columns. There may well be such a list somewhere on the internet already, or even in the API documentation.
      Hey Jabe thanks for getting back to me - that makes a little more sense somewhat - so the "price" i'm getting back is actually the odd but in decimal format - and in order to display it in fractions form, I need to convert decimals to fractions essentially - what sort of formula can be used to do this? The only thing I've come across on betfair themselves is an odds calculator/converter here:

      https://betting.betfair.com/how-to-u...010819-51.html

      By "ticks" I understand they are increments - but how will this affect the overall formula and odds if say you get 4.1 or 4.2 back? Using the calculator on the link above for example - 4.1 is 31/100 and 4.2 is 16/5. So what arithmitc formula should I implement in order to get this? Or are you saying the "price" I get back needs to have 1 subtracted from it first and then the formula in question applied, assuming the subtraction doesn't go below 1.01.

      Comment


      • #4
        It sounds like you're thereabouts. It would be simpler for you to be converted to decimal odds, but I know that if you're used to fractional odds it's not easy to change.

        The lowest value you'll ever see in decimal odds is 1.01, which will become 1/100 against (or 100/1 on).


        Let's say you've got odds of 5/2. To convert that to decimal, it's just (1 + 5/2) = 3.50. If you call the fractional odds "A to B" or "A to B against" (and try to consider odds-on odds as "2/5" rather than "5/2 on"), then it should help. And 2/5 would be (1 + 2/5) or 1.40.

        From a programming angle, the odds, or price, wants to be able to handle two decimal places and four digits before the decimal place. Let's call it decOdds.

        For the fractional odds, we have two numbers to consider. Let's call them frOddsA and frOddsB.

        Going one way it's very simple;

        decOdds = 1 + frOddsA / frOddsB

        with the proviso, of course, that you need to make the increment appropriate to the range that decOdds falls into. I should have thought about this previously, so I might need to sleep on it.

        Going the other way it's not so simple.

        If we have a variable caled frOdds, we can say that

        frOdds = decOdds - 1

        (and frOdds = frOddsA / frOddsB)

        But we don't get frOddsA or frOddsB straight from (decOdds - 1).

        I've placed bets with on-course bookies in the dim and distant past and I seem to recall that they converted everything so that their assistant recorded the bets as being "something to a hundred" against. I see the calculator you used effectively did that, so if you're happy to always quote the fractional odds that way, the first part is much easier to come up with. It might be possible to create an array to deal with all the increments.

        Let me give this some thought over the weekend.
        Last edited by jabe; 16-03-2021, 02:20 PM.

        Comment


        • #5
          These are my current thoughts.

          If what you want is only to be able to see the odds in fractional form, you can do this (it's been a while since I did any PHP. so I'm writing in a generic code-ish manner):

          fractionalOdds = 100 * (decimalOdds - 1) "/ 100";

          That will give you fractional odds of something to a hundred. Ideally some cancelling would take place, so that decimal odds of 3.0 would give you 200/100 which would usually be expressed as 2/1.

          The question then is can you live with 200/100 rather than 2/1? It would, of course, be more confusing with other odds that don't divide up so nicely.

          If you really need the fractions in their standard bookie form, then best I can think of is to create keyed strings so that you'd use the 100 * (decimalOdds - 1) part of the calculation as a key to a string containing whatever the standard version of the decimal odds are. So, for example, 7.5 would yield a key value of 650, which would bring you a string value of 13/2. You could even make it so that odds below 2.0 or evens are returned as odds on - 1.10 would give a key value of 10, and that could return a string of "10/1 on" if you wished. The snag with this is that Betfair uses 400 different odds values and you'd have to create "neater" versions of many of them.

          The Betfair odds converter, below, can tell you the nicer (ie: cancelled-down) versions of all the possible odds, but it's a bit of a job. I do have a spreadsheet with the allowable decimal odds and the 100 * (decimalOdds - 1) value that would provide the key. I can either send you it or tell you how I created the values.

          https://betting.betfair.com/how-to-u...140220-51.html




          Last edited by jabe; 16-03-2021, 08:36 PM.

          Comment

          Working...
          X