Retrieving Betting Summary Volume, using Java Sample Code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chase788
    Junior Member
    • Jul 2014
    • 4

    #1

    Retrieving Betting Summary Volume, using Java Sample Code

    Hi,

    I am trying to piece this together step by step. I am trying to retrieve the Betting Summary Volume field in the events.

    Total matched on this event: 70,451
    Betting summary - Volume: 66,238

    So I am starting with the sample Java code: https://github.com/betfair/API-NG-sa...ee/master/java

    I am trying to retrieve football matches, this eventTypeID is always 7, which is horse racing. How can I edit this eventTypeID to football? I tried looking into the different folders but cannot the field to change to football. Thank you all!

    Code:
    List<EventTypeResult> r = jsonOperations.listEventTypes(marketFilter, applicationKey, sessionToken);
                System.out.println("2. Extract Event Type Id for Football...\n");
                for (EventTypeResult eventTypeResult : r) {
                    if(eventTypeResult.getEventType().getName().equals("Horse Racing")){
                        System.out.println("3. EventTypeId for \"Horse Racing\" is: " + [COLOR="Red"]eventTypeResult.getEventType().getId()[/COLOR]+"\n");
                        eventTypeIds.add(eventTypeResult.getEventType().getId().toString());
                    }
                }
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    Change

    Code:
    if(eventTypeResult.getEventType().getName().equals("Horse Racing")){
    to

    Code:
    if(eventTypeResult.getEventType().getName().equals("Soccer")){
    and change

    Code:
    System.out.println("3. EventTypeId for \"Horse Racing\" is: " + eventTypeResult.getEventType().getId()+"\n");
    to

    Code:
    System.out.println("3. EventTypeId for \"Soccer\" is: " + eventTypeResult.getEventType().getId()+"\n");

    What this code is doing is getting the EventTypeId that is associated with Horse Racing, so you need to change it to Soccer so that the correct EventTypeId is returned.

    Comment

    • chase788
      Junior Member
      • Jul 2014
      • 4

      #3
      Thanks a lot. I did try this before posting, but it does not work.

      If I change to soccer, the output is still horse racing.

      Code:
                  System.out.println("2. Extract Event Type Id for Soccer...\n");
                  for (EventTypeResult eventTypeResult : r) {
                      if(eventTypeResult.getEventType().getName().equals("Soccer")){
                          System.out.println("3. EventTypeId for \"Soccer\" is: " + eventTypeResult.getEventType().getId()+"\n");
      
                          eventTypeIds.add(eventTypeResult.getEventType().getId().toString());
                      }
                  }
      Now the eventType shown is 1 instead of 7.

      However, there are more java errors, maybe there is some mismatch due to the data type between Horse Racing and Soccer.

      D:\Markets\java\ng>mvn exec:java -Dexec.mainClass="com.betfair.aping.ApiNGDemo"
      -Dexec.args="hSVZxnWPsp9ccO8x hGmrs0XmydrTLb5GITxL5ys+MrcxzFKW6Taj4PQLWh4= json-
      rpc"
      [INFO] Scanning for projects...
      [WARNING]
      [WARNING] Some problems were encountered while building the effective model for
      com.betfair:aping:jar:0.1-SNAPSHOT
      [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
      iler-plugin is missing. @ line 19, column 21
      [WARNING]
      [WARNING] It is highly recommended to fix these problems because they threaten t
      he stability of your build.
      [WARNING]
      [WARNING] For this reason, future Maven versions might no longer support buildin
      g such malformed projects.
      [WARNING]
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building api ng sample code 0.1-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- exec-maven-plugin:1.3.1:java (default-cli) @ aping ---
      [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment
      on MEXEC-6.
      Welcome to the Betfair API NG!
      1.(listEventTypes) Get all Event Types...

      2. Extract Event Type Id for Soccer...

      3. EventTypeId for "Soccer" is: 1

      4.(listMarketCataloque) Get next horse racing market in the UK...

      5. Print static marketId, name and runners....

      [WARNING]
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.
      java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAcces
      sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJava Mojo.java:293)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.rangeCheck(ArrayList.java:638)
      at java.util.ArrayList.get(ArrayList.java:414)
      at com.betfair.aping.ApiNGJsonRpcDemo.start(ApiNGJson RpcDemo.java:82)
      at com.betfair.aping.ApiNGDemo.main(ApiNGDemo.java:11 0)
      ... 6 more
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 5.428 s
      [INFO] Finished at: 2014-07-15T07:30:39+08:00
      [INFO] Final Memory: 11M/26M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.1:java (d
      efault-cli) on project aping: An exception occured while executing the Java clas
      s. null: InvocationTargetException: Index: 0, Size: 0 -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
      ch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please rea
      d the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/d...MojoExecutionE
      xception
      I will go poke around too. If anyone knows, please give a shout.

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #4
        You asked how to get the EventId for Football (Soccer) and that is now what the program is doing. This is evidenced by the fact that the program returns the EventId as 1.

        You still need to modify step 4 as it is geared towards Horse Racing.

        For example, in step 4 there is no "WIN" market for Football matches. If you want to load the Match Odds market then change:

        Code:
        typesCode.add("WIN");
        to

        Code:
        typesCode.add("MATCH_ODDS");
        I can't help with your build issues as I don't actually use Java myself.
        Last edited by betdynamics; 15-07-2014, 10:46 AM.

        Comment

        • chase788
          Junior Member
          • Jul 2014
          • 4

          #5
          Thank you. I will try your suggestion.

          Comment

          • chase788
            Junior Member
            • Jul 2014
            • 4

            #6
            Hi,

            I changed the typesCode value to MATCH_ODDS and it works. But I do not know to proceed. For example, I want to retrieve today's matches, Win Lose Draw odds and total matched on this event (Win. Lose or Draw), and according to a keyword search "Bundesliga" or "Champions League".

            The current output is:
            3. EventTypeId for "Soccer" is: 1

            4.(listMarketCataloque) Get next horse racing market in the UK...

            5. Print static marketId, name and runners....

            Market Name: Match Odds; Id: 1.114615088

            Runner Name: Boreham Wood; Selection Id: 256120

            Runner Name: Brentford; Selection Id: 78864

            Runner Name: The Draw; Selection Id: 58805

            6.(listMarketBook) Get volatile info for Market including best 3 exchange prices
            available...

            [INFO] ------------------------------------------------------------------------
            [INFO] BUILD SUCCESS
            [INFO] ------------------------------------------------------------------------
            [INFO] Total time: 6.615 s
            [INFO] Finished at: 2014-07-17T16:32:55+08:00
            [INFO] Final Memory: 12M/85M
            [INFO] ------------------------------------------------------------------------
            D:\Markets\java\ng>
            Hence, it seems that the latest match (marketID is 114615088) in UK which is Boreham vs Brentford is being displayed.


            I am trying to link things up together. Where can I find the list of related soccer values or variables?

            I looked at the documentation (https://api.developer.betfair.com/se...arketCatalogue), but I still find this confusing.

            Is there is simple diagram that marks out the soccer variables?

            Thank you.

            Comment

            Working...
            X