Summary
The expiry early-return in _calculate_probability_above returns 0.0 when current_price == target_price, but the correct value is 0.5 (equal probability of finishing above or below the strike from ATM). This zeroes out prob_profit for ATM strategies at expiration, making them appear worthless.
Evidence
src/api/enhanced_strategy_recommender.py lines 594-595:
if days <= 0:
return 1.0 if current_price > target_price else 0.0
When current_price == target_price, returns 0.0 instead of 0.5.
Fix
if days <= 0:
if current_price > target_price:
return 1.0
elif current_price == target_price:
return 0.5
return 0.0
Summary
The expiry early-return in
_calculate_probability_abovereturns0.0whencurrent_price == target_price, but the correct value is0.5(equal probability of finishing above or below the strike from ATM). This zeroes outprob_profitfor ATM strategies at expiration, making them appear worthless.Evidence
src/api/enhanced_strategy_recommender.pylines 594-595:When
current_price == target_price, returns0.0instead of0.5.Fix