extension
extension copied to clipboard
Consistent currency math utilities
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
@Shadowfiend would you call this done, considering the utils you've written?
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.)