|Tuesday 19th February 2019|
FREE gift schemes
Betfair Bots (API-NG)
Betfair API: SSL Certs
Linux: Botting Setup
WARNING: the following information assumes that you are fluent in the Python programming language. This page is NOT for newbies!
Using the Betfair API-NG with Python
Python is the chosen language for development for many reasons:
The new API-NG offers a nicer interface that can be easily parsed using Python's built-in JSON library which allows us to work with the data in a standard dictionary object. If you have used my old API6 library, you will already be familiar with the use of dictionary formatted data.
Although easier to get up and running, the new API-NG does require that the user is fully conversant in programming and reference to the API-NG Reference Guide is ESSENTIAL. The reason for this is that many of the requests require user-defined parameters in the format of a dictionary. There are a significant number of parameters available, resulting in far too many combinations to be able to "dumb it down" to simple Python functions. My Python API-NG library attempts to make this more user friendly, however you WILL need to understand how the API-NG works in order to use it to its full potential.
Having said all that, the API is quite nice once you are familiar with it and gives us much more control over what data we receive from the Betfair servers. It should be noted that my API-NG library is NOT compatible with API6 (which is now obsolete), so if you have bots using API6, they will need to be completely re-written for API-NG.
Betfair have increased security and API users now require self-signed SSL certificates as well as their username and password in order to login and use other secure functions. Creation of the SSL certificates is a bit of a PITA, however it is only a one-off operation per betfair account. Please see my tutorial:
Betfair API-NG: Creating SSL Certificates For Login
You will also need to create an "Application Key" which will identify your bot to the Betfair servers. Instructions for both of these operations are detailed in the sample code (download below) README.txt and Betfair's documentation, so I will not repeat them here.
Once you have your SSL certificates and Application Keys, you will be able to start bot development. To get you started, here is a simple Python "Gubbins" bot that will:
Please ensure you setup the bot before attempting to run it. Details on how to do this are in the README.txt file included in the download.
NOTE: This API-NG library has now been heavily tested and can be considered as a STABLE release.
The library is developed under Python 3.2 but is compatible with Python 2.7+.
API Library and Example Bot: gubbins-ng.zip (May, 2015)
API Library ONLY: api-ng.zip - V0.10 (April, 2017) changelog.txt
BespokeBots Betfair API-NG Library by Birchy is licensed under:
Creative Commons Attribution-NonCommercial 4.0 International License.
©2008 - 2019 BespokeBots.com. All Rights Reserved.