Skip to end of metadata
Go to start of metadata

As well as sample code developed by Betfair, this page allows you to find sample code or documentation prepared by members of the Developer Program community. 

If you would like to contribute to this space, please contact Developer Support

All Betfair developed sample code follows a typical work flow:

  • Find the next UK Horse Racing Win market
  • Get prices for the market
  • Place a bet on the market 
  • Handle the error returned by the API when the bet fails as it is below the minimum stake size.

Please Note: In order to aide ease of understanding, the basic Betfair samples are not intended to show certain best practices for speed and throughput. Well designed applications should follow the best practices for client design of the application/language platform and should optimise on an HTTP request level with features such as requesting gzip'd responses and http connection keep alives. Please see Optimizing API Application Performance for further details.

Sample Code

The following samples are currently available:

LanguageDocumentationAvailable FromDescriptionDeveloped By
JavaDescriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/javaSample Code for JavaBetfair
JavascriptDescriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/javascriptSample Code for Node.jsBetfair 
PythonDescriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/pythonSample Code for PythonBetfair 
PHPDescriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/phpSample Code for PHPBetfair 
Excel/VBADescriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/vbaSample Code for Excel/VBABetfair 
C#Descriptionhttps://github.com/betfair/API-NG-sample-code/tree/master/cSharp Sample Code for C#Betfair 
CurlDescription https://github.com/betfair/API-NG-sample-code/tree/master/curl Sample Curl RequestsBetfair
Perl https://github.com/betfair/API-NG-sample-code/tree/master/perlSample Code for PerlBetfair
Delphi https://github.com/jamiei/Betfair-API-NG-SampleSample Code for DelphiCommunity member - jamiei
Clojure https://github.com/jamiei/betfair-aping-sampleSample Code for ClojureCommunity member - jamiei

Client Libraries & Sample Applications

 

Language
Available From
Description
Developed By
C#https://github.com/joelpob/betfairngAPI-NG Client Library for c#Community member - joelpob
Javahttps://github.com/joelpob/jbetfairngCleint library for JavaCommunity member - joelpob
Excel/VBAhttps://github.com/betfair/API-NG-Excel-ToolkitExcel Sample Spreadsheet ApplicationRobin Barrett
Delphihttps://github.com/betfair/API-NG-Delphi-ClientAPI-NG Client Library for DelphiCommunity member - khughes
Javascripthttps://github.com/AlgoTrader/betfairAPI-NG Client Library for Node.jsCommunity member - Algotrader
Perlhttps://github.com/MyrddinWyllt/WWW-BetfairNGPerl Library for API-NGCommunity member - Merlin
PHPhttps://github.com/danieledangeli/betfair-phpAPI-NG Client Library for PHPCommunity member - daniele8805
Rubyhttps://github.com/mikecmpbll/betfairRuby wrapper for API-NGCommunity member - mikecmpbll 
Pythonhttps://github.com/jmcarp/betfair.pyPython wrapper for API-NGCommunity member - jmcarp
Pythonhttps://github.com/liampauling/betfairlightweightLightweight python wrapper for Betfair API-NG (with streaming)Community member - LiamP
Scalahttps://github.com/city81/betfair-service-ngScala sample code for API-NGCommunity member - theswan1
Rhttps://github.com/phillc73/abettorSample code for RCommunity member - phill_c
C++https://github.com/captain-igloo/greentopC++ Betfair API ClientCommunity member - plachner


Stream API

Language
Available From
Description
Developed By
C#https://github.com/betfair/stream-api-sample-code/tree/master/csharpSample application for Stream APIBetfair 
Javahttps://github.com/betfair/stream-api-sample-code/tree/master/javaSample application for Stream APIBetfai


Historical Data

 Code for processing the data provided by the Betfair Exchange historical data service available via https://historicdata.betfair.com

Language
Available From
Description
Developed By
Pythonhttps://github.com/liampauling/betfairlightweight/tree/master/examplesParse/output historical data allowing backtesting or with a custom listener, csv creationCommunity member - LiamP
Pythonhttps://underround.wordpress.com/Tutorial relating to use of the above sample codeCommunity member - LiamP


Books

Language
Available From
Description
Author
Visual Basichttp://www.amazon.co.uk/Programming-Betfair-Creating-Trading-Applications/dp/151143211XA Guide to Creating Trading Application for API-NG James Butler 

 

 

 

 

 

  • No labels