FAILURE MAP
← Case archive

FA-84601 / Betting odds conversion / Open access

Three-to-four band uses the wrong increment · case 01

Prices between 3.00 and 4.00 snap to 0.02 increments.

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

ROOT CAUSE

The step for the 3.00-4.00 band is copied from the band below.

THE FAILURE

The step for the 3.00-4.00 band is copied from the band below.

Unsuccessful approach: Using 0.10 increments skips valid ticks such as 3.05.

Case contract

Snap a requested price onto an exchange tick ladder. Bands in hundredths [lo, hi, step]: [(101, 200, 1), (200, 300, 2), (300, 400, 5), (400, 600, 10), (600, 1000, 20), (1000, 2000, 50), (2000, 3000, 100), (3000, 5000, 200), (5000, 10000, 500), (10000, 100001, 1000)]. Prices outside 1.01..1000 return "invalid". A back request rounds down to a valid tick and a lay request rounds up (ticks counted from the band lower bound). Return the tick as "%d.%02d".

Why this case matters

Exchange order entry must snap arbitrary prices to valid ticks in the customer-safe direction.

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(price, side):
    BANDS = [(101, 200, 1), (200, 300, 2), (300, 400, 2), (400, 600, 10), (600, 1000, 20), (1000, 2000, 50), (2000, 3000, 100), (3000, 5000, 200), (5000, 10000, 500), (10000, 100001, 1000)]
    c = Fraction(price) * 100
    if c < 101 or c > 100000:
        return 'invalid'
    for lo, hi, step in BANDS:
        if lo <= c < hi:
            k = (c - lo) / step
            k = math.floor(k) if side == 'back' else math.ceil(k)
            v = lo + k * step
            break
    return '%d.%02d' % (v // 100, v % 100)
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 on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.97', 'lay'), '4.00'),
  ('regression: band step table', ('3.75', 'back'), '3.75'),
  ('variant scenario 1', ('24.78', 'lay'), '25.00'),
  ('variant scenario 2', ('1.96', 'back'), '1.96')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.07', 'back'), '3.05'),
  ('variant scenario 1', ('958.93', 'lay'), '960.00'),
  ('variant scenario 2', ('29.66', 'lay'), '30.00')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.47', 'lay'), '3.50'),
  ('regression: band step table', ('3.47', 'back'), '3.45'),
  ('variant scenario 1', ('1.99', 'lay'), '1.99'),
  ('variant scenario 2', ('2.63', 'lay'), '2.64')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.73', 'back'), '3.70'),
  ('regression: band step table', ('3.03', 'lay'), '3.05'),
  ('variant scenario 1', ('583.07', 'back'), '580.00'),
  ('variant scenario 2', ('11.37', 'back'), '11.00')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.64', 'lay'), '3.65'),
  ('variant scenario 1', ('6.62', 'back'), '6.60'),
  ('variant scenario 2', ('13.02', 'lay'), '13.50')]]
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 on-tick price2.502.50Passed
boundary back rounds down3.023.00Failed
boundary lay rounds up3.043.05Failed
boundary lay rounds into next band2.002.00Passed
boundary below ladderinvalidinvalidPassed
control top of ladder1000.001000.00Passed
regression: band step table3.984.00Failed
regression: band step table3.743.75Failed
variant scenario 125.0025.00Passed
variant scenario 21.961.96Passed

SHA-256 / a40e8e5a4f227785823ce1d82dc2daee1d6e163c8b42b4aeb5d43fd91288e783

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(price, side):
    BANDS = [(101, 200, 1), (200, 300, 2), (300, 400, 10), (400, 600, 10), (600, 1000, 20), (1000, 2000, 50), (2000, 3000, 100), (3000, 5000, 200), (5000, 10000, 500), (10000, 100001, 1000)]
    c = Fraction(price) * 100
    if c < 101 or c > 100000:
        return 'invalid'
    for lo, hi, step in BANDS:
        if lo <= c < hi:
            k = (c - lo) / step
            k = math.floor(k) if side == 'back' else math.ceil(k)
            v = lo + k * step
            break
    return '%d.%02d' % (v // 100, v % 100)
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 on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.97', 'lay'), '4.00'),
  ('regression: band step table', ('3.75', 'back'), '3.75'),
  ('variant scenario 1', ('24.78', 'lay'), '25.00'),
  ('variant scenario 2', ('1.96', 'back'), '1.96')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.07', 'back'), '3.05'),
  ('variant scenario 1', ('958.93', 'lay'), '960.00'),
  ('variant scenario 2', ('29.66', 'lay'), '30.00')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.47', 'lay'), '3.50'),
  ('regression: band step table', ('3.47', 'back'), '3.45'),
  ('variant scenario 1', ('1.99', 'lay'), '1.99'),
  ('variant scenario 2', ('2.63', 'lay'), '2.64')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.73', 'back'), '3.70'),
  ('regression: band step table', ('3.03', 'lay'), '3.05'),
  ('variant scenario 1', ('583.07', 'back'), '580.00'),
  ('variant scenario 2', ('11.37', 'back'), '11.00')],
 [('control on-tick price', ('2.50', 'back'), '2.50'),
  ('boundary back rounds down', ('3.03', 'back'), '3.00'),
  ('boundary lay rounds up', ('3.03', 'lay'), '3.05'),
  ('boundary lay rounds into next band', ('1.995', 'lay'), '2.00'),
  ('boundary below ladder', ('1.00', 'back'), 'invalid'),
  ('control top of ladder', ('1000', 'lay'), '1000.00'),
  ('regression: band step table', ('3.64', 'lay'), '3.65'),
  ('variant scenario 1', ('6.62', 'back'), '6.60'),
  ('variant scenario 2', ('13.02', 'lay'), '13.50')]]
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 on-tick price2.502.50Passed
boundary back rounds down3.003.00Passed
boundary lay rounds up3.103.05Failed
boundary lay rounds into next band2.002.00Passed
boundary below ladderinvalidinvalidPassed
control top of ladder1000.001000.00Passed
regression: band step table4.004.00Passed
regression: band step table3.703.75Failed
variant scenario 125.0025.00Passed
variant scenario 21.961.96Passed

SHA-256 / bad900d9b6385bb6c90f586d9d1a6d97f39355aa68cbe3477475ff3fc10cedd9

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / fba1847826888a28f01264430d841f27a9080194a674bff98d17aabc9d0b5323