AustEcon / bitsv

BitSV: Bitcoin made easy. Documentation:
https://AustEcon.github.io/bitsv
MIT License
96 stars 28 forks source link

rates / satoshi_to_currency_cached #59

Closed breign closed 4 years ago

breign commented 4 years ago

domain bitcoinsv-rates.com has expired api at http://bitcoinsv-rates.com/api/rates/ used by satoshi_to_currency_cached is broken is there some other api that can be consumed?

AustEcon commented 4 years ago

Ah rats... I've put the word out to see if the owner gets in contact...

I think I have some old code lying around where I combined two separate APIs to get us by...

It's a bit late here though so won't be able to get a fix out for at least 1 or 2 days sorry.

AustEcon commented 4 years ago

https://github.com/AustEcon/bitsv/pull/33

This pull request might have useful code we can re-use...

AustEcon commented 4 years ago

https://api.bitfinex.com/v1/pubticker/bsvusd

Works... so we can figure something out...

ghost commented 4 years ago

I don't understand why it's not falling back to that API in the first place.

ghost commented 4 years ago

Ah, it's because it's a json decoding failure. The API returns a 302 which gives a 200 and the output isn't JSON. JSON decoding failures aren't in our ignored errors.

We should probably first yank out the bitcoinsvrates part of the API, which would leave us without redundancy (which was broken for a while anyways) but get things working again.

AustEcon commented 4 years ago

Hmm. I think the reason it's down is that not only the 1st rates API has probably been down a while but the 2nd one for redundancy has also gone down... https://www.freeforexapi.com/api/live?pairs=USDAUD

AustEcon commented 4 years ago

I'm googling but not finding any suitable replacement yet... is this an urgent thing for you? If we can find a suitable API it should be an easy fix to just swap out the url basically and remove unsupported currencies...

Pull Requests welcome...

If we cannot find a free API with no signups our options become: 1) Run one ourselves... (I don't like that option) 2) Add to the library an easy method for adding the API_KEY + url of a few supported, Free Exchange rate APIs people want to go and sign up to...

AustEcon commented 4 years ago

We have a winner! https://www.exchangerate-api.com/

AustEcon commented 4 years ago

https://github.com/AustEcon/bitsv/pull/60

AustEcon commented 4 years ago

new version is now out on pypi

ghost commented 4 years ago

Works, thank you!!