Programming for Sports Betting

There are many areas in which programming can assist the sports trader. Automation of your trading allows you to remove emotion from your trades. An emotional trade can often be a losing trade. If your trading algorithms are profitable then they will succeed without human intervention.

Programming also permits you to trade markets in parallel thus allowing for a scaling up of your trading. Why trade only one market at a time when you can be trading and profiting from many markets simultaneously?

Listed here are areas in which programming can automate and assist the trader.

  • Manual trading
  • Automated trading
  • Web Scraping for data
  • Quantitative Analysis

Manual Trading

There is much third party software to assist the manual trader as listed in the Trading Software section of this website. However, you may want to progam your own software if you have security worries about third party software or wish to prevent your proprietary algorithms from reaching the public domain.

You can read more about programming your own software in Write Your Own Betfair Software

Automated Trading

As your skill as a trader improves you will want to scale up your trading through automation. A manual trader can only effectively trade one market at a time. By automating your trading, a bot can perform simple and/or repetitive tasks allowing the trader to free up time to trade on multiple markets with the possibility of increased return on investment.

Areas of automation include the following

  • Machine access to betting markets using price gathering and trading bots. 
  • Gathering of sports data from web sites by way of web scraping. 
  • Charting of time series data.
  • Pricing algorithms for determining fair odds. (See also Sports betting arbitrage)
  • Trading algorithms for routing trades to the exchange/bookmaker with the best price. Algorithmic Trading

Web Scraping

Although prices can easily be obtained through the betting exchange or bookmaker's website there maybe additional data that you require and for which there is no API to assist you. In horse racing there are many online publications where you can download race data for previous races. The Racing Post is one such site. Through use of RegEx or serialization it is possible to download a page from an online source and parse it into a database. (More on this to follow)

Quantitative Analysis

When you have collected your data you will want to analyse it to generate trading rules. Software for analysis could simply be a spreadsheet, to more mathematical software such as R. Programming in VBA can enhance the capabilities of Excel. The quant can also develop software such as a Monte Carlo simulator for simulating sports event prior to them taking place or develop software utilising machine learning techniques to discover trading rules. (More on this to follow)

Further Reading

I recommend the following texts

A guide to creating sports trading applications with API-NG. This book teaches you how to build sports trading applications, from gathering prices to placing bets into Betfair's exchange. The reader is also taught how to build a database of prices and volume for offline analysis, automating Betfair charts and a brief look at advanced techniques; trading indicators, volume weighted average price, arbitrage, machine learning, Monte Carlo methods and more.

A complete telling of one man's modelling of the sport of Jai Alai and his profitable automated betting on the sport. Full Review