currencyrate: add three new sources, git credit in README.md

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-12-16 12:07:09 +10:30
committed by Christian Decker
parent f136e5942b
commit f16b78996f
2 changed files with 24 additions and 0 deletions

View File

@@ -42,3 +42,15 @@ $ lightning-cli currencyconvert 100 USD
"msat": "515941800msat"
}
```
## Default Currency Sources
Thanks to those services who provide this information. Coindesk require
a blurb, so I did that for everyone (quoting from their front page):
* localbitcoins.com: "Buy and Sell Bitcoin Everywhere"
* www.bitstamp.net: "The original global crypto exchange."
* api.coingecko.com: "The world's most comprehensive cryptocurrency API"
* api.coindesk.com: "Powered by CoinDesk: https://www.coindesk.com/price/bitcoin"
* api.coinbase.com: "The easiest place to buy, sell, and manage your cryptocurrency portfolio."
* blockchain.info: "The World's Most Popular Way to Buy, Hold, and Use Crypto"

View File

@@ -26,6 +26,18 @@ sources = [
Source('coingecko',
'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies={currency_lc}',
['bitcoin', '{currency_lc}']),
# e.g. {"time":{"updated":"Dec 16, 2020 00:58:00 UTC","updatedISO":"2020-12-16T00:58:00+00:00","updateduk":"Dec 16, 2020 at 00:58 GMT"},"disclaimer":"This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org","bpi":{"USD":{"code":"USD","rate":"19,395.1400","description":"United States Dollar","rate_float":19395.14},"AUD":{"code":"AUD","rate":"25,663.5329","description":"Australian Dollar","rate_float":25663.5329}}}
Source('coindesk',
'https://api.coindesk.com/v1/bpi/currentprice/{currency}.json',
['bpi', '{currency}', 'rate_float']),
# e.g. {"data":{"base":"BTC","currency":"USD","amount":"19414.63"}}
Source('coinbase',
'https://api.coinbase.com/v2/prices/spot?currency={currency}',
['data', 'amount']),
# e.g. { "USD" : {"15m" : 6650.3, "last" : 6650.3, "buy" : 6650.3, "sell" : 6650.3, "symbol" : "$"}, "AUD" : {"15m" : 10857.19, "last" : 10857.19, "buy" : 10857.19, "sell" : 10857.19, "symbol" : "$"},...
Source('blockchain.info',
'https://blockchain.info/ticker',
['{currency}', 'last']),
]