<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pinnacle Terminal]]></title><description><![CDATA[Pinnacle Terminal]]></description><link>https://pinnacleterminal.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 15:39:21 GMT</lastBuildDate><atom:link href="https://pinnacleterminal.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Converting decimal odds to fair probabilities: a small Python walkthrough]]></title><description><![CDATA[How to remove the overround from a two-way sports market, with multiplicative, additive and power methods]]></description><link>https://pinnacleterminal.hashnode.dev/converting-decimal-odds-to-fair-probabilities-a-small-python-walkthrough</link><guid isPermaLink="true">https://pinnacleterminal.hashnode.dev/converting-decimal-odds-to-fair-probabilities-a-small-python-walkthrough</guid><category><![CDATA[Python]]></category><category><![CDATA[probability]]></category><category><![CDATA[Mathematics]]></category><category><![CDATA[odds]]></category><dc:creator><![CDATA[Pinnacle Terminal]]></dc:creator><pubDate>Sat, 14 Nov 2026 20:09:21 GMT</pubDate><content:encoded><![CDATA[<p>Decimal odds in a sports market are just prices. The usual conversion to an implied probability is <code>1 / odds</code>. For a two-way market those implied probabilities almost never sum to 1: the excess is the overround, or margin, built into the quotes. Until you remove it, you do not have a coherent probability distribution, and you cannot compare one market with another on the same scale.</p>
<p>There is no single correct rule for removing the overround. Three common methods — multiplicative, additive and power — agree on a balanced line and disagree once the prices are lopsided. The snippet below uses a two-way market quoted at <strong>1.25 / 4.20</strong>. You need every outcome of the market; a single price is not enough, because you would not know the size of the margin.</p>
<pre><code class="language-python">ODDS = (1.25, 4.20)

r = [1 / o for o in ODDS]
S = sum(r)
print("implied probabilities:", [f"{x:.4f}" for x in r])
print("sum:", f"{S:.4f}", f"({(S - 1) * 100:.2f}% margin)")

# Multiplicative: p = r / S
p_mul = [x / S for x in r]
print("multiplicative fair odds:", [f"{1 / p:.3f}" for p in p_mul])

# Additive: p = r - (S - 1) / n
n = len(r)
p_add = [x - (S - 1) / n for x in r]
print("additive fair odds:", [f"{1 / p:.3f}" for p in p_add])

# Power: find k so sum(r_i ** k) == 1
lo, hi = 0.5, 3.0
for _ in range(60):
    mid = (lo + hi) / 2
    if sum(x ** mid for x in r) &gt; 1:
        lo = mid
    else:
        hi = mid
k = (lo + hi) / 2
p_pow = [x ** k for x in r]
print("power k:", f"{k:.4f}")
print("power fair odds:", [f"{1 / p:.3f}" for p in p_pow])
</code></pre>
<p>Running it (Python 3, standard library only) prints:</p>
<pre><code>implied probabilities: ['0.8000', '0.2381']
sum: 1.0381 (3.81% margin)
multiplicative fair odds: ['1.298', '4.360']
additive fair odds: ['1.280', '4.565']
power k: 1.0761
power fair odds: ['1.271', '4.685']
</code></pre>
<p>In words: 1 ÷ 1.25 = 0.8000 and 1 ÷ 4.20 ≈ 0.2381, which add to 1.0381 (a 3.81% margin).</p>
<p><strong>Multiplicative</strong> divides each implied probability by that total, <code>p = r / S</code>. Both sides lose the same <em>proportion</em>. The fair odds are 1.298 / 4.360, or probabilities 0.7706 and 0.2294. It is the simplest normalisation, and it leaves the outsider relatively short.</p>
<p><strong>Additive</strong> subtracts the same share of the margin from each outcome: <code>p = r − (S − 1) / n</code>. Here that share is 0.0381 ÷ 2 ≈ 0.01905, which gives fair odds 1.280 / 4.565 (probabilities 0.7810 and 0.2190). The long shot loses a larger proportion, so its fair price lengthens more. If a very long quote would be pushed through zero, the method is invalid and should be skipped rather than patched. On a two-way market, Shin's method — which solves for an informed-money parameter <em>z</em> so the fair probabilities sum to 1 — coincides with additive, so it also returns 1.280 / 4.565.</p>
<p><strong>Power</strong> finds <em>k</em> such that <code>sum(r_i ** k) == 1</code>, then sets <code>p_i = r_i ** k</code>. The bisection above is enough: if the current exponent still overshoots 1, it is too small (each <code>r_i</code> is less than 1, so raising the exponent shrinks the terms). For this market <em>k</em> ≈ 1.0761 and the fair odds are 1.271 / 4.685 (probabilities 0.7865 and 0.2135). The adjustment grows as the price lengthens.</p>
<p>The three methods therefore disagree most on the outsider: 4.360, 4.565 and 4.685. A conservative check is the highest fair odds across the methods, here 1.298 / 4.685. That worst-case figure is an envelope, not a fourth normalised market. If a quote is longer than the envelope, it is longer than every method.</p>
<p>For contrast, a balanced market of <strong>1.95 / 1.95</strong> implies 0.5128 + 0.5128 = 1.0256 (a 2.56% margin). All three methods, and Shin, return fair odds of 2.000 / 2.000. The method only starts to matter when the quotes are uneven.</p>
<p>These figures are fair prices implied by a complete set of quotes, not forecasts and not a promise of any return. I use power as a default and look at the spread between methods when the market is lopsided.</p>
<p>A browser calculator that implements these methods, plus Shin and the worst-case envelope, is in the free tools at Pinnacle Terminal: the <a href="https://pinnacleterminal.io/tools/devig-calculator?utm_source=hashnode&amp;utm_medium=backlink&amp;utm_campaign=backlinks">devig calculator</a>. It runs locally in the browser and needs no login.</p>
]]></content:encoded></item></channel></rss>