FAILURE MAP
← Case archive

FA-84606 / Betting odds conversion / Open access

Prices below the ladder minimum not rejected · case 01

A 1.00 request crashes the snapping loop or the 1.01 minimum is rejected.

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

ROOT CAUSE

The lower range check allows 1.00.

VERIFIED REPAIR

Reject only prices below 1.01 or above 1000.

Unsuccessful approach: Rejecting 1.01 itself removes the lowest valid tick.

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, 5), (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 < 100 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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.43', 'back'), '3.40'),
  ('variant scenario 2', ('715.39', 'lay'), '720.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: ladder range', ('1.01', 'back'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('23.13', 'lay'), '24.00'),
  ('variant scenario 2', ('2.94', 'back'), '2.94')],
 [('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: ladder range', ('1.00', 'lay'), 'invalid'),
  ('regression: ladder range', ('1.01', 'lay'), '1.01'),
  ('variant scenario 1', ('20.82', 'lay'), '21.00'),
  ('variant scenario 2', ('2.89', 'lay'), '2.90')],
 [('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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.05', 'lay'), '3.05'),
  ('variant scenario 2', ('3.46', 'lay'), '3.50')],
 [('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: ladder range', ('1.01', 'lay'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('1.30', 'back'), '1.30'),
  ('variant scenario 2', ('16.96', 'back'), '16.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.053.05Passed
boundary lay rounds into next band2.002.00Passed
boundary below ladderraised UnboundLocalErrorinvalidFailed
control top of ladder1000.001000.00Passed
regression: ladder rangeraised UnboundLocalErrorinvalidFailed
regression: ladder range1.011.01Passed
variant scenario 13.403.40Passed
variant scenario 2720.00720.00Passed

SHA-256 / 84f6399fd62e958472d48f610972978466e8d48915ff3f5d886b272b3e705b03

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, 5), (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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.43', 'back'), '3.40'),
  ('variant scenario 2', ('715.39', 'lay'), '720.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: ladder range', ('1.01', 'back'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('23.13', 'lay'), '24.00'),
  ('variant scenario 2', ('2.94', 'back'), '2.94')],
 [('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: ladder range', ('1.00', 'lay'), 'invalid'),
  ('regression: ladder range', ('1.01', 'lay'), '1.01'),
  ('variant scenario 1', ('20.82', 'lay'), '21.00'),
  ('variant scenario 2', ('2.89', 'lay'), '2.90')],
 [('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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.05', 'lay'), '3.05'),
  ('variant scenario 2', ('3.46', 'lay'), '3.50')],
 [('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: ladder range', ('1.01', 'lay'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('1.30', 'back'), '1.30'),
  ('variant scenario 2', ('16.96', 'back'), '16.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.053.05Passed
boundary lay rounds into next band2.002.00Passed
boundary below ladderinvalidinvalidPassed
control top of ladder1000.001000.00Passed
regression: ladder rangeinvalidinvalidPassed
regression: ladder rangeinvalid1.01Failed
variant scenario 13.403.40Passed
variant scenario 2720.00720.00Passed

SHA-256 / 64d9a87fbba1b5607b896dbfc3ff5d17a30a53c74907c0c6ac8818b3d8e031a8

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(price, side):
    BANDS = [(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)]
    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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.43', 'back'), '3.40'),
  ('variant scenario 2', ('715.39', 'lay'), '720.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: ladder range', ('1.01', 'back'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('23.13', 'lay'), '24.00'),
  ('variant scenario 2', ('2.94', 'back'), '2.94')],
 [('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: ladder range', ('1.00', 'lay'), 'invalid'),
  ('regression: ladder range', ('1.01', 'lay'), '1.01'),
  ('variant scenario 1', ('20.82', 'lay'), '21.00'),
  ('variant scenario 2', ('2.89', 'lay'), '2.90')],
 [('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: ladder range', ('1.00', 'back'), 'invalid'),
  ('regression: ladder range', ('1.01', 'back'), '1.01'),
  ('variant scenario 1', ('3.05', 'lay'), '3.05'),
  ('variant scenario 2', ('3.46', 'lay'), '3.50')],
 [('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: ladder range', ('1.01', 'lay'), '1.01'),
  ('regression: ladder range', ('1.00', 'lay'), 'invalid'),
  ('variant scenario 1', ('1.30', 'back'), '1.30'),
  ('variant scenario 2', ('16.96', 'back'), '16.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.053.05Passed
boundary lay rounds into next band2.002.00Passed
boundary below ladderinvalidinvalidPassed
control top of ladder1000.001000.00Passed
regression: ladder rangeinvalidinvalidPassed
regression: ladder range1.011.01Passed
variant scenario 13.403.40Passed
variant scenario 2720.00720.00Passed

SHA-256 / ea83b808a3e6333b6d1fdbc975bf82a723c9cb0f12bfbc04b5095a63f53dac18

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

Case digest / b5987464e7b470541d52ba3da637c7ca01be6b8fbc69a3669e2823def33f145f