-
Notifications
You must be signed in to change notification settings - Fork 166
Fixed-point math #227
Copy link
Copy link
Closed
Description
The library currently uses lots of floating-point math which leads to rounding errors, which is unacceptable for financial applications.
Here is some suggestions:
Amountclass should present asset amount asDecimalPriceclass should useFractionforself["price"]- Internal conversions in
Priceclass (.invert()should not use floating-point math - More general, all API objects exposed to library users should present prices as
Fraction, and all amounts inDecimal Market.buy()andMarket.sell()methods should be refactored to useDecimalfor amounts andFractionfor price- Add additional method to
Marketclass to place an order with any amount of BASE and QUOTE, likeplace_raw_order(amount_to_sell: Amount, min_to_receive: Amount)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels