FA-84831 / Betting odds conversion / Open access
Commission deducted from the whole price · case 01
Effective prices are reduced by commission on the stake as well as winnings.
ROOT CAUSE
Commission multiplies the full equivalent price.
VERIFIED REPAIR
Apply commission to the winnings part only.
Unsuccessful approach: Subtracting the commission rate as price points does not scale with the winnings.
Case contract
Laying a selection at price L (> 1, else "invalid") is equivalent to backing "not this selection" at L / (L - 1). After exchange commission c percent on winnings, the effective price is 1 + (equivalent - 1) * (100 - c) / 100. Return both, rounded half up to three decimals.
Why this case matters
Matched-betting and trading calculators compare lay prices with bookmaker back prices.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(lay_price, commission_pct):
L = Fraction(lay_price)
if L <= 1:
return 'invalid'
eq = L / (L - 1)
eff = eq * (100 - Fraction(commission_pct)) / 100
def fmt(v):
c = math.floor(v * 1000 + Fraction(1, 2))
return '%d.%03d' % (c // 1000, c % 1000)
return [fmt(eq), fmt(eff)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('8.46', '6.5'), ['1.134', '1.125']),
('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
('variant scenario 2', ('9', '6.5'), ['1.125', '1.117'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '2'), ['1.125', '1.123']),
('variant scenario 1', ('17', '0'), ['1.063', '1.063']),
('variant scenario 2', ('5.35', '2'), ['1.230', '1.225'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '6.5'), ['5.000', '4.740']),
('variant scenario 1', ('1.25', '5'), ['5.000', '4.800']),
('variant scenario 2', ('2.03', '0'), ['1.971', '1.971'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '6.5'), ['1.125', '1.117']),
('variant scenario 1', ('1.99', '5'), ['2.010', '1.960']),
('variant scenario 2', ('33', '5'), ['1.031', '1.030'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '2'), ['5.000', '4.920']),
('variant scenario 1', ('33', '2'), ['1.031', '1.031']),
('variant scenario 2', ('9', '5'), ['1.125', '1.119'])]]
for label, args, expected in cases[N - 1]:
check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control lay evens | ['2.000', '2.000'] | ['2.000', '2.000'] | Passed |
| control lay favourite | ['3.000', '2.850'] | ['3.000', '2.900'] | Failed |
| boundary half-up third decimal | ['1.063', '1.063'] | ['1.063', '1.063'] | Passed |
| boundary no-profit lay | invalid | invalid | Passed |
| regression: commission scope | ['1.134', '1.060'] | ['1.134', '1.125'] | Failed |
| variant scenario 1 | ['1.031', '1.031'] | ['1.031', '1.031'] | Passed |
| variant scenario 2 | ['1.125', '1.052'] | ['1.125', '1.117'] | Failed |
SHA-256 / f93540988c9fae8701ff38f1719450cc3d51427794cca959e3332a8c999ad8f8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(lay_price, commission_pct):
L = Fraction(lay_price)
if L <= 1:
return 'invalid'
eq = L / (L - 1)
eff = eq - Fraction(commission_pct) / 100
def fmt(v):
c = math.floor(v * 1000 + Fraction(1, 2))
return '%d.%03d' % (c // 1000, c % 1000)
return [fmt(eq), fmt(eff)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('8.46', '6.5'), ['1.134', '1.125']),
('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
('variant scenario 2', ('9', '6.5'), ['1.125', '1.117'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '2'), ['1.125', '1.123']),
('variant scenario 1', ('17', '0'), ['1.063', '1.063']),
('variant scenario 2', ('5.35', '2'), ['1.230', '1.225'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '6.5'), ['5.000', '4.740']),
('variant scenario 1', ('1.25', '5'), ['5.000', '4.800']),
('variant scenario 2', ('2.03', '0'), ['1.971', '1.971'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '6.5'), ['1.125', '1.117']),
('variant scenario 1', ('1.99', '5'), ['2.010', '1.960']),
('variant scenario 2', ('33', '5'), ['1.031', '1.030'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '2'), ['5.000', '4.920']),
('variant scenario 1', ('33', '2'), ['1.031', '1.031']),
('variant scenario 2', ('9', '5'), ['1.125', '1.119'])]]
for label, args, expected in cases[N - 1]:
check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control lay evens | ['2.000', '2.000'] | ['2.000', '2.000'] | Passed |
| control lay favourite | ['3.000', '2.950'] | ['3.000', '2.900'] | Failed |
| boundary half-up third decimal | ['1.063', '1.063'] | ['1.063', '1.063'] | Passed |
| boundary no-profit lay | invalid | invalid | Passed |
| regression: commission scope | ['1.134', '1.069'] | ['1.134', '1.125'] | Failed |
| variant scenario 1 | ['1.031', '1.031'] | ['1.031', '1.031'] | Passed |
| variant scenario 2 | ['1.125', '1.060'] | ['1.125', '1.117'] | Failed |
SHA-256 / c827713c1e0f949f43e823032372b14fea632a3df43b1df714ac91e4a5138a11
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(lay_price, commission_pct):
L = Fraction(lay_price)
if L <= 1:
return 'invalid'
eq = L / (L - 1)
eff = 1 + (eq - 1) * (100 - Fraction(commission_pct)) / 100
def fmt(v):
c = math.floor(v * 1000 + Fraction(1, 2))
return '%d.%03d' % (c // 1000, c % 1000)
return [fmt(eq), fmt(eff)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
try:
return solve(*args)
except Exception as exc:
return 'raised ' + type(exc).__name__
cases = [[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('8.46', '6.5'), ['1.134', '1.125']),
('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
('variant scenario 2', ('9', '6.5'), ['1.125', '1.117'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '2'), ['1.125', '1.123']),
('variant scenario 1', ('17', '0'), ['1.063', '1.063']),
('variant scenario 2', ('5.35', '2'), ['1.230', '1.225'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '6.5'), ['5.000', '4.740']),
('variant scenario 1', ('1.25', '5'), ['5.000', '4.800']),
('variant scenario 2', ('2.03', '0'), ['1.971', '1.971'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('9', '6.5'), ['1.125', '1.117']),
('variant scenario 1', ('1.99', '5'), ['2.010', '1.960']),
('variant scenario 2', ('33', '5'), ['1.031', '1.030'])],
[('control lay evens', ('2.00', '0'), ['2.000', '2.000']),
('control lay favourite', ('1.50', '5'), ['3.000', '2.900']),
('boundary half-up third decimal', ('17', '0'), ['1.063', '1.063']),
('boundary no-profit lay', ('1.00', '5'), 'invalid'),
('regression: commission scope', ('1.25', '2'), ['5.000', '4.920']),
('variant scenario 1', ('33', '2'), ['1.031', '1.031']),
('variant scenario 2', ('9', '5'), ['1.125', '1.119'])]]
for label, args, expected in cases[N - 1]:
check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control lay evens | ['2.000', '2.000'] | ['2.000', '2.000'] | Passed |
| control lay favourite | ['3.000', '2.900'] | ['3.000', '2.900'] | Passed |
| boundary half-up third decimal | ['1.063', '1.063'] | ['1.063', '1.063'] | Passed |
| boundary no-profit lay | invalid | invalid | Passed |
| regression: commission scope | ['1.134', '1.125'] | ['1.134', '1.125'] | Passed |
| variant scenario 1 | ['1.031', '1.031'] | ['1.031', '1.031'] | Passed |
| variant scenario 2 | ['1.125', '1.117'] | ['1.125', '1.117'] | Passed |
SHA-256 / 0e5e9f3d53313e68b4cbfb0cd2f072f2fad4b90c30911c307fb1ecc1291786a9
Verification & scope
Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any operator, exchange or regulator rule set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:50:34.685796+00:00.
Case digest / 5f34466d74cce3e7d70aeebd27eda600f5d28de5e33eb8bc0950599a40f4cc30