Opus finding
`sell_shares` does not validate market.outcome — passing a non-existent outcome silently sells from any matching position
mediumapi-contractmedium
- backend/wonderwall/simulations/polymarket/platform.py:196-220
Unlike buy_shares, sell_shares never verifies that the supplied `outcome` matches the market's outcome_a or outcome_b. The position lookup will only succeed if the user actually has a position with that label, so silently OK for valid inputs. But quote_sell's behavior when `outcome == outcome_a_name` vs. else assumes the input is a valid outcome label — passing garbage takes the else branch (treating it as outcome_b) which silently sells from R_b reserve regardless. This is API-contract weak; better to fail fast.
Recommendation
Validate `outcome in (outcome_a, outcome_b)` in sell_shares, mirroring buy_shares.