feat(options): implement barrier options#55
Conversation
* Implement bermudan option * Implement bermudan option * Update src/options/types/bermudan_option.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Carlo Bortolan <106114526+carlobortolan@users.noreply.github.com> * Update BermudanOption * Implement bermudan option --------- Signed-off-by: Carlo Bortolan <106114526+carlobortolan@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Implement bermudan option * Implement bermudan option * Update src/options/types/bermudan_option.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update BermudanOption * Implement bermudan option --------- Signed-off-by: Carlo Bortolan <106114526+carlobortolan@users.noreply.github.com>
…lement-barrier-options
Codecov ReportAttention: Patch coverage is
❌ 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
…lement-barrier-options
There was a problem hiding this comment.
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)
Closes #32.