Cant get listRaceDetails command to work

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

    #1

    Cant get listRaceDetails command to work

    Hi

    Has anyone had any success with the new listRaceDetails() command. I am not sure what I am doing wrong, cant seem to get anything other than a null response from Betfair.

    I tried sending a few JSON variants such as

    Code:
    Endpoint: https://api.betfair.com/exchange/scores/json-rpc/v1
     
    Calling: method ScoresAPING/v1.0/listRaceDetails with args:
    {"meetingIds":["27596454"],"raceIds":["27596454.1840"]}
    
    Got Response from Betfair in 207 mS:
    null
    Also tried sending two null params, same null response

    Code:
    Endpoint: https://api.betfair.com/exchange/scores/json-rpc/v1 
    
    Calling: method ScoresAPING/v1.0/listRaceDetails with args:
    {"meetingIds":null,"raceIds":null}
    
    Got Response from Betfair in 155 mS:
    null
    I used UK race eventIds, so data should be available from BF.

    I am probably misunderstanding the not very good spec. page. I wish they would show examples of how to use the commands.
    Or maybe even update the API-NG visualiser when they add new stuff.

    Can anyone spot anything wrong ? Thanks for any assistance

    Regards Geoff
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #2
    Partly got it working now

    Hi

    It always happens you post a question here and then 2 mins later figure out your mistake.

    Turned out BF was sending me a response packet, but my lower level JSON decode code was failing and returning a Null.

    The reason it failed was the responseCode type is ambiguous on the Spec page, so I guessed long, where I should have guessed string. Changing that to string gave me a valid response.

    However the returned data looks screwy

    Code:
    {
    	"jsonrpc": "2.0",
    	"result": [{
    		"meetingId": "27596454",
    		"raceId": "27596454.1910",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T19:32:22.077Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1940",
    		"raceStatus": "RESULT",
    		"lastUpdated": "2015-11-11T19:45:02.686Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1710",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T17:42:53.875Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1635",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T17:34:42.274Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1840",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T19:14:12.807Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.2010",
    		"raceStatus": "DORMANT",
    		"lastUpdated": "2015-11-11T14:43:28.451Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1740",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T18:30:25.725Z",
    		"responseCode": "OK"
    	},
    	{
    		"meetingId": "27596454",
    		"raceId": "27596454.1810",
    		"raceStatus": "WEIGHEDIN",
    		"lastUpdated": "2015-11-11T18:32:39.211Z",
    		"responseCode": "OK"
    	}],
    	"id": 1
    }
    Several oddities here (Note its 19:55 here now as I am typing)

    1) I just asked for the last race of the day 20:10 that hasn't run yet. So why is it returning me a bunch of races ?

    2) How come most races that finished hours ago are showing as "WEIGHEDIN" ?

    3) Why is only the 19:40 race showing as RESULT ?

    4) The 20:10 race that is about 15 mins to off now, is showing as DORMANT. That doesn't sound right either ?

    The plot thickens !!
    Would be great if anyone from Betfair support could comment on the above data.

    Thanks again for any help

    Regards Geoff

    Comment

    • geoffw123
      Senior Member
      • Mar 2014
      • 250

      #3
      Small update for info

      If anyone is interested in this command, I checked what happened for the 20:10 final race today.

      It did transitional through a few states (not 100% sure which ones as code is only half written here).

      I saw "GOINGDOWN", "GOINGBEHIND" and "RESULT". The strange thing is the final transition was from "RESULT" to "WEIGHEDIN". that last transition was marked as at 20:24 and "WEIGHEDIN" is the final state it sticks out.

      Very screwy ! Wonder if that is my bug or Betfair's ?

      Geoff

      Comment

      • Merlin
        Junior Member
        • Jan 2009
        • 56

        #4
        Hi Geoff,

        'RESULT' means that the result has been announced by the judge, which can happen as soon as the horses cross the line, or as soon as the judge has seen the photograph for a close finish. If there are no obvious signs of interference (so that a Stewards Enquiry or Objection are unlikely), many bookmakers will pay out on this result.

        The race isn't really 'over' until the jockeys return to the weighing room and weigh in - if any placed horse is found to have carried the incorrect weight, there will be an Objection by the Clerk of the Scales and the horse will be disqualified, changing the official result. This is fortunately rare, although jockeys failing to weigh in is somewhat more common.

        Once the jockeys have 'WEIGHEDIN', the result can't be changed (at least for betting purposes), so this is usually the final stage of the process.

        Merlin

        Comment

        • geoffw123
          Senior Member
          • Mar 2014
          • 250

          #5
          Hi Merlin

          Thanks for the excellent and detailed reply. For some reason, I totally missed the fact that the jockeys have to weigh in after the race as well to verify what weight they actually carried. I had assumed WEIGHEDIN was just a pre race status.
          I wonder if this new command shows WEIGHEDIN as a pre and post race status ? I will have to finish off writing this bit of code so I can check what the various state transitions are.

          Thanks

          Geoff

          Comment

          • Nick JD
            Junior Member
            • Jan 2015
            • 47

            #6
            Originally posted by geoffw123 View Post
            Hi Merlin

            Thanks for the excellent and detailed reply. For some reason, I totally missed the fact that the jockeys have to weigh in after the race as well to verify what weight they actually carried. I had assumed WEIGHEDIN was just a pre race status.
            I wonder if this new command shows WEIGHEDIN as a pre and post race status ? I will have to finish off writing this bit of code so I can check what the various state transitions are.

            Thanks

            Geoff
            This raises an issue I think could be incorporated into the documentation helping programmers use the API:

            By and large, most come to the API with zero clue about bookmaking (its nomenclature and procedures) ... we get some sample code and begin to expand on it. We can find ourselves down the line with a fully functional and beautifully written bot - a bot that has no freakin idea what it's doing.

            Sure, there are glossaries, but they often are goose-chase glossaries that require you to look up the words in the explanation of the words until you're really confused. I'm still not sure what ROLLBACK actually means .

            Is there a definitive guide to (exchange) bookmaking that uses language simple enough for programmers or people with English as a second language out there? That said, much of Betfair's nomenclature seems market-derived, rather than bookmaking-derived and adds to the confusion. eg. Rollback, is a gambling thing, not a sharemarket thing? It's not a database thing, I'm reasonably certain.

            Who wants to write it if it doesn't already exist?

            While I have no intention of trying to encourage this community to share critical and private system information, and that it's a community that rightly-so hold its cards close to its chest - surely we could write the "Bot Writer Who is Clueless to Bookmaking on an Exchange" guide? I'm not putting my hand up, because I need to read it, not write it.

            Where is this in depth plain English guide to WTF all this stuff means? Or is this confusion intentional!
            Last edited by Nick JD; 14-11-2015, 12:44 AM.

            Comment

            • Merlin
              Junior Member
              • Jan 2009
              • 56

              #7
              Hi Nick,

              I'm intrigued by this 'ROLLBACK' thing you mention, I've not come across it in the context of the Betfair exchange or gambling in general - where did you see it?
              To me, 'rollback' is either a software version thing, where a new release is broken so you have to 'roll back' to a previous working version, or it's a database thing, where a part of a transaction fails so you have to 'roll back' all the stuff you've done so far so the database doesn't end up in an inconsistent state (e.g. credits with no corresponding debits).

              As far as a glossary goes, I don't think it would help much. I've seen this while working for a large betting organisation - hugely talented software developers with no actual understanding of the business making elementary errors. They had glossaries and cheat sheets, but they didn't do much good. In the end, the solution was to run inductance courses where the programmers were given experience of betting shops, racecourses and the credit betting centre, as well as a load of books and papers to read. I think this is a general principal - you can't write good software without fully understanding the problems you are trying to solve, and that usually requires a lot of work.

              A good place to start is reading rules, both Betfair (and as many other bookmakers as you can find), but also the individual sports you are betting on (so BHA for British Horseracing, FIFA for football etc.) These are designed for resolving disputes, so tend to be very clear and concise in their definitions and assume no prior knowledge (which may be open to interpretation).

              It's also worth reading the whole of the reference guide all the way through a couple of times, even the bits you think you will never use. It will give you more of a 'feel' for how it all hangs together.

              cheers,
              Merlin

              Comment

              • StefanBelo.
                Junior Member
                • Jan 2009
                • 105

                #8
                I asked similar question but BDP ignored it. It current state this api method is not reliable:

                http://forum.bdp.betfair.com/showthread.php?t=3011
                betfair bot platform, bfexplorer bot sdk

                Comment

                • Merlin
                  Junior Member
                  • Jan 2009
                  • 56

                  #9
                  Kind of illustrates my point - the race in question was a 'bumper' (National Hunt Flat Race); pretty hard to send a message that the horses are going behind or are in the stalls when there are no stalls

                  'Under Orders' and 'Off' in a race like that will typically be a single quick wave of the Starter's flag when he thinks enough of the field are facing in the right direction and most of the jockeys look like they're paying attention - 'At The Post' is all the warning you are ever going to get.

                  This is a situation where knowing something about racing would have been helpful.

                  Stefan's point about prioritising the race status in the new stream technology is a good one, though - otherwise there are too many wasted calls polling an unchanged status.

                  cheers
                  Merlin

                  Comment

                  • geoffw123
                    Senior Member
                    • Mar 2014
                    • 250

                    #10
                    Hi Nick

                    Yes a webpage giving a newbie programmer an introduction to Betfair and betting would be useful for quite a few people I think.

                    I am far from an expert on the subject but would be able to write some of it. On your Rollbback question I am hazarding a guess you might have meant "Rollup" ? Am I correct ?

                    I would be struggling to explain rollup options on the Betfair API myself without researching it a bit.

                    I need to tackle the relatively new BF each way market soon too, that isnt simple for a newbie either. Wish I could read a well written explanatory article on that too !

                    Geoff

                    Comment

                    • Nick JD
                      Junior Member
                      • Jan 2015
                      • 47

                      #11
                      Originally posted by geoffw123 View Post
                      Hi Nick

                      Yes a webpage giving a newbie programmer an introduction to Betfair and betting would be useful for quite a few people I think.

                      I am far from an expert on the subject but would be able to write some of it. On your Rollbback question I am hazarding a guess you might have meant "Rollup" ? Am I correct ?

                      I would be struggling to explain rollup options on the Betfair API myself without researching it a bit.

                      I need to tackle the relatively new BF each way market soon too, that isnt simple for a newbie either. Wish I could read a well written explanatory article on that too !

                      Geoff
                      It would be nice if I could explain my use of the term "rollback" with an intelligent answer but unfortunately </rant> mode was in the ON position while typing that tirade. So yes, I did mean "rollup" and I'm still pretty hazy on what it means for bookmaker and prices in gambling exchanges.

                      I duckduckgoed it and came up short, but did find a great recipe for strawberry fruit leather, so it's not all bad.

                      Comment

                      • betdynamics
                        Junior Member
                        • Sep 2010
                        • 534

                        #12
                        Rollup just means that certain items are combined.

                        For example:

                        Let's imagine that I want to bet on a horse with a £50 bet.

                        The three best odds on the market (and money available) are:

                        3.00 (5.00)
                        2.98 (5.00)
                        2.96 (40.00)

                        If I placed my £50 bet it could not be fully matched at the current best market prices as there is insufficient money available.

                        However, if I had instructed the API to use a Min Rollup Stake of £50, then the API will return the best odds that would fulfil the required bet. So, in this case, the best market odds would be returned as 2.96 (it takes into account the money available at 3.00, 2.98 and 2.96 and says a £50 bet would be matched if placed at 2.96)

                        With the Min Rollup Stake set to £50, the odds retrieved from the market may well look like:

                        2.96
                        2.92
                        2.88

                        You can see this on the Betfair Exchange website, as there is a little slider at the bottom of each market page that allows you to change the rollup stake value. Sliding this will change the odds that are displayed.

                        In other cases, rollup means that the returned information is combined to give you an answer.

                        For example:
                        I could request the outcome of a single bet and it would be supplied.
                        However, if I wanted the outcome of all bets on a market, then the outcome of each bet would need to be "rolled-up" to give the required answer.

                        Comment

                        • StefanBelo.
                          Junior Member
                          • Jan 2009
                          • 105

                          #13
                          Originally posted by Nick JD View Post
                          This raises an issue I think could be I'm still not sure what ROLLBACK actually means .
                          You can see rollupModel/rollupLimit in action, here:

                          SetBetView feature
                          betfair bot platform, bfexplorer bot sdk

                          Comment

                          • Nick JD
                            Junior Member
                            • Jan 2015
                            • 47

                            #14
                            Originally posted by betdynamics View Post
                            Rollup just means that certain items are combined.

                            For example:

                            Let's imagine that I want to bet on a horse with a £50 bet.

                            The three best odds on the market (and money available) are:

                            3.00 (5.00)
                            2.98 (5.00)
                            2.96 (40.00)

                            If I placed my £50 bet it could not be fully matched at the current best market prices as there is insufficient money available.

                            However, if I had instructed the API to use a Min Rollup Stake of £50, then the API will return the best odds that would fulfil the required bet. So, in this case, the best market odds would be returned as 2.96 (it takes into account the money available at 3.00, 2.98 and 2.96 and says a £50 bet would be matched if placed at 2.96)

                            With the Min Rollup Stake set to £50, the odds retrieved from the market may well look like:

                            2.96
                            2.92
                            2.88

                            You can see this on the Betfair Exchange website, as there is a little slider at the bottom of each market page that allows you to change the rollup stake value. Sliding this will change the odds that are displayed.

                            In other cases, rollup means that the returned information is combined to give you an answer.

                            For example:
                            I could request the outcome of a single bet and it would be supplied.
                            However, if I wanted the outcome of all bets on a market, then the outcome of each bet would need to be "rolled-up" to give the required answer.
                            Perfect! Thank you. I just read the ExBestOffersOverrides part of the docs and low and behold, they suddenly make sense now you've explained it so well. I also get the whole, default 'minimum stake' rollup bit.

                            If only there were a glossary so well written I would not be this far in with such gaping holes in the workings of this exchange. At some point I'll need to try and understand starting prices and -yikes- asian handicaps, but I'm gonna leave that alone for a while.

                            Cheers fellas

                            Comment

                            • geoffw123
                              Senior Member
                              • Mar 2014
                              • 250

                              #15
                              Still having trouble with RaceStatus

                              Hi

                              I came back to work on this command, its basically working but still having one problem I don't understand.

                              I was trying to get the status for today's 15:30 race at Wolverhampton.

                              I am sending this

                              Code:
                              Endpoint: https://api.betfair.com/exchange/scores/json-rpc/v1 
                              Calling: method ScoresAPING/v1.0/listRaceDetails with args:
                              {
                              	"meetingIds": ["27615329"],
                              	"raceIds": ["27615329.1530"]
                              }
                              I get a response back containing this JSON snippet

                              Code:
                              {
                              	"jsonrpc": "2.0",
                              	"result": [{
                              		"meetingId": "27615329",
                              		"raceId": "27615329.1530",
                              		"raceStatus": "DORMANT",
                              		"lastUpdated": "2015-11-30T08:59:18.686Z",
                              		"responseCode": "OK"
                              	},
                              snipped the rest
                              However I also get the other 6 races at Wolverhampton returned.

                              Any one know why I am getting all the 7 Wolverhampton races returned in total. From the spec. it isn't that clear but seems to imply I should be able to get just the one race I ask for.

                              The response I get seems to suggest my raceIds sent parameter is correct ("27615329.1530")

                              So I cant see what I am doing wrong ? Would appreciate if anyone could suggest what is wrong here ?

                              Thanks for you help.

                              Geoff

                              Comment

                              Working...
                              X