hugues31 / coinnect

Coinnect is a Rust library aiming to provide a complete access to main crypto currencies exchanges via REST API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prices in decimal instead of f64

vegai opened this issue · comments

Looks like the main Price type is an alias for f64. As we know, using floats for currency is a bad idea due to precision issues.

It seems like this crate is the upcoming standard: https://crates.io/crates/bigdecimal -- based on some discussion I've seen and the fact that Diesel is using it. It's been oddly quiet for a while though.

The precision is indeed a problem. I'm researching how to implement this.

This could be a good idea but I will not implement it. Though I'll be happy to review a PR related to this issue. :)

I'll probably take a whack at it too, unless somebody else beats me :) Replacing f64 with bigdecimal::Bigdecimal made rustc cough up 22 errors in total -- seems like a sweeping change but possibly not a huge one.

I've done it already. I didn't send the PR because I found an error with Poloniex and I don't know yet how to solve it.

I can send the PR but it will break the orderbook test from poloniex

The PR is #39

Ah, cool! Thanks for the update.

PR #39 is now closed. @hugues31 could you bump the version and close this issue? Thanks!

Yes, we can always open an other later for the f64 problem from Poloniex