mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-27 09:54:21 +01:00
The actual rate command is `currencyrates` (plural!). I just fixed the README.md, however it would be better to have the plugins name `currencyrate` aligned with its main method to circumvent users having issues trying around with a new plugin. @rusty: maybe we add a method `currencyrate` (w/o plural) that simply calls `currencyrates`...
57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
# Currencyrate plugin
|
|
|
|
This plugin provides Bitcoin currency conversion functions using various
|
|
different backends and taking the median. It caches results for an hour.
|
|
|
|
## Installation
|
|
|
|
For general plugin installation instructions see the repos main
|
|
[README.md](https://github.com/lightningd/plugins/blob/master/README.md#Installation)
|
|
|
|
## Options:
|
|
|
|
* --add-source: Add a source, of form NAME,URL,MEMBERS where URL and MEMBERS
|
|
can have `{currency}` and `{currency_lc}` to substitute for upper-case and
|
|
lower-case currency names. MEMBERS is how to deconstruct the result, for
|
|
example if the result is `{"USD": {"last_trade": 12456.79}}` then MEMBERS
|
|
would be "USD,last_trade".
|
|
* --disable-source: Disable the source with this name.
|
|
|
|
For c-lightning versions 0.9.3 and above, you can specify these
|
|
options multiple times to add or disable multiple sources.
|
|
|
|
## Commands
|
|
|
|
`currencyrates` returns the number of msats per unit from every backend, eg:
|
|
|
|
```
|
|
$ lightning-cli currencyrates USD
|
|
{
|
|
"localbitcoins": "5347227msat",
|
|
"bitstamp": "5577515msat",
|
|
"coingecko": "5579273msat",
|
|
}
|
|
```
|
|
|
|
`currencyconvert` converts the given amount and currency into msats, using the
|
|
median from the above results. eg:
|
|
|
|
```
|
|
$ 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"
|