extension icon indicating copy to clipboard operation
extension copied to clipboard

Consistent currency math utilities

Open mhluongo opened this issue 3 years ago • 1 comments

Right now, we're relying on bigint and the fact that most crypto assets have a fixed-length amount / known quantum. Unfortunately, price does not have that sort of fixed precision, and will need to be dealt with more flexibly.

We need to

  • [ ] Include a BigDecimal type and use it for prices, fixing the precision of each to what the trading venue or data source gives us
  • [ ] Make sure BigDecimal is serializable
  • [ ] Gather up the precision helpers we've been using and make them easy for crypto + fiat across the fronte and backend

mhluongo avatar Sep 16 '21 20:09 mhluongo

@Shadowfiend would you call this done, considering the utils you've written?

mhluongo avatar Aug 07 '22 18:08 mhluongo

I think between desiredDecimals and our use of bigint for most price and asset quantities we can close this. (Although I'm sure if we did an audit we'd find places where we are not currently using bigint that we could be.)

0xDaedalus avatar Feb 10 '23 18:02 0xDaedalus