-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Description
Update the Options struct and its associated methods to replace f64 fields with Decimal or Positive where applicable. This change ensures higher precision and enforces positive values for fields that should not accept negative numbers.
Tasks
Code Changes
- Replace the
implied_volatilityfield type fromf64toDecimal. - Replace the
risk_free_ratefield type fromf64toDecimal. - Replace the
dividend_yieldfield type fromf64toDecimal. - Ensure compatibility between
PositiveandDecimalfor calculations involvingPositivefields.
Method Updates
- Refactor methods to accommodate
DecimalorPositivechanges.- Update calculations involving
implied_volatility,risk_free_rate, ordividend_yieldto useDecimalmath operations. - Validate that fields and calculations respect precision requirements.
- Update calculations involving
- Add error handling or validations where necessary to ensure no invalid conversions occur between types.
Testing
- Write or update unit tests to verify:
- Correct instantiation of
Optionsstruct withDecimalandPositivefields. - Accurate calculations in methods using the updated field types.
- Validation of edge cases such as zero or invalid input values.
- Correct instantiation of
- Run tests to confirm that the refactored code works as intended.
Documentation
- Update documentation or comments for the
Optionsstruct to reflect the new types. - Provide examples of how to use the updated struct and its methods.
Additional Notes
- Ensure all dependencies for
DecimalandPositiveare properly imported and configured. - Consider the potential performance implications of switching from
f64toDecimaland optimize where necessary. - Verify that the changes align with the project's broader goals for precision and data validation.
Labels
enhancement, refactor, precision, data-validation, testing, documentation
Metadata
Metadata
Assignees
Labels
No labels