Migrate plugins to lib directory
This commit is contained in:
parent
09b29bba56
commit
e7ab8223c2
27 changed files with 869 additions and 858 deletions
25
lib/plugins/ticker/bitpay/bitpay.js
Normal file
25
lib/plugins/ticker/bitpay/bitpay.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
const axios = require('axios')
|
||||
const BN = require('../../../bn')
|
||||
|
||||
function ticker (account, fiatCode, cryptoCode) {
|
||||
if (cryptoCode !== 'BTC') {
|
||||
return Promise.reject('Unsupported crypto: ' + cryptoCode)
|
||||
}
|
||||
|
||||
return axios.get('https://bitpay.com/api/rates/' + fiatCode)
|
||||
.then(r => {
|
||||
const data = r.data
|
||||
const price = BN(data.rate)
|
||||
return {
|
||||
rates: {
|
||||
ask: price,
|
||||
bid: price
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ticker,
|
||||
name: 'BitPay'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue