FAILURE MAP
← Case archive

FA-84826 / Betting odds conversion / Open access

Lay price converted with the profit instead of the ratio · case 01

Laying at 3.00 is shown as backing the field at 2.00.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The equivalent price is computed as L - 1.

VERIFIED REPAIR

Use L / (L - 1).

Unsuccessful approach: Using 1 / (L - 1) gives the fractional odds of the field without the returned stake.

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 - 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: equivalence formula', ('1.25', '0'), ['5.000', '5.000']),
  ('variant scenario 1', ('17', '2'), ['1.063', '1.061']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])],
 [('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: equivalence formula', ('1.25', '5'), ['5.000', '4.800']),
  ('variant scenario 1', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 2', ('2.00', '5'), ['2.000', '1.950'])],
 [('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: equivalence formula', ('1.58', '2'), ['2.724', '2.690']),
  ('variant scenario 1', ('5.64', '2'), ['1.216', '1.211']),
  ('variant scenario 2', ('9', '0'), ['1.125', '1.125'])],
 [('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: equivalence formula', ('33', '2'), ['1.031', '1.031']),
  ('variant scenario 1', ('1.25', '6.5'), ['5.000', '4.740']),
  ('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: equivalence formula', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])]]
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 fixtureActualExpectedOutcome
control lay evens['1.000', '1.000']['2.000', '2.000']Failed
control lay favourite['0.500', '0.525']['3.000', '2.900']Failed
boundary half-up third decimal['16.000', '16.000']['1.063', '1.063']Failed
boundary no-profit layinvalidinvalidPassed
regression: equivalence formula['0.250', '0.250']['5.000', '5.000']Failed
variant scenario 1['16.000', '15.700']['1.063', '1.061']Failed
variant scenario 2['16.000', '15.250']['1.063', '1.059']Failed

SHA-256 / 1b6e5cb727ae19fea840b911fd758b8aaeac2245a9eb94e1c8cc490e297885cd

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 = 1 / (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: equivalence formula', ('1.25', '0'), ['5.000', '5.000']),
  ('variant scenario 1', ('17', '2'), ['1.063', '1.061']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])],
 [('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: equivalence formula', ('1.25', '5'), ['5.000', '4.800']),
  ('variant scenario 1', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 2', ('2.00', '5'), ['2.000', '1.950'])],
 [('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: equivalence formula', ('1.58', '2'), ['2.724', '2.690']),
  ('variant scenario 1', ('5.64', '2'), ['1.216', '1.211']),
  ('variant scenario 2', ('9', '0'), ['1.125', '1.125'])],
 [('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: equivalence formula', ('33', '2'), ['1.031', '1.031']),
  ('variant scenario 1', ('1.25', '6.5'), ['5.000', '4.740']),
  ('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: equivalence formula', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])]]
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 fixtureActualExpectedOutcome
control lay evens['1.000', '1.000']['2.000', '2.000']Failed
control lay favourite['2.000', '1.950']['3.000', '2.900']Failed
boundary half-up third decimal['0.063', '0.063']['1.063', '1.063']Failed
boundary no-profit layinvalidinvalidPassed
regression: equivalence formula['4.000', '4.000']['5.000', '5.000']Failed
variant scenario 1['0.063', '0.081']['1.063', '1.061']Failed
variant scenario 2['0.063', '0.109']['1.063', '1.059']Failed

SHA-256 / 93635c2c1275c29e1e8ec5da041e2f83b2d15da436a982c1d445da73e55f4eb0

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: equivalence formula', ('1.25', '0'), ['5.000', '5.000']),
  ('variant scenario 1', ('17', '2'), ['1.063', '1.061']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])],
 [('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: equivalence formula', ('1.25', '5'), ['5.000', '4.800']),
  ('variant scenario 1', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 2', ('2.00', '5'), ['2.000', '1.950'])],
 [('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: equivalence formula', ('1.58', '2'), ['2.724', '2.690']),
  ('variant scenario 1', ('5.64', '2'), ['1.216', '1.211']),
  ('variant scenario 2', ('9', '0'), ['1.125', '1.125'])],
 [('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: equivalence formula', ('33', '2'), ['1.031', '1.031']),
  ('variant scenario 1', ('1.25', '6.5'), ['5.000', '4.740']),
  ('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: equivalence formula', ('17', '6.5'), ['1.063', '1.058']),
  ('variant scenario 1', ('33', '0'), ['1.031', '1.031']),
  ('variant scenario 2', ('17', '5'), ['1.063', '1.059'])]]
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 fixtureActualExpectedOutcome
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 layinvalidinvalidPassed
regression: equivalence formula['5.000', '5.000']['5.000', '5.000']Passed
variant scenario 1['1.063', '1.061']['1.063', '1.061']Passed
variant scenario 2['1.063', '1.059']['1.063', '1.059']Passed

SHA-256 / 63268498bb430bcfd610fd9a79f800e246a07f4f3fdcdb5eb3f5a32dce591549

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.682970+00:00.

Case digest / 5c70e5f825175a8e886f03268f66e3f7aed45241e24c18cec924769b8696e127