FAILURE MAP
← Case archive

FA-61670 / Options payoff and settlement / Member archive

FIFO realized P&L for option trades: closing trades match the newest lot · case 05

Realized P&L follows LIFO instead of FIFO.

Member previewVariant 5 · 3 implementations · 8 checks per implementation

Case contract

Inputs trades [side B/S, contracts, premium], multiplier and fee per contract. Positions may be long or short. Each trade first closes opposite-direction lots oldest first; realized P&L per matched contract is (close - open) for long lots and (open - close) for short lots, times the multiplier. Any remainder opens a new lot in the trade direction. Fees = contracts traded * fee. Work in cents; return [net position, realized, fees].

Why this case matters

Option expiry, exercise and settlement engines move cash and shares; a wrong branch misstates obligations.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
regression lot matching order 1[6, -2260.0, 0.0][6, -1450.0, 0.0]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 ↗