This is a partial implememtation of the Betfair API for clojure.
In general, this api follows the naming and arguments that are described in the betfair API documentation (pdf). That document describes all the api calls available and the data-structures returned.
This wrapper doesn't implement the full API - several API calls are different ways of getting the same information, in which case we only implement on of them - but it implements a fully functional subset. There is enough of the api implemented to build a full market trading bot for betfair - reading markets, tracking prices, placing and cancelling bets.
The list of methods that are implemented are:
See the betfair documentation for descriptions of each of these methods. There are also some higher level functions for interacting with betfair. Check the source for details.
To use this library, you'll need to install the betfair java api demo. It's not on clojars, so you'll need to install it manually into your local maven repository. It's included in this repo for convenience.
- Clone this repo.
- Install APIDemo.jar into your local maven repository
- Install dependencies.
- Generate the betfair-lib jar
- Install it into your local maven repository.
git clone email@example.com:aidanf/betfair-lib.git cd betfair-lib mvn install:install-file -Dfile=./extras/APIDemo-1.0.jar -DgroupId=com.betfair.api -DartifactId=APIDemo -Dversion=1.0 -Dpackaging=jar lein install
There are quite a few dependencies (all from the betfair jar). Somethimes lein can't find them all online, in which case you'll need to track them down yourself and manually install them into your local maven repository.
In your project.clj file add the dependency
Then authenticate with betfair and start calling API methods.
;; Authenticating with global context (login "username" "password") (println "Balance: " (get-balance))
To see the full list of methods check out the betfair api documentation linked above or read the files global.clj and exchange.clj.