For a bounded option position, the useful quantity here is the lowest possible payoff at expiration and how that floor changes when another vertical spread is added. Broker interfaces may show buying power, but they usually do not explain this structural payoff capacity directly.
A price-grid implementation samples the payoff at selected underlying prices. That is unnecessary for expiration payoff because the function is piecewise linear and its breakpoints are already known.
For calls on one underlying and expiration, the terminal payoff is
V(P) = Σ qtyᵢ · max(0, P − Kᵢ). Puts use the corresponding
max(0, Kᵢ − P) term. Each term changes slope at its strike, so the
combined payoff can reach a finite minimum only at zero, at a strike, or at the
boundary of the domain.
The maximum terminal loss, max(0, −min V), follows from an
O(n log n) sort and a linear walk. This is an expiration-payoff calculation,
not a broker portfolio-margin calculation. Broker requirements also use current
option values, volatility scenarios, offsets, minimum charges, and house rules.
Within this terminal-payoff model, a positive payoff floor above spot can absorb some additional bounded vertical-spread width before the floor becomes negative. The engine reports that distance as a structural capacity measure. It does not claim that a broker will assign the same buying-power treatment.
The implementation distinguishes finite results, unbounded outcomes, missing inputs, and invalid calculations so they cannot be rendered as the same kind of number.
A naked short call has no worst case: V → −∞. That is
categorically different from "we couldn't compute it," and both are
different from a large finite number. Each is its own value in the type
system, so unbounded risk can never be rendered as a reassuring figure.
Composite scores divide by the weight of the signals that actually scored, not the total weight. A missing input drops out instead of silently counting as zero, and coverage is reported alongside the score. There's a named regression test for the case where this flips a ranking.
The global minimum is provably blind to anything on one side of spot: a
pure call book has V(0)=0, so closing the very vertical that
creates 90 points of width moves it by nothing. Every result therefore
carries both the global floor and the floor around spot, and never
collapses them into one.
Implied vol solves by bisection because Newton's method diverges where vega collapses toward zero: deep in or out of the money, exactly where a book accumulates. With a valid bracket and a monotone pricing function, bisection converges predictably. Inputs outside no-arbitrage bounds return no result rather than a fabricated volatility.
The algorithm document records three corrections to the original reasoning. One involved a deep-in-the-money short vertical: measurement showed that the interest term was material, so the specification now reports the signed value instead of clamping it to zero.
The worked example in the specification is asserted to exact equality (not within a tolerance) three independent ways: against a hand-built ladder, through the CSV parser, and through the rendered explanation text. A mismatch identifies which representation diverged.
The engine deliberately refuses to merge positions across underlyings: legs
aggregate on (expiration, right, strike) with no symbol, and
multi-symbol input raises rather than netting. A real book holds the same
contract long in one name and short in another, and a silent merge would
produce a result for a position set that was never supplied.
A Rust workspace (shared options-core
library, an egui desktop front-end drawing payoff curves, and a thin CLI)
carries the classifier that decomposes a raw position list into the structures a
trader actually thinks in: calendars, diagonals, butterflies, condors, verticals,
straddles. It explodes positions into unit lots, converts strikes to integer
micro-dollars to sidestep float comparison, and greedily allocates them in priority
order, asserting as an invariant that every contract is fully accounted for.
Alongside it, a pure-standard-library Python prototype implements the newer payoff-floor and capacity algorithms as an executable specification. It is written for review and eventual translation into the Rust implementation, not as a separate product.
This project remains closed-source because it is coupled to real brokerage exports. Every position, ladder, and figure on this page is invented for illustration; no account holdings are included.