mirror of
https://github.com/bitcoin/bips.git
synced 2025-02-24 07:28:03 +01:00
bip-xchgrate: Add examples
This commit is contained in:
parent
12316e3dec
commit
a361076d49
1 changed files with 45 additions and 0 deletions
|
@ -57,6 +57,14 @@ Each currency-pair will receive a separate result, a JSON Object, with the follo
|
||||||
* ''locale'' - If provided, a String with the applicable Unicode CLDR locale.
|
* ''locale'' - If provided, a String with the applicable Unicode CLDR locale.
|
||||||
* ''desc'' - Optional description. For example, it could be "Based on Florida BTM prices." or any other short String that provides information useful to the user. SHOULD be shorter than 45 characters.
|
* ''desc'' - Optional description. For example, it could be "Based on Florida BTM prices." or any other short String that provides information useful to the user. SHOULD be shorter than 45 characters.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Request: http://api.example.tld/?mode=list"e=USD&base=XBT&locale=en_US,en_GB
|
||||||
|
Result:
|
||||||
|
{"cp":"XBTUSD-ver4", "quote":"USD", "base": "XBT", "locale": "en_US", "desc": "Smoothed averages"}
|
||||||
|
{"cp":"2", "quote":"USD", "base": "XBT", "locale": "en_US", "desc": "Updated per-trade"}
|
||||||
|
{"cp":"XBTUSD-european", "quote":"USD", "base": "XBT", "locale": "en_GB"}
|
||||||
|
|
||||||
===Currency-pair information===
|
===Currency-pair information===
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -82,6 +90,13 @@ Each currency-pair will receive a separate result, a JSON Object, with the follo
|
||||||
* ''history'' - If provided, indicates the server has historical records going back no earlier than the POSIX timestamp provided as a value.
|
* ''history'' - If provided, indicates the server has historical records going back no earlier than the POSIX timestamp provided as a value.
|
||||||
* ''archive'' - If provided, indicates the server no longer has current rates, and has no historical rates more recent than the POSIX timestamp provided as a value.
|
* ''archive'' - If provided, indicates the server no longer has current rates, and has no historical rates more recent than the POSIX timestamp provided as a value.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Request: http://api.example.tld/?mode=info&cp=XBTUSD-ver4,2
|
||||||
|
Result:
|
||||||
|
{"cp":"XBTUSD-ver4", "quote":"USD", "base": "XBT", "locale": "en_US", "desc": "Smoothed averages", "longdesc": "USD price quotes as compared to Bitcoin value\n\nRecommended for casual usage", "symbol": [["-$", "$"], null], "digits": "arabic", "grouping": [3, ",", 0], "fraction_sep": ".", "fraction_digits": [0, 2, 2], "minpoll": 300, "longpoll": true, "history": 1457231416}
|
||||||
|
{"cp":"2", "quote":"USD", "base": "XBT", "locale": "en_US", "desc": "Updated per-trade", "longdesc": "Maximum precision USD price quotes as compared to Bitcoin value", "symbol": [["-$", "$"], null], "digits": "arabic", "grouping": [3, ",", 0], "fraction_sep": ".", "fraction_digits": [0, 2, 2], "minpoll": 3600, "longpoll": false, "history": 1467458333.1225}
|
||||||
|
|
||||||
===Current exchange rate===
|
===Current exchange rate===
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -97,6 +112,13 @@ Each currency-pair receives a separate result (a JSON Object) with all requested
|
||||||
* ''time'' - The time (as a POSIX timestamp) the rate information is applicable to (should be approximately the request time).
|
* ''time'' - The time (as a POSIX timestamp) the rate information is applicable to (should be approximately the request time).
|
||||||
* ''rates'' - A JSON Object with each rate type provided as a key, and a Number as the value specifying the rate.
|
* ''rates'' - A JSON Object with each rate type provided as a key, and a Number as the value specifying the rate.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Request: http://api.example.tld/?mode=rate&cp=XBTUSD-ver4,2&type=typical,high
|
||||||
|
Result:
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488767410.5463133, "rates": {"typical": 1349.332215, "high": 1351.2}}
|
||||||
|
{"cp":"2", "time": 1488767410, "rates": {"typical": 1350.111332}}
|
||||||
|
|
||||||
===Historical exchange rates===
|
===Historical exchange rates===
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -111,6 +133,29 @@ Parameters:
|
||||||
A result is provided for each currency-pair and timestamp record, in the same format as the current exchange rate request.
|
A result is provided for each currency-pair and timestamp record, in the same format as the current exchange rate request.
|
||||||
Records MUST be provided in chronological order, but only within the scope of the applicable currency-pair (ie, it is okay to send the full history for one currency-pair, and then the full history for the next; or to intermix them out of any given order).
|
Records MUST be provided in chronological order, but only within the scope of the applicable currency-pair (ie, it is okay to send the full history for one currency-pair, and then the full history for the next; or to intermix them out of any given order).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Request: http://api.example.tld/?mode=history&cp=XBTUSD-ver4,2&type=typical&ratedelta=0.1&timedelta=10&from=1488759998&to=1488760090
|
||||||
|
Result:
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760000, "rates": {"typical": 1300}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760010, "rates": {"typical": 1301.1}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760020, "rates": {"typical": 1320}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760030, "rates": {"typical": 1305}}
|
||||||
|
{"cp":"2", "time": 1488760000.1, "rates": {"typical": 1300}}
|
||||||
|
{"cp":"2", "time": 1488760010.2, "rates": {"typical": 1301.1}}
|
||||||
|
{"cp":"2", "time": 1488760020.2, "rates": {"typical": 1320.111332}}
|
||||||
|
{"cp":"2", "time": 1488760031, "rates": {"typical": 1305.222311}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760040, "rates": {"typical": 1303.33}}
|
||||||
|
{"cp":"2", "time": 1488760042, "rates": {"typical": 1303.33}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760050, "rates": {"typical": 1305}}
|
||||||
|
{"cp":"2", "time": 1488760052, "rates": {"typical": 1307}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760060, "rates": {"typical": 1309}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760072, "rates": {"typical": 1308}}
|
||||||
|
{"cp":"2", "time": 1488760062, "rates": {"typical": 1309.55555555}}
|
||||||
|
{"cp":"2", "time": 1488760072, "rates": {"typical": 1308}}
|
||||||
|
{"cp":"XBTUSD-ver4", "time": 1488760082, "rates": {"typical": 1309}}
|
||||||
|
{"cp":"2", "time": 1488760082, "rates": {"typical": 1309.1}}
|
||||||
|
|
||||||
==Motivation==
|
==Motivation==
|
||||||
|
|
||||||
End users often desire to see fiat currency information in their Bitcoin wallet software.
|
End users often desire to see fiat currency information in their Bitcoin wallet software.
|
||||||
|
|
Loading…
Add table
Reference in a new issue