-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use of float64 to represent currency values #145
Comments
Hey @kempeng, yeah this is definitely something which we plan to address. So far our focus has been using the default variable types supplied with the Golang standard library but will eventually use either the Decimal package or use our own implementation. |
I could do some work using Decimal if you want? |
That would be awesome if you could! Thanks in advance :) |
@kempeng I'd like to work on this one, Did you make any progress? |
starting to make some progress. Investigated the approach first. Propose to use shopsping's decimal package. Will implement it in a forked version |
@SamyGhannad , thank you for offering your help. I have forked the full source to kempeng/gocryptotrader, and now have a version in which I converted most of the float64's into decimal.Decimal's which compiles main.go. |
@thrasher-, if you have a moment, please take a look at my conversion of float64’s to decimals. I would be interested in your view how to integrate this back in the master code at some point? |
Great work @kempeng! Will check out your branch and test it. Merging it will be straight forward to master as it will be just a matter of updating the dependencies and imports. I would also add a script to travis which checks to see if any submitted PR's contain float64's moving forward and complaining if it finds them. |
hi @thrasher-, perhaps we can review what I have done & choices I made (not ALL float64's are converted) offline. Also, I only touch the core libraries, not for example the web service javascript codes. Not sure if I missed large chunks of code by just focussing on compiling main.go ? |
@kempeng LGTM well done on the conversion! |
what is the best way to get my forked version back into the master? |
@kempeng rebase and open a PR on the branch that has these updates then we can merge it ourselves if its too complicated |
@shazbert, thanks for the offer to help: I will need some help to do this. What is the first step I need to take? |
@kempeng Are you on our Slack it will be easier to talk there, if so what is your username so I can PM you? |
Yes, username Geert |
What's the state on this? @kempeng, would you create a pull request? |
Will create a PR for this shortly |
Hi, I'm new to this package, but I was wondering why coin values are represented as float64's? Will this not lead to rounding issues when multiple conversions are performed with these value, and perhaps in the end one would "loose" a small fraction of a coin due to rounding/float64 math? Would it not be better to represent coin values using the Decimal package?
The text was updated successfully, but these errors were encountered: