lamassu-server/lib/plugins/ticker/bitpay/bitpay.js
2017-12-20 13:16:44 +02:00

22 lines
407 B
JavaScript

const axios = require('axios')
const BN = require('../../../bn')
function ticker (account, fiatCode, cryptoCode) {
return axios.get('https://bitpay.com/api/rates/' + cryptoCode + '/' + fiatCode)
.then(r => {
const data = r.data
const price = BN(data.rate)
return {
rates: {
ask: price,
bid: price
}
}
})
}
module.exports = {
ticker,
name: 'BitPay'
}