Skip to content

32 implement barrier options #55

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

carlobortolan
Copy link
Owner

Closes #32.

carlobortolan and others added 3 commits March 30, 2025 01:14
* Implement bermudan option

* Implement bermudan option

* Update src/options/types/bermudan_option.rs

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Carlo Bortolan <[email protected]>

* Update BermudanOption

* Implement bermudan option

---------

Signed-off-by: Carlo Bortolan <[email protected]>
Co-authored-by: Copilot <[email protected]>
* Implement bermudan option

* Implement bermudan option

* Update src/options/types/bermudan_option.rs

Co-authored-by: Copilot <[email protected]>

* Update BermudanOption

* Implement bermudan option

---------

Signed-off-by: Carlo Bortolan <[email protected]>
@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 30, 2025
@carlobortolan carlobortolan self-assigned this Mar 30, 2025
@carlobortolan carlobortolan linked an issue Mar 30, 2025 that may be closed by this pull request
@carlobortolan carlobortolan requested a review from Copilot March 30, 2025 14:48
Copy link

codecov bot commented Mar 30, 2025

Codecov Report

Attention: Patch coverage is 65.31792% with 60 lines in your changes missing coverage. Please review.

Project coverage is 92.44%. Comparing base (e2f6f66) to head (fd01a34).

Files with missing lines Patch % Lines
src/options/types/barrier_option.rs 57.74% 60 Missing ⚠️

❌ Your patch check has failed because the patch coverage (65.31%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
- Coverage   94.34%   92.44%   -1.90%     
==========================================
  Files          20       21       +1     
  Lines        2580     2715     +135     
==========================================
+ Hits         2434     2510      +76     
- Misses        146      205      +59     

☔ 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.

Copy link
Contributor

@Copilot 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 PR implements barrier options and renames several fields and functions for consistency across option types.

  • Renames and updates field names (e.g., replacing "option_style" with "rainbow_type", "lookback_type" with "permutation", and "asian_type" with "permutation").
  • Updates style functions to return OptionStyle by value rather than by reference.
  • Introduces a new BarrierOption type to support barrier options.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/options/types/rainbow_option.rs Renames and removes redundant method for accessing rainbow type
src/options/types/lookback_option.rs Renames lookback type to permutation and updates style function
src/options/types/european_option.rs Modifies style function to match trait signature
src/options/types/binary_option.rs Renames binary_option_type to binary_type and adjusts style usage
src/options/types/bermudan_option.rs Adjusts style function to return OptionStyle by value
src/options/types/barrier_option.rs Introduces barrier option implementation; minor doc comment issue
src/options/types/asian_option.rs Adjusts field name from asian_type to permutation
src/options/types/american_option.rs Reorders documentation and adjusts style function
src/options/types.rs Registers BarrierOption module
src/options/traits/option.rs Updates trait signature for style function
Comments suppressed due to low confidence (1)

src/options/types/barrier_option.rs:8

  • The documentation comment incorrectly refers to 'Bermudan option' instead of 'Barrier option'. Please update it to accurately describe the struct.
/// A struct representing an Bermudan option.

@carlobortolan carlobortolan requested a review from Copilot March 31, 2025 01:04
Copy link
Contributor

@Copilot 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 PR implements support for barrier options, closing issue #32 by adding a new BarrierOption type and associated pricing logic. Key changes include:

  • Adding tests for various barrier option scenarios in both Binomial Tree and Monte Carlo pricing models.
  • Implementing the BarrierOption struct and its helper methods for option activation, knock-out, and payoff calculation.
  • Updating related models and modules to support barrier option pricing.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/options_pricing.rs Added tests for barrier options with both binomial and Monte Carlo models.
src/options/types/rainbow_option.rs Removed redundant panic and updated rainbow type field.
src/options/types/lookback_option.rs Renamed field from lookback_type to permutation.
src/options/types/european_option.rs Minor update to style method.
src/options/types/binary_option.rs Renamed binary_option_type to binary_type.
src/options/types/bermudan_option.rs Minor stylistic update.
src/options/types/barrier_option.rs New BarrierOption implementation with core barrier logic.
src/options/types/asian_option.rs Renamed asian_type to permutation.
src/options/types/american_option.rs Adjusted field ordering and updated documentation.
src/options/types.rs Added module inclusion for BarrierOption.
src/options/traits/option.rs Updated style method signature.
src/options/models/monte_carlo.rs Added barrier option pricing method.
src/options/models/binomial_tree.rs Integrated barrier option pricing into the binomial model.
README.md Updated barrier option status in the options feature matrix.
Comments suppressed due to low confidence (1)

tests/options_pricing.rs:1111

  • [nitpick] The inline comment references 'Up-And-Out' in a test for a down-and-in option, which is misleading. Please update the comment to accurately reflect the test scenario.
assert_abs_diff_eq!(price, 0.0000, epsilon = 0.0001); // Shows price for Up-And-Out (0.0000)

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 Barrier Options
1 participant