-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
Description
Refactor the DeltaInfo struct to replace all instances of the f64 type with the Decimal type. This change aims to improve numerical precision and reduce the risk of floating-point inaccuracies, especially in financial calculations where precision is critical. Ensure that all associated methods, logic, and tests are updated to accommodate this change.
Tasks
Implementation:
- Replace the
f64fields in theDeltaInfostruct withDecimal:net_delta: Decimalindividual_deltas: Vec<Decimal>neutrality_threshold: Decimal
- Update any methods or logic that rely on these fields to use the
Decimaltype. - Ensure compatibility with the
Positivetype forunderlying_price.
Testing:
- Update existing unit tests to use
Decimalvalues instead off64. - Add new tests to validate the behaviour with precise decimal inputs, including edge cases:
- Very small and very large values.
- Decimal rounding scenarios.
Documentation:
- Update documentation for the
DeltaInfostruct to reflect the change toDecimal. - Add comments to explain the choice of
Decimalfor enhanced precision.
Additional Notes
- Consider using the
rust_decimalcrate for theDecimalimplementation. - Ensure that any external interfaces or serialization/deserialization mechanisms (e.g., JSON) are compatible with the
Decimaltype. - Verify performance implications of using
Decimalin calculations and provide benchmarks if necessary.
Labels
refactor, precision, enhancement, testing, documentation
Metadata
Metadata
Assignees
Labels
No labels