home | help
LIGHTNING-CURRENCYRATE(7)			       LIGHTNING-CURRENCYRATE(7)

NAME
     currencyrate  --  Command to determine a reasonable BTC exchange rate for a
     given currency

SYNOPSIS
     currencyrate currency [source]

DESCRIPTION
     Command added in v26.04.

     The currencyrate RPC command returns the exchange rate of one  BTC  in  the
     given  currency.  Rates are rounded to 3 decimal places as specified by ISO
     4217.

     Without the optional source argument the command returns  the  median  rate
     across all configured exchange-rate sources.

     With  source  specified,  the  rate reported by that specific source is re-
     turned.  The list of active source names can be  obtained	via  listcurren-
     cyrates.

     To add or disable sources see the currencyrate-add-source and currencyrate-
     disable-source options in lightningd-config(5).

     EXAMPLE  USAGE:  Get  the median USD rate: $ lightning-cli currencyrate USD
     Get the Binance USD rate: $ lightning-cli currencyrate USD binance

     *	currency (string): The ISO 4217 currency code (e.g. USD) to convert  to.
	The plugin normalises this value to uppercase before querying sources.
     *	source	(string,  optional): The name of a specific exchange-rate source
	to query.  If omitted, the median across all available	sources  is  re-
	turned.   An  error  is returned if the source name is not recognised or
	has no cached data for the requested currency. (added v26.06)

RETURN VALUE
     On success, an object is returned, containing:

     *	rate (number): The number of currency units per 1 BTC, rounded to 3 dec-
	imal places (ISO 4217).  When source  is  omitted  this  is  the  median
	across all available sources.  When source is specified this is the rate
	reported by that source.

AUTHOR
     daywalker90 is mainly responsible.

SEE ALSO
     lightning-listcurrencyrates(7),  lightning-currencyconvert(7),  lightningd-
     config(5)

RESOURCES
     Main web site: https://github.com/ElementsProject/lightning

EXAMPLES
     Example 1: Get the median BTC/USD rate across all configured sources:

     Request:

     $ lightning-cli currencyrate -k "currency"="USD"

     {
       "id": "example:currencyrate#1",
       "method": "currencyrate",
       "params": {
	 "currency": "USD"
       }
     }

     Response:

     {
       "rate": 67889.825
     }

     Example 2: Get the BTC/USD rate from the Binance source only:

     Request:

     $ lightning-cli currencyrate -k "currency"="USD" "source"="binance"

     {
       "id": "example:currencyrate#2",
       "method": "currencyrate",
       "params": {
	 "currency": "USD",
	 "source": "binance"
       }
     }

     Response:

     {
       "rate": 67931.9
     }

Core Lightning v26.06.1 			       LIGHTNING-CURRENCYRATE(7)

home | help