Comments (13)
Yes looks good!
PR appreciated ☀️
from kraken-go-api-client.
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.
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.
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.
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.
from kraken-go-api-client.
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.
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.
For Time
we could just use μs.
from kraken-go-api-client.
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.
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.
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.
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)
- Error `Could not execute request! (invalid character '<' looking for beginning of value)` is giving me a trouble HOT 7
- Withdraw Private Method Missing? HOT 3
- Float values returned as strings HOT 2
- Add function GetPairTickerInfo in type HOT 1
- Cannot get all data from TradesHistory and Ledgers HOT 2
- AssetPair XETCXUSD should be XETCZUSD HOT 3
- Trade info totally broken HOT 2
- Could not execute request #5! (Response Content-Type is 'text/html', but should be 'application/json'.) HOT 6
- "DepositMethods " returns 'EGeneral:Internal error' HOT 2
- Changing type of Order struct's numeric fields from float64 to string HOT 1
- Change RefID to string
- Possible trade info improvements
- Allow for custom return structs HOT 2
- How to override http.Client{} with custom one? HOT 3
- Feature: Add support for interval parameter to OHLC function
- nill response from Trades HOT 1
- ([EGeneral:Bad data:User tier is missing]) Withdrawn Info HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kraken-go-api-client.