feat: Implement Spread option pricing model #280
Merged
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
This PR implements pricing support for Spread options as described in issue #245. Spread options are multi-asset options whose payoff depends on the difference between two underlying asset prices.
What was implemented
ExoticParams Extensions
Added spread-specific fields to
ExoticParams:spread_second_asset_volatility: Volatility of the second underlying assetspread_second_asset_dividend: Dividend yield of the second assetspread_correlation: Correlation between the two assets (-1 to 1)Pricing Implementation
Created
src/pricing/spread.rswith two pricing methods:Kirk's Approximation (K ≠ 0)
Margrabe's Formula (K = 0)
Payoff Structure
Why These Methods?
Technical Decisions
big_nfunction for normal CDF calculationsCommon Applications
Tests
12 comprehensive unit tests covering:
Files Changed
src/model/option.rs: Added spread fields toExoticParamssrc/model/format.rs: Updated Display implementationssrc/pricing/spread.rs: NEW - Spread option pricing implementationsrc/pricing/mod.rs: Added spread module exportsrc/pricing/black_scholes_model.rs: Routed Spread to new modulesrc/pricing/rainbow.rs: Updated ExoticParams in testssrc/pricing/cliquet.rs: Updated ExoticParams in testsexamples/examples_exotics/src/bin/cliquet_example.rs: Updated ExoticParamsCloses #245