From 1da7aee1df536c891ce42162f5b65e0481ddfc6e Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 11 Jun 2026 14:58:43 -0500 Subject: [PATCH] fix(api): scale covered-call premium to the 100-share contract _create_covered_call() added a per-share option premium to 100-share dollar quantities: max_profit = premium + (strike - current_price) * 100 max_loss = (current_price * 100) - premium premium is per share, while the other terms are totals for the 100 shares a covered call is written against, so both figures were off by premium * 99. For premium=$2.50, strike=$105, price=$100 the old code reported max_profit $502.50 and max_loss $9,997.50 instead of $750 and $9,750. Scale the premium to the contract so all terms are total dollars: max_profit = (premium + strike - current_price) * 100 max_loss = (current_price - premium) * 100 Closes #32 Co-Authored-By: Claude Opus 4.8 --- src/api/enhanced_strategy_recommender.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/enhanced_strategy_recommender.py b/src/api/enhanced_strategy_recommender.py index 3c68d49..cf1804d 100644 --- a/src/api/enhanced_strategy_recommender.py +++ b/src/api/enhanced_strategy_recommender.py @@ -471,8 +471,12 @@ def _create_covered_call(self, symbol: str, current_price: float, return None premium = self._get_option_price(call_option, 'bid') - max_profit = premium + (strike - current_price) * 100 # Assume 100 shares - max_loss = (current_price * 100) - premium # Stock could go to zero + # premium is per share; scale it to the 100-share contract so every term + # is in total dollars. Max profit if called away = premium + capital gain + # to the strike; max loss if the stock goes to zero = cost basis less the + # premium collected. + max_profit = (premium + strike - current_price) * 100 + max_loss = (current_price - premium) * 100 # Stock could go to zero # Probability call expires worthless (we keep premium) prob_profit = 1 - self._calculate_probability_above(current_price, strike, volatility,