FAILURE MAP
← Case archive

FA-84616 / Betting odds conversion / Open access

Off-ladder prices silently snapped · case 01

A 2.01 request is treated as a valid tick.

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

ROOT CAUSE

The within-band remainder is never checked.

THE FAILURE

The within-band remainder is never checked.

Unsuccessful approach: Rounding to the nearest tick index still accepts invalid prices.

Case contract

Signed tick distance from price a to price b on the ladder [(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)] (hundredths). Prices must be within 1.01..1000 ("invalid") and exactly on a tick ("off ladder"). Tick index counts all ticks of lower bands ((hi - lo) / step each) plus (v - lo) / step within the band. Return index(b) - index(a).

Why this case matters

Trading bots express stop-loss and offset orders as tick counts across ladder bands.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(a, b):
    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)]
    def index(v):
        n = 0
        for lo, hi, step in BANDS:
            if v >= hi:
                n += (hi - lo) // step
            else:
                return n + (v - lo) // step
        return None
    out = []
    for p in (a, b):
        c = Fraction(p) * 100
        if c.denominator != 1 or c < 101 or c > 100000:
            return 'invalid'
        i = index(int(c))
        if i is None:
            return 'off ladder'
        out.append(i)
    return out[1] - out[0]
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 within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('2.01', '5.50'), 'off ladder'),
  ('variant scenario 1', ('29.00', '10.00'), -29),
  ('variant scenario 2', ('12.00', '160.00'), 52)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('55.00', '11.01'), 'off ladder'),
  ('variant scenario 1', ('2.18', '2.72'), 27),
  ('variant scenario 2', ('190.00', '3.20'), -115)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('5.51', '1.61'), 'off ladder'),
  ('variant scenario 1', ('1.57', '13.00'), 159),
  ('variant scenario 2', ('2.84', '3.50'), 18)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('4.41', '4.00'), 'off ladder'),
  ('variant scenario 1', ('6.20', '13.00'), 25),
  ('variant scenario 2', ('80.00', '15.50'), -35)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('5.91', '20.00'), 'off ladder'),
  ('variant scenario 1', ('16.50', '1.41'), -182),
  ('variant scenario 2', ('10.00', '2.32'), -94)]]
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 within band1010Passed
boundary crossing two44Passed
control downward move-7-7Passed
boundary off ladder25off ladderFailed
control full ladder349349Passed
regression: off ladder detection85off ladderFailed
variant scenario 1-29-29Passed
variant scenario 25252Passed

SHA-256 / 09f990f2140586e406657c0102dae059455a578c97f5b304feafc7651f43a0c1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(a, b):
    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)]
    def index(v):
        n = 0
        for lo, hi, step in BANDS:
            if v >= hi:
                n += (hi - lo) // step
            else:
                return n + round((v - lo) / step)
        return None
    out = []
    for p in (a, b):
        c = Fraction(p) * 100
        if c.denominator != 1 or c < 101 or c > 100000:
            return 'invalid'
        i = index(int(c))
        if i is None:
            return 'off ladder'
        out.append(i)
    return out[1] - out[0]
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 within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('2.01', '5.50'), 'off ladder'),
  ('variant scenario 1', ('29.00', '10.00'), -29),
  ('variant scenario 2', ('12.00', '160.00'), 52)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('55.00', '11.01'), 'off ladder'),
  ('variant scenario 1', ('2.18', '2.72'), 27),
  ('variant scenario 2', ('190.00', '3.20'), -115)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('5.51', '1.61'), 'off ladder'),
  ('variant scenario 1', ('1.57', '13.00'), 159),
  ('variant scenario 2', ('2.84', '3.50'), 18)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('4.41', '4.00'), 'off ladder'),
  ('variant scenario 1', ('6.20', '13.00'), 25),
  ('variant scenario 2', ('80.00', '15.50'), -35)],
 [('control within band', ('1.50', '1.60'), 10),
  ('boundary crossing two', ('1.98', '2.04'), 4),
  ('control downward move', ('3.10', '2.90'), -7),
  ('boundary off ladder', ('2.01', '2.50'), 'off ladder'),
  ('control full ladder', ('1.01', '1000'), 349),
  ('regression: off ladder detection', ('5.91', '20.00'), 'off ladder'),
  ('variant scenario 1', ('16.50', '1.41'), -182),
  ('variant scenario 2', ('10.00', '2.32'), -94)]]
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 within band1010Passed
boundary crossing two44Passed
control downward move-7-7Passed
boundary off ladder25off ladderFailed
control full ladder349349Passed
regression: off ladder detection85off ladderFailed
variant scenario 1-29-29Passed
variant scenario 25252Passed

SHA-256 / ec5573e14fe26b32ebb627a8d2d48f5c8b092a3c6070f3014e69dcd27468dc70

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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.594443+00:00.

Case digest / bd33ebeb826bb5d4026c41a85dec4636cf552ade871e5d3e2c0d22ba30d4be9d