Skip to content

fix(api): scale covered-call premium to the 100-share contract (#32)#39

Open
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/covered-call-units
Open

fix(api): scale covered-call premium to the 100-share contract (#32)#39
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/covered-call-units

Conversation

@bradsmithmba

Copy link
Copy Markdown

Summary

_create_covered_call() added a per-share option premium to 100-share dollar quantities:

premium = self._get_option_price(call_option, 'bid')   # per share
max_profit = premium + (strike - current_price) * 100  # premium not scaled
max_loss   = (current_price * 100) - premium           # premium not scaled

The premium is per share; the other terms are totals for the 100 shares a covered call is written against. Both figures were therefore off by premium * 99.

Closes #32.

Example (premium=$2.50, strike=$105, price=$100)

old new (correct)
max_profit $502.50 $750 ($500 capital gain + $250 premium)
max_loss $9,997.50 $9,750 ($10,000 cost basis − $250 premium)

Fix

max_profit = (premium + strike - current_price) * 100
max_loss   = (current_price - premium) * 100

Interaction with #13 (PR #29)

PR #29 changed this strategy's profit_risk_ratio to max_profit / max_loss. This PR fixes the max_profit/max_loss inputs that ratio consumes. They touch different lines in the same function and merge cleanly; together they make the covered-call ranking correct.

🤖 Generated with Claude Code

_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 cloudtrainerwork#32

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Covered call max_profit/max_loss mix per-share premium with 100-share quantities

1 participant