cryptonator
v1.0.2
Published
Cryptonator Javascript API Wrapper
Downloads
6
Maintainers
Readme
cryptonator
Cryptonator JavaScript API Wrapper
Install
npm install --save cryptonator
Usage
Note: cryptonator depends on fetch()
being defined globally.
If you are using this in electron, it should work without any configuration.
If you are using this in Node.js, you will need to use
node-fetch
.Example:
global.fetch = require('node-fetch') const cryptonator = require('cryptonator')
Methods
simpleTicker()
Returns actual volume-weighted price, total 24h volume and the price change.
simpleTicker(cc)
cc
(String) Currency Code
cryptonator.simpleTicker('btc-usd')
.then(data => {
console.log(data)
// -> { ticker:
// { base: 'BTC',
// target: 'USD',
// price: '15000.90635723',
// volume: '39726.75805209',
// change: '285.53675830'
// }
// ... }
})
.catch(console.error)
Replace btc-usd with the currency codes you need. Please refer to the actual list of supported currencies. Volume is displayed only for the cryptocurrencies that are actually traded on online exchanges.
completeTicker()
Returns actual volume-weighted price, total 24h volume, rate change as well as prices and volumes across all connected exchanges.
completeTicker(cc)
cc
(String) Currency Code
cryptonator.completeTicker('btc-usd')
.then(data => {
console.log(data)
// -> { ticker:
// { base: 'BTC',
// target: 'USD',
// price: '15000.90635723',
// volume: '39726.75805209',
// change: '285.53675830'
// }
// ... }
})
.catch(console.error)
Replace btc-usd with the currency codes you need. Please refer to the actual list of supported currencies. Volume is displayed only for the cryptocurrencies that are actually traded on online exchanges.