GithubHelp home page GithubHelp logo

Comments (13)

beldur avatar beldur commented on June 26, 2024 1

Yes looks good!

PR appreciated ☀️

from kraken-go-api-client.

beldur avatar beldur commented on June 26, 2024

I added the Trades Call as an API Method: 7dcae7a

For usage you can look into the test method.

Does this answer your question?

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

Nice.
I created small modification. What do you think? Should I make PR?
https://github.com/Glavic/kraken-go-api-client/commits/master

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

Hi, me again.
Just thinking that float is not a good variable for storing sensitive information like Price, Volume and Time in Trades() function. Kraken returns strings (and for a good reason) and u convert it to float64 :(
We could solve this problem with Rational struct (RAT) or plug-in like this: https://github.com/shopspring/decimal
Whay say u?

from kraken-go-api-client.

beldur avatar beldur commented on June 26, 2024

Hi,

I'm a bit reluctant to add a dependency to another package, but I agree that float is the wrong type. Maybe we can use int? The number of decimals can be queried from Kraken Assets API call.

What do you think?

from kraken-go-api-client.

rikonor avatar rikonor commented on June 26, 2024

from kraken-go-api-client.

beldur avatar beldur commented on June 26, 2024

I quote here directly from the decimal project:

Because float64s (or any binary floating point type, actually) can't represent numbers such as 0.1 exactly.
Consider this code: https://play.golang.org/p/TQBd4yJe6B

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

I agree that using other plug-ins isn't great idea; I just linked it if there is some idea to "borrow"...
Are u thinking of running Assets() every time Trades() is called? Or we could just use max decimals for all assets (for example 10)? Just hope that int64 will be enough.

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

For Time we could just use μs.

from kraken-go-api-client.

beldur avatar beldur commented on June 26, 2024

If you call Assets for Trades you are in danger of messing up rate limiting tracking for consumers of the API. (Kraken Rate Limiting)

So I would keep the responsibility to the API consumer to know that eg. EUR has to be divided by 5 (197001100 / 5 = 1970.011 EUR) while JPY has to be divided by 3 (261531900 / 3 = 261531.9 JPY).

Another option would be to change the type to string and let the consumer decide how to deal with it.

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

So I would keep the responsibility to the API consumer to know that eg. EUR has to be divided by 5 (197001100 / 5 = 1970.011 EUR) while JPY has to be divided by 3 (261531900 / 3 = 261531.9 JPY).

But how will u know in Trades() how much decimals has EUR or JPY? I would not go into hardcoding those values, since they can change in the future...

On other hand, more than I think about it, it would be better to let API consumer decide what to do with the data received from Kraken API...

from kraken-go-api-client.

beldur avatar beldur commented on June 26, 2024

On other hand, more than I think about it, it would be better to let API consumer decide what to do with the data received from Kraken API...

I updated the code accordingly 0d429b8

from kraken-go-api-client.

Glavic avatar Glavic commented on June 26, 2024

I would leave it as it is, only string; and let consumer do the magic with it :)

from kraken-go-api-client.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.