|This is an update about the project Adam and Ryan are working on about Betfair Trading Bots. Where Adam is working with Ryan to see if all of Ryan’s trading can become fully automated.
Yes you read that right, we can automate all of Ryan’s Betfair Trading with a bot! You see Adam’s Trading on Betfair has been automated for years with the help of a bot he built, Ryan’s says that automated trading is the future of Betfair Trading and that’s a hill he will be prepared to die on.
If you want to read the start of this story and why Ryan stopped trading on Betfair – Click Here
We’ve been getting lots of technical questions about this, which I’m probably best-placed to answer. I also wanted to weigh in on my side of the project and talk about why I was interested in it, what challenges it posed, etc.
Feel free to reply with any questions. This first one from me will probably be about a 5 minute read, but I’ll try and waffle less in subsequent posts
When we launched the horse racing software, I was surprised by how many people were trying to link it up with automated trading software. I wrongly assumed that most people would be using it to backtest their ideas and then using the qualifiers list to plan their manual trading days.
Lots of people are doing exactly that, but lots of others wanted a seamless way to export the qualifiers we gave them into their own bots. We already had a CSV export function, which is fine as a basic thing, but we soon also added a personalised URL where your qualifiers get published, which you can import directly into the automation software of your choice. This is ideal for software like BFBotManager, which allows you to import qualifiers from a URL. We’re also working towards fully-fledged API connections with 3rd party software that offers that, like BetAngel.
Sticking with BFBotManager for a moment, as that seems to be the most popular amongst our members, BFBM doesn’t just blindly trade whatever selections we send over from our software. There will always be some config to be done on the bot side, because whether or not you trade a particular selection at a particular time depends on things that change in potentially millisecond intervals, primarily the market prices.
Those of you who have used our software will know that the strategy builder has a “Horse Selection Rules” section and a “Betting Rules” section. By and large, the horse selection rules are the more fundamental rules that don’t really change throughout the life of the market (course, race type, etc). There are a few exceptions like number of runners, going etc which can change fairly infrequently:
The Betting Rules section contains the ever-changing variables like price ranges, traded amounts, entry times, etc:
By and large, the horse selection rules tell the software WHAT you want to trade, and the betting rules tell it HOW you want to trade those selections.
Currently, the way we handle our automation integration is to generate a qualifiers list based on the horse selection rules and publish those, for you to import into the bot software of your choice.
So basically, we create a list of potential qualifiers based on the fundamentals of your strategy, and you then recreate the betting rules in your bot software, as it’s not currently feasible for us to be updating your qualifiers list 5 times per second every time the prices change and then sending those updates to various different bot softwares!
Dedicated trading software is much better placed to track price changes and choose whether or not to place the trades based on those price conditions.
This means people need to faithfully recreate their betting rules from our software in BFBM, to ensure their strategy behaves the way it did in the backtesting scenarios created in our software.
We had several months of discussion with users regarding differences between the backtesting simulation and the trades they were actually placing in their bots. People understandably wanted the backtesting to match the trades they were actually placing, otherwise how could they trust that the backtesting was accurate?
We made some big changes to the betting rules based on this work and I believe the difference margin between the simulations and live trading is now negligible. This is excellent, because if you think about it, the backtesting is only telling you which prices were hit at different times in the life of the market at a general level, i.e. “SOMEONE got this price at this time”.
That doesn’t necessarily guarantee that YOU will achieve that price.
Imagine if Apple had a sale on iPad Pros and offered 10 units for half price (admittedly a ridiculous scenario, but I like to dream ).
Persons 10 and 11 could both be in the same queue at the same time trying to buy one, but once the 10th is sold, person 11 is going to be paying full whack or changing their mind. It’s still true to say SOMEONE was able to buy at that better price.
It’s the same way with backtesting. We can only tell you the facts of what happened in the market at the time, with the caveat that it may not be you getting those prices in real life. So I’m very pleased that it’s proving to be so accurate.
All that preamble brings me to some of the reasons why I was keen to work on a bot of our own design with Ryan. It gives us a good opportunity to explore tighter ways of integrating our software with 3rd party trading software:
Maybe we can create some formatters for the betting rules that automatically convert them to the right format for BFBM, so people don’t have the job of replicating that informationMaybe we can have a more “live” link where the trading software pulls directly from our API when it knows it’s time to place tradesWe can test the accuracy of the backtesting algorithm ourselves in endless situationsAdditionally, because my own trading has been fully automated for many years now, this gave us some other opportunities.
I created Ryan’s bot using the same framework as my own and loaded the same strategies into it. You’d expect them both to place the same trades at the same time, but would they…?
Well for starters, because Ryan’s only just started using Betfair’s API, we started testing using the free “delayed” API key provided by Betfair. The limitation with this is that there’s a random delay to price updates of between (I think) 10 and 180 seconds.
We were interested in seeing whether this would be viable to use for anyone just starting out developing their own bots. If it was possible to at least make a bit of money using the delayed key, at least that would pay for the live key (currently a one-off cost of £300, paid to Betfair) and that reduces the barrier to entry for any budding Betfair developers.
In short (and probably as expected), it’s not really viable at all. Pre-race set and forget stuff where the bets are placed a while before the race were fine, as the prices aren’t changing too much too often. But the closer you get to the race, the more “busy” the prices get and before you know it, your bots is placing bets based on prices from 3 minutes ago.
The differences between the bets placed by my bot on the live key and his on the delayed one were comical. Any strategy involving an exit was out, obviously especially in-play.
So unfortunately, if you’re looking to create your own bots for Betfair, you need to spring for the live API key pretty early on and hope that you make the cost back. Once Ryan’s live API key is sorted, we’ll carry on and share the results. In the meantime, I’m playing with some different ways of integrating the BTC horse racing software with my end of the bot, to try and find the optimal way of keeping qualifiers up to date on both sides.
One of the challenges we have is that to provide quick access to each person’s daily qualifiers, we have to basically run everyone’s active strategies in the background constantly and update the qualifiers lists. Currently this happens once every half hour or so, but it would be nice if 3rd party software could say “hey, give me the bang-up-to-date qualifiers list for Ryan’s strategy, and run this on demand”. So that’s how our bot is currently set up, so we can find a viable way of making that work for hundreds of requests in parallel.
I’ll stop the storytime there. Consider yourself a hero if you’ve got to this point!
Some quick Q&A based on emails we’ve had so far:
How do I get a live API key for Betfair?
Unless you’re literally coding your own Betfair apps from scratch, you don’t need one. If you’re using commercially available software like BetAngel and BFBM you already effectively get a license to use the live API through that. If you ARE looking to create your own bots from scratch though, here’s how to get started
Is your bot publicly available?
No. We don’t currently have any plans to release any commercial trading / bet placement software. For now, we’re focusing on helping you find the opportunities, rather than the execution of the trades.
We also built a FREE newsletter where we go in depth about this with Both Ryan & Adam, if you want to get on that list then get your spot here>> https://news.betfairtradingcommunity.com/