Skip to content

Conversation

@carlobortolan
Copy link
Owner

Closes #34.

@carlobortolan carlobortolan added documentation Improvements or additions to documentation enhancement New feature or request testing Issue related to existing or missing test cases labels Mar 29, 2025
@carlobortolan carlobortolan requested a review from Copilot March 29, 2025 00:51
@carlobortolan carlobortolan self-assigned this Mar 29, 2025
@carlobortolan carlobortolan linked an issue Mar 29, 2025 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a 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
Copy link

codecov bot commented Mar 29, 2025

Codecov Report

Attention: Patch coverage is 97.16981% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.26%. Comparing base (1b381c8) to head (09a44f5).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/options/models/monte_carlo.rs 90.32% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@carlobortolan carlobortolan merged commit 3fd5ef0 into master Mar 29, 2025
10 checks passed
@carlobortolan carlobortolan deleted the 34-implement-lookback-options branch March 29, 2025 02:57
@carlobortolan carlobortolan changed the title Implement lookback options feat(options): implement lookback options Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request testing Issue related to existing or missing test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Lookback Options

2 participants