node-coindesk-api
v1.0.0
Published
Simple module to query the CoinDesk Bitcoin Price Index API
Downloads
17
Readme
CoinDesk Bitcoin Price Index API
Simple module to query the CoinDesk Bitcoin Price Index API
Usage
$ npm install node-coindesk-api
Then, start querying the Coindesk API:
const coindesk = require('node-coindesk-api')
coindesk.getCurrentPrice().then(function (data) {
// data.bpi.USD.rate_float === 1015.0275 !!!
})
API
getCurrentPrice()
: Returns current bitcoin prices.getSupportedCurrencies()
: Returns all supported currencies.getHistoricalClosePrices(options)
: Returns historical prices whereoptions
is an object with optional properties:index
:USD
orCNY
.index
:USD
orCNY
.currency
: any valid currency sting (see above).start
,end
:Date
objectsyesterday
: boolean to shorten the query.
See Coindesk BPI API docs for more information.
Note on using the Coindesk BPI API
Read Coindesk's note on their docs:
You are free to use this API to include our data in any application or website as you see fit, as long as each page or app that uses it includes the text “Powered by CoinDesk”, linking to our price page.
License
WTFPL
$ npm version <major|minor|patch> # updates package.json and applies tag
$ npm publish # lints, builds and publishes
$ git push --follow-tags # don't forget to push the code and tags!