Java Sample Code [Updated 14/07/10]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • forumbdpwebadmin
    Forum Administrator
    • Sep 2008
    • 26

    #1

    Java Sample Code [Updated 14/07/10]

    This demonstration of the basics of using the Betfair Web Services API has been created using the Apache AXIS library. The latest version of this library has been bundled into the download. Required Software: Java 5 or later and Apache Ant 1.7 or later. Check the README file for build instructions. Updated with the correct endpoint URLs and now sends accept-gzip header in the request.

    API 6 Java Sample.zip

    Update: The download now contains a copyright license.
  • MarkL
    Junior Member
    • Oct 2008
    • 29

    #2
    New Version Released

    Hi,

    I've posted a new version of the Java Sample that includes a new class to parse the response from getCompleteMarketPricesCompressed.

    It is based on the testing release I posted last week.

    The only changes from the testing version are to the display class to clean up the formatting of the sample output.

    The Java Sample can be downloaded from the same link above.

    Cheers,
    Mark

    Comment

    • MarkL
      Junior Member
      • Oct 2008
      • 29

      #3
      Another new version

      I've updated the Java sample to build with (and include) axis2 version 1.5.1.

      This is the latest version on the axis2 site and hopefully fixes a couple of bugs people have reported.

      If you want to change the version of axis2 yourself, it's not too hard. Just copy the new version of axis2's lib directory into the project lib directory and run 'ant stubs' to rebuild the SOAP proxy classes.

      Between axis2 1.2 and the current version, the names of the classes for placeBets, updateBets and cancelBets changes slightly so you'll need to update the wrapper classes to handle that change. But, it's pretty obvious what you need to do.

      Comment

      • gus
        Senior Member
        • Jan 2009
        • 134

        #4
        Do you have a wrapper for cancelBetsByMarket ?

        for the life of me i can't figure out how you add MarketIds to the ArrayOfInt

        Comment

        • gus
          Senior Member
          • Jan 2009
          • 134

          #5
          ok, problem solved:

          set_int

          ho hum

          Comment

          • MarkL
            Junior Member
            • Oct 2008
            • 29

            #6
            New Version Released

            Update 14/07/10: This version fixes a long standing bug in the Choose Market function where when displaying events that contained both events and markets, only the markets would be displayed.

            Comment

            • PLV
              Junior Member
              • Feb 2010
              • 12

              #7
              is updating correct?

              Hi Mark,

              I have one question regarding your code. I play with it a bit and I managed to create a function which is calling the viewMarket every 300ms after I have selected a market. But then I am also online on Betfairs site to see if everything is correct, and sometimes it seems the viewMarket is printing wrong values, or they are updating after few secs. Do you have any idea why is this happening?

              Thanks,

              Comment

              • MarkL
                Junior Member
                • Oct 2008
                • 29

                #8
                Hi,

                It's most likely you're seeing the cross-matched prices that the Website calculates and displays.

                Here's some more information:
                http://bdp.betfair.com/index.php?opt...=242&Itemid=68

                Comment

                • PLV
                  Junior Member
                  • Feb 2010
                  • 12

                  #9
                  hi Mark and thanks for the reply.

                  So actually the API doesnt support the cross matching feature. I read also about the algorithm that helps you be inline with the Website. But I dont understand how is possible to apply this algorithm on my side? Because I dont have the info Betfair has regarding the bets, so is almost impossible to be inline. Am I correct or I am missing something?

                  Regards,

                  Plv

                  Comment

                  • MarkL
                    Junior Member
                    • Oct 2008
                    • 29

                    #10
                    Hi,

                    Just to be clear, the API does not return the "virtual" prices, but if you submit a bet at a virtual price, it will be matched.

                    I'm not sure what you mean about not having all of the info about Bets. The virtual prices are calculated from the actual prices (that the exchange does return). Using the algorithm detailed in http://bdp.betfair.com/index.php?opt...=237&Itemid=68, you can recreate the prices that the website displays.

                    Comment

                    • PLV
                      Junior Member
                      • Feb 2010
                      • 12

                      #11
                      Hi Mark and thanks again for the answer.

                      I was confused with the virtual bets, but now everything is fine.


                      Regards,

                      Plv

                      Comment

                      • Tomba22
                        Junior Member
                        • Jun 2014
                        • 1

                        #12
                        Hi,

                        I'm a beginner programmer and I'd really like to take a shot at making a program with betfair API. As such a complete sample code would be extremely helpful, unfortunately however the links in this thread do not work. Is there anyone who can help me out by posting samples that do work? I would really appreciate it. Thanks.

                        Comment

                        Working...
                        X