Posts Tagged system
How to lay £600m worth of bets on Betfair?
Posted by Peter Webb in Betfair on December 29th, 2011
That has to be the #1 question after yesterdays debacle in one of the feature races at Leopardstown.
To summarise, a mysterious lay bet appeared and stayed on the winning favourite at 29′s right up to the finish of the race. The ‘layer’ offered up £21m at 29′s creating a £600m liability. Betfair voided the in-running market.
Betfair have come out officially and ruled out that it was them or any account controlled by them or that they had a commercial interest in it. So it would appear it was just a common lay that created the error. But the question now shifts to who was this layer and how did they create the error? Nobody on the planet has £600m to gamble on a single runner in a race, so that points to some system quirk. There are checks in place that stop you exceeding your account balance or exposure limit, so what could jump over both those hurdles?
The amount of the Lay was curiously near the value of a 32bit binary number, slightly over if you add in additional stakes. The range of values of a 32bit binary is -2147483648 to +2147483647 which fits with the stake amount displayed on Betfair. You can create an error by forcing overflow or underflow with a calculation involving an integer, so it’s not impossible that this could be the source of the error. There is a good explanation on this link, curiously to do with customer balances: -
http://weblogs.asp.net/dvravikanth/archive/2008/03/10/integer-overflow-amp-underflow-revisited.aspx
I can’t comment authoritatively on the way that Betfair have coded their back-end, but lets just say that it’s not impossible that something like this could be the cause of the error. It could be that the exposure calculation is done using an integer and this layer just fluked it somehow. If it is something like this, then I am pretty sure an arms race is already underway to exploit it. The ability to force a voided market is potentially quite valuable, so Betfair should announce what the error is and what they are going to do to solve it, immediately. The person who placed the bets knows what created it, so that layer is hot property at the moment!
By quoting terms and conditions to void the market, people were quick to spot contradictory terms that stated that in the event of a bet exceeding agreed exposure all bets will stand, whoops! You can find the clause under section 9. Has Betfair has possibly opened themselves up to a legal issue?
I get the feeling this story is going to rumble on for a fair bit. But I sense we are nearer an explanation.

Leonhard Euler proved in 1772 that 2,147,483,647 was a prime number
Accidents and evolution (Part three)
Posted by Peter Webb in Bet Angel on February 24th, 2011
Never one for rhetoric; I presented a similar case, to those I have described in the prior posts, at a talk I did last year. Using a similar model we followed how that can evolve from a base set of criteria and environments to something more complex. The following two snap shots are from a control where we work at random and an evolved model a few generations on.

Here we are using £2 at random

Here we use an evolved model
I reckon I could replicate the performance of the two at an pre-determind date. But some of the performance will always be reliant on prevailing market conditions, but it’s the gap in performance that is the most interesting. The second benefits from picking the ‘right’ market, direction and exit models. It was only by studying why one performed better than the other that I was able to fully understand the reason and why that was important. You can then use than to hone other strategies.
Of course there an infinite amount of variables, so you need to point it in roughly the right direction. If you don’t know the direction, then do a binary chop to get there quicker. You also have the issue of course that the market can and will change. We recently saw the introduction of cross matching across many sports and that has changed the ‘environment’ to the point where I am sure some strategies have started to fail. This in turn will alter the behaviour of those people who are trying to avoid becoming dinosaurs. Sometimes however accidents in evolution produce strange results. On more than one occasion I’ve made an error on a spreadsheet and it has failed to do something I wanted. That in turn though created some unusual payoffs which lead me down paths I hadn’t considered exploring. Just another path on the road of evolution.
So while using a genetic algorithm is a useful trick, evolving doesn’t stop, it continues ad infinitum. If you stop evolving you may appear in the betting exchange equivalent of the natural history museum in a few years time.
Accidents and evolution (Part two)
Posted by Peter Webb in Bet Angel on February 23rd, 2011
So how did my view on evolution, natural selection and Darwin translate into market strategy?
There are many ways to apply it, but first you need to start. Your first strategy is to have no strategy, just poke around at random. This gives you a control sample to work with, a base metric from which you can build your activity. You should regularly revisit your control to ensure the base you are working from is still the same as when you started.
Next you need to decide the environmental factors. In the case of the market, when do you open a position, when do you close and what do you use to judge that? Could it be the market type, the price, the time? You could have a number of factors that tell you if a market is ‘right’ or is adequate for your participation, these define the environment in which you will work.
Next you need to decide exactly what your entry and exit points are. Start simple and build out from there. It will be fairly obvious, fairly quickly where things are not working and you can ‘kill’ off these experiments. After each life cycle of experiments carry forward the successful ones and add in some new variations for the next generation. It’s surprising how quickly you ended up with a much better understanding and a much better strategy. It’s not just the entry and exit that are variables the environment is also, don’t forget that.
It would be nice to say ‘That’s it’s’ but that is rarely the case. You have to remember that the market itself evolves and people in the market occupy certain niches. You need to find a niche but also compete with people who may already be present in that niche. Your activity in the market will also shape the environment, so that in itself produces a response from the environment. One failure of market participants is to fail to evole a strategy, every strategy has its moment but many people find, often by accident, something that works; from that point it starts slipping away. The general reason is that your activity has probably forced others to evole and so the whole things rolls on again but also a lot of participant never work out why what they did works. I am always restless for understanding.
More reading: -
Accidents and evolution (Part one)
Posted by Peter Webb in Bet Angel on February 22nd, 2011
Some time ago, when I was young, I was accosted by somebody on the streets of Guildford. He was trying to challenge my view of the world and get me to sign up to their cult or something. He followed me down the street and asked me if I really believed the world, everything we see, was created by accident. Without hesitation I replied, YES!
When I was young I had asked myself the same question. So I went to the library and started to read up on the theory of evolution to try and understand if there was some simple scientific logic at how you could arrive at something so complex from something so simple. I found my answers and wrote some simple code to see them in action. The code basically started with something white and introduced some Darwinian variables such as mutation and predation and I studied how it turned from white to black over several generations. I change the environment to test how that affected the evolution.
To this day I use these principles when working through a system, process or problem. Evolution does, eventually, provide a solution even if you don’t have a clue when you start out. Have a look at what you are doing and see if these principles can apply to what you are trying to achieve. People often talk about neural nets in trying to find an edge in the markets, but I have found a bit of Darwin a much more viable and logical solution.

