Context
This PR aims to improve the Black-Scholes calculator implementation in Rust by increasing test coverage and enhancing code safety and maintainability.
Changes
Added multiple tests to ensure the robustness of the Black-Scholes calculator. However, due to an issue with the calculation in case #8, some tests are marked as TODO and their execution is commented out.
Refactored OptionType from using f32 to an enum. This change enhances type safety and ensures that only valid values are used, particularly for theta calculations which should be restricted to 1.0 and -1.0. The new enum will enforce correct behaviour and prevent invalid value usage.
Context This PR aims to improve the Black-Scholes calculator implementation in Rust by increasing test coverage and enhancing code safety and maintainability.
Changes
OptionType
from usingf32
to anenum
. This change enhances type safety and ensures that only valid values are used, particularly for theta calculations which should be restricted to1.0
and-1.0
. The new enum will enforce correct behaviour and prevent invalid value usage.