BigNocciolino / CryptoTracker

Integration for Home Assistant to implement a crypto tracking system
23 stars 4 forks source link

Update readme to include more currencies #13

Closed blue-hound closed 2 years ago

blue-hound commented 2 years ago

Hey, great plugin. I am pretty sure I didn't read your docs a couple of weeks ago when I setup the plugin and I tried Canadian dollars for comparisons. The sensors didn't work as per your docs when I finally read them. I went to Cryptonator today and played around a bit, changed my comparisons in HA to BTC-CAD, etc and they all worked. So there might be a few more currencies supported now. Just an FYI.

BigNocciolino commented 2 years ago

Thank you for pointing out this inconsistency, unfortunately the site does not have good documentation.

So I wrote a little test utility that I uploaded to another branch.

And yes, support for currencies has been extended, there is a full report on the solution in the new branch.

blue-hound commented 2 years ago

Thanks! It's interesting though, it seems that not all types will convert to CAD. SHIB for example won't.

https://www.cryptonator.com/rates/SHIB-USD

vs.

https://www.cryptonator.com/rates/SHIB-CAD

The CAD conversion gives me the BTC amount divided by a few million I guess. If you look at the conversion details on the CAD conversion, you get this:

As there are no actual trades with this pair of currencies, represented rate is calculated via BTC

Which seems kinda silly. If you retrieve that via the API it just returns a value with no error given. So perhaps a caution should be added.

Thanks for your work!

BigNocciolino commented 2 years ago

Hi, thanks for the detailed report, after playing a bit on the site I noticed that too many values ​​are incorrect, also comparing them with other brokers. (I know the values ​​can be different, but we are talking about enormously different values).

I had never noticed this thing, since the values ​​with EUR, are quite plausible, at this point not being able to do much, since I have no control over the values ​​that are generated by the API, I will try to find an alternative solution.

blue-hound commented 2 years ago

Yeah, I just noticed a few more currencies that are way off too. It's weird they do that because their site will do, for example, a direct USD-CAD conversion. So, if they have a USD to SHIB and someone is trying to see what it is in CAD instead of displaying a completely erroneous number, why not convert it based on that or just not convert it at all. I am thinking of doing a pull request (but my Python isn't the best) to help you out by doing a conversion vs the USD, the problem is though IIRC, their API JSON response doesn't indicate whether or not the conversion is correct.

Edit: For example https://api.cryptonator.com/api/ticker/shib-usd returns

{"ticker":{"base":"SHIB","target":"USD","price":"0.00002780","volume":"3520983843528.89990234","change":"0.00000000"},"timestamp":1641684542,"success":true,"error":""}

https://api.cryptonator.com/api/ticker/shib-cad

{"ticker":{"base":"SHIB","target":"CAD","price":"0.00052606","volume":"","change":"-0.00000281"},"timestamp":1641684601,"success":true,"error":""}

That isn't useful at all, the price returned in the CAD conversion is the BTC price divided down, bizarre.

Edit 2: Ahh, but I see the volume field is empty. I can check out whether that is true for all of the erroneous ones. If it is, that might be something I can work with.