Skip to content

Fixed Point Arithmetic and NewType pattern

Choose a tag to compare

@MathisWellmann MathisWellmann released this 04 Mar 14:28

This major release touches every aspect of the codebase.

  1. The NewType pattern is used to enforce correct types at function boundaries.
    This introduces BaseCurrency, QuoteCurrency, Fee and Leverage so it is impossible to accidentally pass a value denoted in USD into a function that expect BTC for example.
  2. Use of fixed point arithmetic instead of f64 for fast and precise money calculations, thanks to the fpdec crate.
  3. Lots of smaller changes to harmonize the codebase