Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For those interested in games of chance, I've been playing around with Betfair's Exchange Hi Lo card game [1]. I came up with an algorithm to, given a game state, quickly compute the odds of all subsequent outcomes in polynomial time.

Based on this algorithm, I've been building a bot [2] to integrate with Betfair's games API to play automatically for me.

After finishing the first iteration, running it for a bit and losing a few Euros, I quickly realised that some of my assumptions as laid out in the README were wrong (I will be updating this soon). Namely, I wasn't accounting for Betfair's commission on winnings (silly me). I currently have an EU-based account, which has a 6.5 per cent commission on winnings. UK-based accounts have the minimum at 5 per cent. The commission has an effect on the cheapest profitable odds you can provide, which has an effect on whether people want to match bets at those odds.

With this in mind, it quickly becomes clear that any unmatched bets you see in the market are far from the maximum profitable odds. This makes sense, and competing based on odds becomes impossible at this point. I am led to believe that the only way to make money is by having a UK-based account plus getting the bets to the market first. I have a few ideas on how to do this.

If I can get the bets to match at odds that guarantee profit in the long-run assuming UK-based commission of 5 per cent, then I'm going to call it a day.

Regardless, I'm not expecting to make too much money from this. I have a lot of free time right now (looking for a job), so if anyone wants to get into anything else available on Betfair together, then please get in touch at the email on my Github through [2]. My discrete probability and programming are okay, but it would be great to have someone who could share their statistics knowledge.

[1] https://games.betfair.com/exchange-hi-lo/standard

[2] https://github.com/jpcooper/betfair-exchange-hi-lo-odds



Heh.

I used to work on those products, way back in 2008 or so. Let me save you some time: you won't get any action at good odds. Or, if you do, it'll be a tiny amount.

Betfair run their own bots on those markets AND they get their bets into the market BEFORE the market opens to the public. Good luck anyway!


And they will cannibalize your profits, up to 60%, if you start to make significant money. And they can kick you out anytime they want. It's all in the terms and conditions.


IMO the premium charge is much better than commission as a pricing model. It's less predictable day to day but long term it better aligns incentives between the winning customers and the exchange. They don't really kick people off unless they're exploiting bugs in the exchange or engaged in illegal activity. They certainly won't ban you for winning on the exchange.


Thanks for the heads up. It's good to get confirmation that that actually happens. I'd be surprised if it didn't. I'm not too far from implementing my final idea to get profitable bets in. If that (probably as you say) fails, then it was a fun learning experience.


Thanks for sharing (I recommend taking a look at his GitHub repo [2], where he nicely described the game and his approach).

Some time ago I had a similar project with BetFair soccer matches. I assumed that the number of goals from each team is given by a Poisson process. Then, I used the largest market (Win/Lose/Draw) to estimate this parameter. With this information I could estimate the "fair" odds of more exotics bets (like e.g. team A will score 3 goals more than team B), which were often mispriced, and then use the Kelly criterion to estimate how much to bet.

All in all a nice project, but... at the very end -just before deploying the bot- I realised that the BetFair Exchange is not open to Germans, so I wrote a blog post and open sourced the code. Still, a nice learning opportunity :-)


Thanks. I would like to point out again that the code is out of date, and the margins displayed there are miscalculated due to not accounting for commission. The general spirit remains.

Did you backtest and show potential returns? Can you link to your model? Did you come across "Scoring dynamics across professional team sports: tempo, balance and predictability" [1]? They apply a Poisson model to team sports. I mentioned this paper to a company involved in betting who I interviewed with once, and they told me that they were doing something similar, but way more involved. It demotivated me somewhat regarding implementing it, making me wonder whether there really was any juice left to be squeezed from it.

[1] https://link.springer.com/article/10.1140/epjds29


I wasn't aware of that paper, but it seems we came to a similar conclusion. From the paper:

> Across all sports, scoring tempo - when scoring events occur - is remarkably well-described by a Poisson process, in which scoring events occur independently with a sport-specific rate at each second on the game clock.

So, yes, basically that was my concept. Estimate its parameters and then you'll have the "real" odds. Any difference with the market ones is a potential of profit (considering the house fees).

I couldn't backtest it since I couldn't find free historical data for all types of markets (then again, maybe I didn't look hard enough). I forward tested it, though, and it seemed to work.

My code is here [1], which also links to a blog post describing the method. Feel free to take a look and contact me to discuss these ideas.

Also, if you're interested in mathematically modelling probabilities, we are looking for team members to develop a product to estimate the risk of default in loans. After all, a loan is another kind of bet, that takes place in a slightly harder to model environment.

[1] https://github.com/ghgr/BetFair_Arbitrer


Thanks for the tips. The loans idea sounds interesting. I will send you an email.


Economic reasoning states that the vig will absolutely swamp any small edge you may discover.


These guys did it:

Walsh and Ranogajec took on the might of global gaming markets and managed to consistently win over three decades. Much like the most advanced hedge funds, which employ armies of PhDs to identify patterns in financial markets, Walsh and Ranogajec’s consortium, called the Bank Roll, created statistical models that allowed them to exploit mispricings in betting odds wherever they could be found

https://www.afr.com/opinion/david-walsh-s-wisdom-beats-the-o...


https://en.m.wikipedia.org/wiki/Vigorish For others who don’t know what vig is


Someone has to provide a market. That person has to do it profitably. I am assuming that this is possible, otherwise it would not be possible to play the game. My reasoning could of course be off. Could you elaborate?


> Someone has to provide a market. That person has to do it profitably.

But by this reasoning no one would play blackjack at the casino. That is, how do you know people laying these bets aren't just gambling at a disadvantage? You could view the whole thing as one more novelty game the casino is spreading.


I am assuming that all computer players of this game have access to the algorithm which I have discovered. I am assuming that all computer players have figured out the simple formula which gives them the cheapest profitable odds to back or lay an outcome given the commission and the outcome's probability (thanks to one of your previous comments).

I am assuming that there will be punters who bite at the odds I provide. If there weren't, then the game would not be sustainable.

I came across a "betting guide" for sale for this game which claims to advise on bets based on the "trends" seen in the game. I don't know what this means, but it gives me hope that there are people out there willing to part with their money in my direction.

Failing that, the novelty was an interesting one, and it's all about the journey, dude!


To clarify, I'm not saying your assumptions are necessarily wrong, or that you shouldn't try to test them and see what happens.

I'm just proposing another possibility is that everyone playing on both sides is a "punter" having fun (or deceiving themselves). In any case, that everyone is losing long-term. With 5% vig I'd guess that's the most likely possibility.


You might be right. Also if Betfair has its own bots playing as another commenter claims, then it will be hard to compete on odds. Only one way to find out.


Here is my guess:

45% of players don’t play well enough to win, even at even odds. Kind of mini-Dunning Krueger. They’re hoping for luck, and love to tell stories to their friends when they win.

30% are degenerate gamblers.

The balance play well enough that the loss rate is sufficiently slow so as to pay for the entertainment value.


... you’re aware of the adage “the house always wins” right?


Betfair is peer to peer, so the house just takes a rake (similar to poker). This means it is hypothetically possible for both you and the house to win.


On Betfair the house is you. You determine the odds. Let's assume that cards are dealt randomly. If I know the exact probabilities of every outcome I bet on, and I always bet with odds which have a margin over those probabilities, then I win in the long run.


Forgive my ignorance, but: why would anyone bet against you?


I'm a long-time poker player and recent political bettor. Gamblers routinely overestimate their edge or don't care whether they win. Often it's a mix of both.

There are still many many many people who are willing to bet on the results of the US presidential election: https://www.thedailybeast.com/gamblers-bet-big-on-trump-and-...


What do you base your political bets on?


For one-offs, picking the favorite is good enough for most players. Thy are just seeking entertainment and maybe to win a little money. For instance, in a race between two candidates priced at $0.70 and $0.30 (ranging from $0.01 to $0.99 before resolution), many players are happy to pick the favorite indicated by the market.

Of course, if those prices are accurate, then they will lose money in the long-run after fees. For players who are betting more frequently and over a longer term, it's like any other speculation: You might assess the $0.30 underdog to have a 40% chance of winning. She is still the underdog, but you profit over the long run by buying her at her too-low price. Those players are scooping that value wherever they can find it.

For major electoral events that involve a populist with a large, loyal, and misinformed fanbase, the value pretty much finds you. Both of the described groups are making lots of money because the markets are wildly mispriced.


I wonder what you base your sentiment on. I can't imagine there's much juice left in Twitter sentiment analysis.


You don’t have to be smarter than Twitter, just smarter than the crowd, who aren’t applying Twitter analysis. Take the above article as an extreme but not exceptional case: The correct price for Biden winning the election was $0.99 for weeks before the market was closed, but he was trading much lower over that time.

We were betting on the results of an event that already happened. No Twitter analysis necessary.


I need to find more of those.


A recent example. Even after it became apparent that Biden won the election you could still sell 10:1 bets on Trump to win, on betfair, to suckers which refused to accept reality or vastly overestimated the probability for Trump to sabotage the elections and/or stage a coup.

It's basically free money.


Consider the case of betting with a traditional bookmaker. The bookmaker lays (bets against) an outcome. You back (bet for) the outcome. Each party is betting against the other.


The don't. They place bets. If they place bets on the opposite odds that you do on the same bet, then they play against you (and you're competing for that).


for fun


Using a bot is acceptable under their terms?


Yes. They provide various APIs for this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: