Scala project to make calls to Betfair Service NG API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Betfair Service NG

Master Build

This is a project which uses Scala, Akka HTTP and the Play JSON lib to make calls to Betfair's New Generation API ie JSON-RPC

To use the service, you'll need a Betfair username and password, and an AppKey. The config file also contains the betfair urls. These need to be placed in a file called betfair-service-ng.conf which is referenced by the application.conf file. Example configuration is below:

betfairService.appKey = "appkey"
betfairService.username = "username"
betfairService.password = "password"
betfairService.apiUrl = ""
betfairService.isoUrl = ""

Before any of the Betting API calls can be made a session token needs to be obtained and this can be done via the loginRequest method. This will cache the session token for future calls.

The ExampleBetfairServiceNG file contains the below sample calls:

list event types
list competitions
list football competitions
list all horse racing markets in the next 24 hour period
get the next UK Win horse racing market
list a market book with exchange best offers
get a market book exchange favourite
place a bet
cancel a bet

Project also includes a FootballProcessor file which parses Betfair historical files. This file can be changed to extract different data. The example extracts Premier League Match Odds records and outputs the 'at the off' odds and the longest odds matched in running.

Spray replaced by Akka-HTTP

The latest version of this project has been updated to use Akka HTTP instead of Spray. Whereas Spray had an actor based interface, Akka HTTP has an API based on Akka Streams making the development of HTTP applications simpler. Also with the bounded memory guarantee of Akka Streams you can serve HTTP results without increased resource usage.

For the previous version, checkout the Spray tag


BSD Licence - see LICENCE.txt


  1. Add the remaining betting api calls
  2. Add more convenience methods to the service API