MM2 now offers the num-rational crate feature. This is used to represent order volumes and prices.
Komodo highly recommends that the developer use the rational number type when calculating an order's price and volume. This avoids rounding and precision errors when calculating numbers such as 1/3
, as these cannot be represented as a finite decimal.
The MM2 API typically will return both the rational number type as well as the decimal representation, but the decimal representation should be considered only a convenience feature for readability.