Asian Handicap Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #1

    Asian Handicap Question

    I never use Asian handicap markets, so they always puzzle me when I working on my App. Here is another one that has got me pondering.....

    What I am unsure of currently is how the commerical apps that implement a Practice mode can calculate a profit or loss amount internally, without getting the actual monetary amount returned by Betfair (Obviously this wont be returned as a practice mode bet is not a real bet and is inviisible to the Betfair Server)

    lets say I place £2 bet on Team A +1 & +1.5

    So we are effectively having 2 bets on Team A of £1 each with Team A getting a 1 goal and a 1.5 goal advantage before we start

    Possible outcomes are
    Code:
    Team A Wins by any score      Both Bets win
    
    Any Draw                      Both Bets win
    
    Team B Wins by 1 goal         Bet +1 is level outcome so bet is void, £1 stake returned
                                  Bet +1.5 still wins so we get 1 * (odds-1) profit returned
    
    Team B Wins by 2 goals or more
                                  Both Bets Lose we lose 2 quid

    As far as I am aware at market close Betfair will just return me a "Win" or "Lose" result for this market row.

    That means I cant distinguish between the condition where both my £1 bets win or the condition where 1 bet wins and 1 bet loses. So how can I calculate the profit/loss for this bet ?

    Would be great if one of the commercial guys (Hello Mr BFExplorer) could explain this please ?

    Thanks
    Geoff
  • WTPooh
    Member
    • May 2012
    • 88

    #2
    If status for A +x.25 is 'WINNER' then check status for A +x. If it is 'WINNER' then both bets won.
    For A +x.0 you will get 'LOSER' status if team B wins by x goals. You need to check status for A +x.25. If it is 'WINNER' then your stake returned.
    For A +x.75 you will get 'LOSER' status if team B wins by x+1 goals. You need to check status for B -(x+1). If it is 'LOSER' then half of your stake returned.

    Comment

    • geoffw123
      Senior Member
      • Mar 2014
      • 250

      #3
      Hiya

      Thanks for the feedback.

      I did wonder if the way to do this was look at the other row results, but I had thought that was so fiddly that Betfair would have provided a cleaner way to do this.
      It is kind of misleading even for the single score rows eg Team A +1 that Betfair for certain results returns "LOSER" when in reality the bet is a void outcome.
      Anyways I have coded up something now, it looks very ugly and is about 2 pages long but seems to work on a quick test.

      Thanks again
      Geoff

      Comment

      • WTPooh
        Member
        • May 2012
        • 88

        #4
        I have another idea. You just need to find a row where both A+x and B-x have status loser. There can be no such row if one team won by more then maximum handicap on the market.

        Comment

        • geoffw123
          Senior Member
          • Mar 2014
          • 250

          #5
          Hi

          I only wrote this yesterday, so absolutely no guarantee that this is corrent.

          if handicap ends in .0 or .5 then its a single item row, logic is

          if the Asian HC row status is "Winner", it really is a winner. P/L is just standard simple stake * (odds-1) etc

          If he Asian HC row status is "Loser" then add 0.5 goals and if that row is status = "Winner" then this bet is void, no loss
          else if its still a "LOSER" then this is really a losing bet, your stake is lost.

          For the .25 and .75 double rows, I just split it into 2 bets of stake/2, and follow the same logic as above.
          -----------------------------------------------

          Hmmm, as I was reading this back, there is an obvious flaw with this. What if the bet is on the Team A +4 goals ?

          I cant go and check +4 + 0.5 goals row as it doesnt exist

          This might be solvable, as Team A +4 is the same as a bet on Team B -4 goals, I can check row Team B -4 + 0.5 = -3.5 goals as that does exist. Need to ponder this a bit more.

          Thanks Betfair for making this so simple and straightforward
          Last edited by geoffw123; 22-07-2019, 12:00 PM.

          Comment

          • WTPooh
            Member
            • May 2012
            • 88

            #6
            If you can find a row where both A+x and B-x are losers then team B won exactly by x goals.
            Example if there is no such row: A+4 is a loser, B-4 is a winner. Then team B won by more then 4 goals. You can assume that team B won by 5 goals.
            Now you know which team won and win margin. You can settle your bet.

            Comment

            • geoffw123
              Senior Member
              • Mar 2014
              • 250

              #7
              Hi WTPooh

              Thanks again for the feedback, I like that last suggestion much more than my first solution, so I ditched my first attempt and rewrote it to use the above logic.
              The code is shorter and looks cleaner, hopefully it works OK ! I can post a bit of code if anyone is interested, give me a shout if you want to see it.

              Regards Geoff

              Comment

              • Gox
                Junior Member
                • Feb 2020
                • 2

                #8
                Originally posted by geoffw123 View Post
                Hi WTPooh

                Thanks again for the feedback, I like that last suggestion much more than my first solution, so I ditched my first attempt and rewrote it to use the above logic.
                The code is shorter and looks cleaner, hopefully it works OK ! I can post a bit of code if anyone is interested, give me a shout if you want to see it.

                Regards Geoff
                Hey Geoff,
                I've been struggling with the same problem for days now. May I ask if you could post a snippet of the code, just to see how your algorithm works?

                Thanks,
                Goran

                Comment

                • geoffw123
                  Senior Member
                  • Mar 2014
                  • 250

                  #9
                  HIya

                  I am not really dialled into the details of this now, it was months back when I was struggling with it. I came up with this C# code, its fairly short, but no guarantee it works. Well volunteered you can test it for me. Please let me know if you think it is correct or not.

                  Regards


                  Code:
                       struct resultAsian
                        {
                           public short margin;
                           public string result;
                        };
                  
                        static resultAsian figureOutAsianResult(CMarketDataESA mktData, out long winnerSelId)
                        {
                           resultAsian[] asianRow = {new resultAsian { margin= 4, result = "Home" },
                                           new resultAsian { margin= 3, result = "Home" },
                                           new resultAsian { margin= 2, result = "Home" },
                                           new resultAsian { margin= 1, result = "Home" },
                                           new resultAsian { margin= 0, result = "Draw" },
                                           new resultAsian { margin= -1, result = "Away" },
                                           new resultAsian { margin= -2, result = "Away" },
                                           new resultAsian { margin= -3, result = "Away" },
                                           new resultAsian { margin= -4, result = "Away" },
                                          };
                  
                           winnerSelId = -1;   // draw
                  
                           for (int i = 0; i < asianRow.Length; i++)
                           {
                              var idx = i * 8;
                              if (mktData.runnerData[idx].status == RunnerStatus.LOSER &&
                                                   mktData.runnerData[idx + 1].status == RunnerStatus.LOSER)
                              {
                                 if (asianRow[i].result == "HOME")
                                    winnerSelId = mktData.runnerData[0].selectionId;
                                 else if (asianRow[i].result == "AWAY")
                                    winnerSelId = mktData.runnerData[1].selectionId;
                  
                                 return asianRow[i];
                              }
                           }
                           // shouldnt get here
                           return new resultAsian { margin = 0, result = "?" };
                        }

                  Comment

                  Working...
                  X