-
Notifications
You must be signed in to change notification settings - Fork 4
feat(options): implement lookback options #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements support for lookback options by adding dedicated tests, updating the LookbackOption type with a strike field, and refactoring the Monte Carlo pricing model to accommodate these changes.
- Added tests for fixed and floating lookback options in tests/options_pricing.rs
- Updated LookbackOption’s constructors and payoff method in src/options/types/lookback_option.rs
- Refactored MonteCarloModel pricing logic and updated examples/documentation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/options_pricing.rs | Added new tests for lookback options and adjusted tolerance values and option trait tests |
| src/options/types/lookback_option.rs | Introduced a strike field and updated constructors and payoff logic for lookback pricing |
| src/options/types/asian_option.rs | Minor update in comments related to floating strike handling |
| src/options/models/monte_carlo.rs | Altered pricing logic to use simulate_price_paths for various option types, including lookback |
| src/options/instrument.rs | Refactored max/min spot retrieval to compute values from the spot vector |
| examples/options_pricing.rs | Updated example code to reflect the new fixed-strike Asian option usage |
| README.md | Revised documentation and examples to align with the new lookback option implementation |
Comments suppressed due to low confidence (2)
src/options/models/monte_carlo.rs:228
- Lookback options are being priced using the Asian option pricing method, which could result in mispricing if the two are not equivalent. Verify whether this is the intended behavior or if a dedicated pricing method for lookback options should be implemented.
OptionStyle::Lookback(_) => self.price_asian(option),
tests/options_pricing.rs:1192
- [nitpick] The use of exp2() on 0.3 to compute epsilon is unconventional and may confuse readers. Consider using a clearer calculation, a named constant, or adding a comment to clarify its intended purpose.
let sd = 0.3f64.exp2();
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #52 +/- ##
==========================================
+ Coverage 93.20% 94.26% +1.06%
==========================================
Files 19 19
Lines 2456 2511 +55
==========================================
+ Hits 2289 2367 +78
+ Misses 167 144 -23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #34.