Hedging is a linear algebra problem: invert the 2×2 matrix of the hedging options' Gamma and Vega to get their weights, then offset what's left of Delta with shares. If the matrix is singular, the model falls back to a least-squares solution instead of failing. I built the controller and model inside the existing MVC codebase, wired six commands into the menu, and checked every output by hand against the matrix maths.