Code readability and added the forgotten mocks
This commit is contained in:
parent
134eaaa518
commit
7accdaa84f
12 changed files with 126 additions and 96 deletions
28
lib/plugins/ticker/bitpay.js
Normal file
28
lib/plugins/ticker/bitpay.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const axios = require('axios')
|
||||
|
||||
const BN = require('../../bn')
|
||||
const { BTC, BCH } = require('../../new-admin/config/coins')
|
||||
|
||||
const CRYPTO = [BTC, BCH]
|
||||
const FIAT = 'ALL_CURRENCIES'
|
||||
|
||||
function ticker (fiatCode, cryptoCode) {
|
||||
return axios.get('https://bitpay.com/rates/' + cryptoCode + '/' + fiatCode)
|
||||
.then(r => {
|
||||
const data = r.data.data
|
||||
const price = BN(data.rate.toString())
|
||||
return {
|
||||
rates: {
|
||||
ask: price,
|
||||
bid: price
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ticker,
|
||||
name: 'BitPay',
|
||||
CRYPTO,
|
||||
FIAT
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue