Skip to content

Bug: _calculate_probability_above returns 0.0 for ATM at expiry — should be 0.5 #58

Description

@bradsmithmba

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions