Monday, 5 March 2012

Maths For Lay Dutching To A Fixed Liability

This evening I 'Googled' for the maths behind lay dutching to a fixed max liability and found loads of links to on-line dutching calculators and little else. There is of course lots of trading/betting software out there that also has dutching calculators, but as I needed the maths for a bot I'm developing, I wound up working it out for myself.

Requirement: Calculate the individual stakes required based on a fixed overall maximum liability.

Looking at the correct score market of the Arsenal v AC Milan match to be held tomorrow night (6th Mar 2012) we see the lay odds for the 0-1, 1-1, 2-1, 3-0 and 3-1 scores are as listed in the table below. Note, those scorelines have been picked at random for illustration purposes and do not indicate any thoughts I may have on the game.

From those odds, the implied probabilities can be calculated by dividing 1 by the odds. The table summarises those calculations so far:

ScoreOddsWin Prob
0-116.00.0625
1-18.40.1190
2-110.50.0952
3-029.00.0345
3-120.00.0500

So, the total probability of one of the chosen results being the full time score is simply the total of the last column, i.e. 0.3612, or 36.12% if you prefer. However, we don't want those picks to be the winning score since we wish to lay them all. So the overall probability of the final score being something other than one of our five picks is simply:

1 - 0.3612 = 0.6388

This is equivalent to decimal odds of:

1/0.6388 = 1.5654

Now, we need to calculate the total stake to be used when laying these picks so that the overall liability is fixed at £100 say. This is simply:

Total Stake = Fixed Liability * (Overall Odds - 1)
=> Total Stake = 100 * (1.5654 - 1) = 56.54

Now, all we have to do is to split this total stake across the five picks in proportion to their odds. This is done using the formula:

Stake = Total Stake * Win Prob / Total Win Prob

So, in the case of the 0-1 scoreline, the Stake is:

56.64 * 0.0625 / 0.3612 = 9.80

The following table summarises the results for all the chosen scorelines:

ScoreOddsStake
0-116.09.80
1-18.418.66
2-110.514.93
3-029.05.41
3-120.07.84

So we now have the stakes required for each selection ensuring that the liabilty should any of the selections end up winning is fixed at 100. If we decided to add another scoreline to our picks, the overall liability would remain the same, but all the individual stakes would change. 

Here's a screen shot from the Fairbot dutching calculator to confirm the figures, albeit with a few pennies different due to rounding differences.


Friday, 3 February 2012

Trigger Happy

I came across this technique the other day, where back bets are triggered by falling odds in-running.

The trader was using Evo, which I don't. Fairbot is the only other trading application I've managed to get working under Linux - and the developers have vowed to continue supporting it under Linux. Unfortunately, it doesn't have a triggering mechanism like that shown in the video.

So, emboldened by the bot writing I've been doing, I decided to write my own 'trigger bot'. It's still a bit of a Heath Robinson, rough and ready beast, but I'll put it to the test today. It will only fire in the back bets. I'll use Fairbot to trade out initially, if at all.

Given that Fairbot will be running concurrently, there's a potential issue with data charges, but as the bot will be using the free API, I've calculated that I should be OK. Fingers crossed.

I'm more concerned that the throttling of the API calls by the free API will mean that the market will have gone well past my desired entry point by the time the code recognises that the trigger has been reached. Consequently, back bets might not be taken until the runner is drifting again.

A case of 'suck it and see' for the next couple of days.

Friday, 20 January 2012

Hope For Traders Using Linux?

I was recently browsing the Geeks Toy forum and came across a thread posted by someone who has managed to get The Toy working on Linux.

I gave it a quick go yesterday and although it installed OK, I kept getting an error when trying to log on. As I do not scalp the markets these days and arguably have no need for such software, I haven't bothered to investigate the reason. I suspect it may be something to do with the version of Wine I am running - the latest stable release, version 1.2.3. The original poster is using version 1.3.28 which is a development version.

I have other applications running that I do not want to risk breaking by installing a development version of Wine, so any future attempt will have to wait.

Anyway, I thought I'd bring it to your attention, if you haven't seen it already.

Wednesday, 11 January 2012

About Bloody Time!

Happy New Year to one and all!

It's been a while since I felt the urge to put fingers to keyboard. Apparently, I've been very busy flipping burgers. Not sure in which Quantum universe that's been happening. Here in this universe I've been very busy developing systems that could be automated. It's a never ending process as ideas pop up quicker than I can code them.

Over the years I've done lots of database applications using MS Access and programming/scripting in a variety of different languages. I haven't done much for a while, simply because I'm not a very efficient coder and I find the whole process pretty tedious. However, creating some bots has given the impetus to learn MySQL and PHP programming.

Friday, 7 October 2011

Deal Or No Deal?

Does anyone else get hacked off hearing the Deal Or No Deal theme tune being played on a continuous loop whenever you load up the in-play coupon for the day when logged in to Betfair?

You can if you want, block that nonsense from appearing in your browser by adding the following line to your 'hosts' file:

127.0.0.1 content.betfair.com

You may need to restart your browser and/or reload the page as well as clear the cache.

Note, that this blocks everything from content.betfair.com which is where the arcade stuff comes from. Instead, your browser may display something like 'Web page not found' in the section of your browser where this content appears. If this is an issue, or you like to get involved in the arcade games etc, then this fix will be a no deal for you. Instead, turn your volume down :)

For me, it's a deal. Job done!