diff --git a/lib/forex.js b/lib/forex.js index ddee4008..aeb4f514 100644 --- a/lib/forex.js +++ b/lib/forex.js @@ -7,8 +7,7 @@ const MAX_ROTATIONS = 5 const getFiatRates = () => axios.get('https://bitpay.com/api/rates').then(response => response.data) const API_QUEUE = [ - { api: getBitPayFxRate, name: 'bitpay', fiatCodeProperty: 'code', rateProperty: 'rate' }, - { api: getCoinCapFxRate, name: 'coincap', fiatCodeProperty: 'symbol', rateProperty: 'rateUsd' } + { api: getBitPayFxRate, name: 'bitpay', fiatCodeProperty: 'code', rateProperty: 'rate' } ] function getBitPayFxRate (fiatCode, defaultFiatMarket, fiatCodeProperty, rateProperty) { @@ -23,17 +22,6 @@ function getBitPayFxRate (fiatCode, defaultFiatMarket, fiatCodeProperty, ratePro }) } -function getCoinCapFxRate (fiatCode, defaultFiatMarket, fiatCodeProperty, rateProperty) { - return axios.get('https://api.coincap.io/v2/rates') - .then(response => { - const fxRates = response.data.data - const fxRate = new BN(1).div(findCurrencyRates(fxRates, fiatCode, fiatCodeProperty, rateProperty)) - return { - fxRate - } - }) -} - function findCurrencyRates (fxRates, fiatCode, fiatCodeProperty, rateProperty) { const rates = _.find(_.matchesProperty(fiatCodeProperty, fiatCode), fxRates) if (!rates || !rates[rateProperty]) throw new Error(`Unsupported currency: ${fiatCode}`)