<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>betting Archives - Albert Nogués</title>
	<atom:link href="https://www.albertnogues.com/tag/betting/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.albertnogues.com/tag/betting/</link>
	<description>Data and Cloud Freelancer</description>
	<lastBuildDate>Fri, 11 Dec 2020 12:40:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.albertnogues.com/wp-content/uploads/2020/12/cropped-cropped-AlbertLogo2-32x32.png</url>
	<title>betting Archives - Albert Nogués</title>
	<link>https://www.albertnogues.com/tag/betting/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Introduction to the maths of bookmaking (with python code)</title>
		<link>https://www.albertnogues.com/introduction-to-the-maths-of-bookmaking-with-python-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introduction-to-the-maths-of-bookmaking-with-python-code</link>
		
		<dc:creator><![CDATA[Albert]]></dc:creator>
		<pubDate>Sat, 27 Jun 2015 20:12:23 +0000</pubDate>
				<category><![CDATA[Betting]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[betting]]></category>
		<category><![CDATA[prices]]></category>
		<category><![CDATA[probability]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://192.168.1.40/?p=180</guid>

					<description><![CDATA[<p>Introduction In this article I will show you how to calculate simple things about the odds the bookmakers offer and how to play with them with the intention of using the real chance of each outcome to model a group of prices. Basically what we will do is the following: retrieve the odds of a &#8230; </p>
<p>The post <a href="https://www.albertnogues.com/introduction-to-the-maths-of-bookmaking-with-python-code/">Introduction to the maths of bookmaking (with python code)</a> appeared first on <a href="https://www.albertnogues.com">Albert Nogués</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In this article I will show you how to calculate simple things about the odds the bookmakers offer and how to play with them with the intention of using the real chance of each outcome to model a group of prices. Basically what we will do is the following:</p>
<ul>
<li>retrieve the odds of a horse race</li>
<li>calculate the overround applied</li>
<li>determine the true odds</li>
<li>generate a new set of odds with the desired overround. We will see several techniques, these are:
<ul>
<li>First approach for pricing: Apply the overround linearly</li>
<li>A better approach: Apply the overround based on the chance of winning</li>
<li>The real deal: Apply the overround based on a model</li>
</ul>
</li>
</ul>
<h1>Retrieve the Odds</h1>
<p>For the sample of this article I will be using odds of a horse race held at Doncaster, the 27th of June 2015. This was the last race of the card, a class 4 handicap of 7 runners, but any race or sport should suit.</p>
<p>The odds on offer at the time of writting were the following (got from oddschecker):</p>
<p>Rio Ronaldo <strong>3.25</strong> 3.0 3.0 3.25 3.0 3.25 3.25 3.0 3.0 2.75 3.25 3.25<br />Beau Eile <strong>3.5</strong> 3.25 3.25 3.25 3.5 3.25 3.25 3.25 3.25 3.25 3.5 3.5<br />Bahamian Sunrise <strong>4.0</strong> 4.0 3.75 3.75 4.0 3.75 3.75 3.75 4.0 4.0 3.5 3.75<br />Silver Rainbow <strong>13.0</strong> 13.0 9.0 13.0 12.0 11.0 11.0 13.0 11.0 11.0 10.0 9.0<br />Snow Cloud <strong>15.0</strong> 15.0 12.0 13.0 10.0 12.0 13.0 12.0 12.0 15.0 9.0 12.0<br />Equally Fast <strong>17.0</strong> 17.0 17.0 15.0 17.0 17.0 17.0 17.0 15.0 17.0 13.0 17.0<br />Mc Diamond <strong>67.0</strong> 67.0 41.0 34.0 67.0 51.0 41.0 34.0 51.0 67.0 41.0 41.0</p>
<p>In this article we will choose the best price or joint best price available but any set of ods can be choose.</p>
<p>So we construct our list of best prices with the folowing values: [3.25, 3.5, 4.0, 13.0, 15.0, 17.0, 67.0]</p>
<pre id="block-15d1b0d9-ff9f-4489-a5ee-2b3ec84d1fa8" class="wp-block-code block-editor-block-list__block wp-block is-selected" tabindex="0" role="group" aria-label="Block: Code" data-block="15d1b0d9-ff9f-4489-a5ee-2b3ec84d1fa8" data-type="core/code" data-title="Code"><code class="block-editor-rich-text__editable rich-text" role="textbox" contenteditable="true" aria-multiline="true" aria-label="Code">maxPrices = [3.25, 3.5, 4.0, 13.0, 15.0, 17.0, 67.0]</code></pre>
<h1>Calculate the Overround of a set of outcomes</h1>
<p>To calculate the overround of a set of prices is easy. Basically what needs to be done is to iterate through the list of prices, and calculate the chances of winning each one, accumulate them and see how this number exceeds of 1 (or 100% if we are counting percentages).</p>
<p>To work out the probability of each outcome to win we need to do the following division:</p>
<p>1 / odds</p>
<p>Then we will sum up all these probabilities and will get the overround of the race</p>
<p>overround = 0<br />for price in maxPrices:<br />overround = overround + 1/price<br />print(&#8220;Total overround is&#8221;,overround) </p>
<p>which gives us the following output: Total overround is 1.0607452395424302</p>
<h1>Determine the true odds</h1>
<p>For calculating the fair price we will multiply the current price by the overround we calculated in the previous step. In case we were working with probabilities, the process would be the same.</p>
<p><br />fairPrice = []<br />for price in maxPrices:<br />fairPrice = fairPrice + [price * overround]<br />print(&#8220;fairPrice&#8221;,fairPrice)</p>
<p>The new fair price list without the overround is the following:</p>
<p>fairPrice [3.4474220285128983, 3.7126083383985056, 4.242980958169721, 13.789688114051593, 15.911178593136452, 18.032669072221314, 71.06993104934283]</p>
<h1>Generate a new set of odds</h1>
<p>The following step is generating a new set of odds. These can be generated with different techniques. We cover the following in this article:</p>
<h2>First approach for pricing: Apply the overround linearly</h2>
<p>This solution is not the most usefull one but in some cases it may work. Basically it consists in dividing the total percent of overround equaly amongst all the outcomes. This is usually not a good idea as we can get inflated prices for the favourites against the outsiders. And as we know, money is likely to go for these heading the market. So from a bookmaking point of view, it does not make too much sense.</p>
<p>We have not considered this solution as interesting for the article, so we are not covering it.</p>
<h2>A better approach: Apply the overround based on the chance of winning</h2>
<p>In this paragraph we are presenting a better approach. Instead of dividing the overround in equally parts, we will divide the overround depending on the chance of winning. So, based on the calculated odds, we will apply one part of the overround on the other. This partially compensates the problem with the previous method, and will usually be more than enough, though sometimes it is not yet the perfect solution.</p>
<p>In our sample, we will be applying a 5% of overround on the fair price calculated in the previous step.</p>
<p>appliedOverround5pct = []<br />for price in fairPrice:<br />appliedOverround5pct = appliedOverround5pct + [price/1.05]<br />print(&#8220;appliedOverround 5%&#8221;,appliedOverround5pct)<br /><br /></p>
<p>The new list with a 5% of overround is the folowing. As you can see, prices are slightly higher that they were origially as the overround is 1% less:<br />[3.2832590747741888, 3.5358174651414336, 4.040934245875924, 13.133036299096755, 15.153503422034715, 17.17397054497268, 67.68564861842174]</p>
<h2>The real deal: Apply the overround based on a model</h2>
<p>This solution will entitle in building a model of prices withou overround and winning results. Based on a big number of outcomes we would able to model and predict the overround to apply based on this historical data.</p>
<p>Since this would involve a model creation and usually this means some complexity, and the samples presented are good enough to go, we left this out of the scope of this article.</p>
<p>The full code is here:</p>


<pre class="wp-block-code"><code>def pythonPriceOverround():
maxPrices = &#91;3.25, 3.5, 4.0, 13.0, 15.0, 17.0, 67.0]

print(maxPrices)
overround = 0
for price in maxPrices:
overround = overround + 1/price

print("Total overround is",overround)

fairPrice = &#91;]
for price in maxPrices:
fairPrice = fairPrice + &#91;price * overround]
print("fairPrice",fairPrice)

appliedOverround5pct = &#91;]

for price in fairPrice:
appliedOverround5pct = appliedOverround5pct + &#91;price/1.05]
print("appliedOverround 5%",appliedOverround5pct)

#Check than now the overround is indeed a 5%
overround = 0
for price in appliedOverround5pct:
overround = overround + 1/price

print("Total overround is",overround)</code></pre>



<p></p>



<p></p>
<p>The post <a href="https://www.albertnogues.com/introduction-to-the-maths-of-bookmaking-with-python-code/">Introduction to the maths of bookmaking (with python code)</a> appeared first on <a href="https://www.albertnogues.com">Albert Nogués</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
