Code readability and added the forgotten mocks

This commit is contained in:
José Oliveira 2021-01-25 23:51:39 +00:00 committed by Josh Harvey
parent 134eaaa518
commit 7accdaa84f
12 changed files with 126 additions and 96 deletions

View 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
}