FA-84555 / Betting odds conversion / Member archive
Liability computed from the unrounded lay stake or the full price · case 05
The liability shown differs from what the exchange will reserve for the placed lay.
Case contract
Green-up a matched back bet by laying at a later price (both > 1, else "invalid"). The equal-profit lay stake is back_stake * back_price / lay_price rounded half up to a cent. Using that rounded lay stake: liability = lay_stake * (lay_price - 1), profit if the selection wins = back_stake * (back_price - 1) - liability, profit if it loses = lay_stake - back_stake. Money values are exact then rounded half up to cents. Return [lay_stake, liability, profit_win, profit_lose].
Why this case matters
Exchange trading tools compute hedge stakes that equalise profit across outcomes.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control price shortened | [1500, 3000, -1000, 500] | [1500, 1500, 500, 500] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗