Closed camstuart closed 6 years ago
Hi @camstuart ,
Aside from the publicly available market data, we do not accept or return decimals. My apologies, I haven't update the wiki yet to be more clear about the 100,000,000 or 1e8 conversion that is used in our API. The value returned as tradingFeeRate (849999) divided by 1e8 comes out to 0.00849999, which is .849999 percent. I will make it a point to have this conversion more prominently displayed throughout the documentation.
Regards, Justin
Ok, thanks for that @justin-ngin I'm also working with the web socket connection and seeing the same thing with prices.
I had never heard on 1e8
before (my math is terrible)
Are you able to point me to any references regarding it? and specifically how I might convert to floating point numbers?
Yep, I'm definitely confused, I'm getting ticks from the websocket connection for XRP
(Ripple) with values such as: "lastPrice": 103000000
So, I do (Golang):
log.Printf("XRP Last Price: %.3f (%d)", float64((args.LastPrice / 100000000)), args.LastPrice)
Which gives me:
2018/02/08 00:00:56 XRP Last Price: 1.000 (102000000)
I'm trying to get to (in this case) 1.020
Obviously I'm going about this incorrectly
Forgive me if I'm wrong as this is essentially my first time puzzling with Golang, but I think the issue is you need an intermediate type conversion between the "lastPrice" value returned by the API and its use in your log. I used this:
var lastPrice float64 = 103000000 // or float64(args.LastPrice)
var floater float64 = (lastPrice/100000000)
log.Printf("%.2f",floater)
to get the following output:
1.03
I believe the issue in your case is the expression (args.LastPrice / 100000000)
resolves as an integer first before being converted to a float.
Hope this helps.
Regards, Justin
Thanks Justin you are correct, and for a first go at go, pretty good.
That work perfectly, thanks!
A call to the endpoint:
/account/XRP/AUD/tradingfee
returns the json response:The value in
tradingFeeRate
is a whole number, and a little misleading.To maintain backward API compatibility, an additional field
tradingFeePercentage
with a decimal value of0.849999
would be very helpful.Also, I noticed the above response structure was missing from the documentation here
Do you accept pull requests to update documentation?