cryptoqween / cryptoqween.github.io

CryptoCompare API tutorials
194 stars 114 forks source link

24h Change display error? #8

Closed coinuser closed 6 years ago

coinuser commented 6 years ago

Hi,

I got this issue that the 24h Change will display : Ξ NaN (NaN%) after sometime, it happens with your example streamer/current also, it will stay there for several minutes than display back the actual price change and percentage. Is this a bug or normal?

Screenshot https://imgur.com/a/cRbuQ

Another issue I have is I'm not able to get the the data from BLK and XPM coin, I have included '5~CCCAGG~XPM~USD', '5~CCCAGG~BLK~USD' in the var subscription. BLK display old and inactive quotes and XPM show nothing. I can add LTC, DASH, BCH and they load fine. Can you help me with this?

Thank you so much.

yofisim commented 6 years ago

@coinuser

I was writing down that I had the same problem, but while reviewing my code, I understood the situation.

If you check here: https://www.cryptocompare.com/coins#/btc

All the prices are in BTC, and you will not have the Bitcoin currency in the list. And it's very understandable. Some little or growing currencies are only compared to other cryptocurrencies, and not compared to any physic currencies like $ or €.

Which means if you want to display data for all your currencies subscriptions, you will have to choose BTC for the {ToSymbol}.

If you still want to display the price in $, you will have to convert the price from BTC to USD before displaying it on screen.

Hope this helps.

coinuser commented 6 years ago

@yofisim

Thank you for replying, the fixed bugs stream.js has fixed the Ξ NaN (NaN%) issue.

As for the price for some currencies, appreciate your explaination and I understood it. I will get the btc value first and convert it to usd. Thank you.

gwuah commented 6 years ago

@coinuser Thanks for your explanation. This issue needs to be upvoted. I can only imagine the stress any dev will go through trying to fix this problem. I actually thought i was doing something wrong

cryptoqween commented 6 years ago

Hi all,

sorry for the delay. We don't do conversions via Websocket yet, but you can have a look at the following API endpoint, which gives to the subsNeeded, and the conversion type to do the conversion yourself.

https://min-api.cryptocompare.com/data/subsWatchlist?fsyms=BTC,MLN,DASH&tsym=USD

About the conversion types read here https://blog.cryptocompare.com/the-api-dissection-e2ab99a648e5

We will consider adding conversion in the future.