docs(features): clarify that gamma * S is intentional normalization (#33)#40
Open
bradsmithmba wants to merge 1 commit into
Open
Conversation
Issue cloudtrainerwork#33 flagged that calculate_gamma multiplies by S while calculate_theta and calculate_vega divide by S, and the gamma docstring's "normalized by underlying price" wording reads as if it should divide. On investigation the math is correct and the asymmetry is required: - raw gamma scales as 1/S, so gamma * S is price-scale-invariant - raw theta and vega scale as S, so theta/S and vega/S are price-scale-invariant Verified empirically: gamma*S, theta/S, vega/S/100 are identical for S=100 and S=1000 at equal moneyness/vol/time. Changing gamma to gamma / S would REINTRODUCE price dependence (a real bug), so this is a documentation-only change: reword the docstring and comment to explain why the *S is correct and warn against "fixing" it. No behavior change. Closes cloudtrainerwork#33 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #33 (which I filed) flagged that
calculate_gammamultiplies bySwhilecalculate_theta/calculate_vegadivide byS, and the gamma docstring's "normalized by underlying price" wording reads as if it should divide.On investigation, the math is correct and the asymmetry is required. This PR is documentation-only — I'm correcting my own finding rather than the code.
Why
gamma * Sis rightThe goal is price-scale-invariant features (comparable across underlyings of any price level):
gamma * Sremoves the price dependencetheta / Sandvega / Sremove itDifferent raw scalings require opposite operations to reach the same normalization.
Verification
At equal moneyness/vol/time, the normalized values are identical across price levels:
Changing gamma to
gamma / Swould reintroduce price dependence — a real bug. So the only change here is to reword the docstring/comment to explain the reasoning and warn against "fixing" it.Change
* Sis intentional and why.Closes #33.
🤖 Generated with Claude Code