Bookmaker SDK short introduction and tutorial

Intro

For more details check SDK's javadoc

Configuration

In your sdk.properties you need at least to set-up the following: (replace xxx with actual credentials).

sdk.livescout.enabled=true sdk.livescout.username=xxx sdk.livescout.password=xxx sdk.lcoo.enabled=true sdk.lcoo.username=xxx sdk.lcoo.password=xxx sdk.liveodds.enabled=true sdk.liveodds.bookmaker_id=xxx sdk.liveodds.bookmaker_key=xxx sdk.liveodds_vfl.enabled=false sdk.liveodds_vfl.bookmaker_id= sdk.liveodds_vfl.bookmaker_key=

A complete list of properties and their defaults (when appropriate) can be found here sdk.properties

SDK will throw MissingPropertyFileException if sdk.properties file is not found

SDK will throw MissingPropertyException if any mandatory property is missing from the properties file

SDK will throw InvalidPropertyException if any property written in properties file is malformed

For more configuration options please refer to the sdk.properties.all file in example project

Bookmaker SDK is a singleton. There should be only one SDK instance per process. When using multiple processes avoid running multiple SDK instances, especially if the same access credentials are used. You may end up in an inconsistent state and get problems due to limits on the server side. Use IPC instead in such cases.

Example of SDK usage

final Sdk sdk = Sdk.getInstance(); final LcooFeed lcooFeed = sdk.getLcoo(); final LiveOddsFeed liveOddsFeed = sdk.getLiveOdds(); final LiveOddsFeed liveOddsVflFeed = sdk.getLiveOddsVfl(); final LiveScoutFeed liveScoutFeed = sdk.getLiveScout(); final OddsCreatorFeed oddsCreatorFeed = sdk.getOddsCreator(); //All listeners listed here are your own implementation final LiveOddsFeedListener oddsFeedListener = new LiveOddsFeedListenerImpl(); final LiveScoutFeedListener scoutFeedListener = new LiveScoutFeedListenerImpl(); final LcooFeedListener lcooFeedListener = new LcooFeedListenerImpl(); if(liveScoutFeed != null){ liveScoutFeed.open(scoutFeedListener); } if(liveOddsFeed != null){ liveOddsFeed.open(oddsFeedListener); } if(liveOddsVflFeed != null){ liveOddsVflFeed.open(oddsFeedListener); } if(lcooFeed != null){ lcooFeed.open(lcooFeedListener); } if (oddsCreatorFeed != null) { try { System.out.println("Listing all sports :"); for(IdNameEntity sports : oddsCreatorFeed.getSports()){ System.out.println(sports.getName()); } } catch (OddsCreatorException e) { e.printStackTrace(); } } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("The sdk is running. Hit any key to exit"); try{ reader.readLine(); } catch(IOException e){ e.printStackTrace(); } System.out.println("Closing the sdk"); sdk.close(); System.out.println("Sdk successfully closed. Main thread will now exit"); Note that LiveOddsFeedListenerImpl, LiveScoutFeedListenerImpl, LcooFeedListenerImpl are just implementations of the respective Listener interfaces.

SDK provider(s) will try to connect to the corresponding XML feed server and keep the connection alive. If the connection is lost the provider will try to reconnect automatically - you will be informed of this through the corresponding events.

SDK logs

SDK will make various logs during its operation. Logs are organized into various categories, based on whether these are critical alerts, invalid messages received, configuration updates, message traffic, etc. Level of logging can be configured through sdk.properties. All logger settings are listed in sdk.properties.all.

Gotchas

SDK generates implicit "bet stop" message after disconnect and does automatic error recovery. It does however not keep track of bet clearings!
If you are disconnected for a long time it may happen that after you come back the match is already over. In that time-frame bets were not accepted (so you are safe) but it might still be necessary to clear the bets placed at the begining of the match. In that (rare) case you it is up to you to invoke GetMatchStatus method to obtain bet clearings to do correct pay-outs (if / when required).

If match is suspended or cancelled you will receive onMetaInfoReceived and see the change periodically in onAliveReceived as AliveEntity.getEventHeaders().getStatus()
But again you can be disconnected too long and miss that. So same logic as before applies, you need to be sure to do some sort of "garbage-collection" and delete stale matches.

SDK never generates implicit "bet start". You should not rely on onBetStart to start accepting bets again but check EventHeaderEntity.getBetStatus() (also from instance of OddsChangeEntity)!