Handle high precision bitpay response numbers
This commit is contained in:
parent
2c0d843dcd
commit
a051a34429
5 changed files with 5 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ 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)
|
||||
const price = BN(data.rate.toString())
|
||||
return {
|
||||
rates: {
|
||||
ask: price,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ exports.SUPPORTED_MODULES = ['ticker']
|
|||
function findCurrency (fxRates, fiatCode) {
|
||||
const rates = _.find(_.matchesProperty('code', fiatCode), fxRates)
|
||||
if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`)
|
||||
return BN(rates.rate)
|
||||
return BN(rates.rate.toString())
|
||||
}
|
||||
|
||||
exports.ticker = function ticker (account, fiatCode, cryptoCode) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ exports.SUPPORTED_MODULES = ['ticker']
|
|||
function findCurrency (fxRates, fiatCode) {
|
||||
const rates = _.find(_.matchesProperty('code', fiatCode), fxRates)
|
||||
if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`)
|
||||
return BN(rates.rate)
|
||||
return BN(rates.rate.toString())
|
||||
}
|
||||
|
||||
exports.ticker = function ticker (account, fiatCode, cryptoCode) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const PAIRS = common.PAIRS
|
|||
function findCurrency (fxRates, fiatCode) {
|
||||
const rates = _.find(_.matchesProperty('code', fiatCode), fxRates)
|
||||
if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`)
|
||||
return BN(rates.rate)
|
||||
return BN(rates.rate.toString())
|
||||
}
|
||||
|
||||
exports.ticker = function ticker (account, fiatCode, cryptoCode) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ exports.SUPPORTED_MODULES = ['ticker']
|
|||
function findCurrency (fxRates, fiatCode) {
|
||||
const rates = _.find(_.matchesProperty('code', fiatCode), fxRates)
|
||||
if (!rates || !rates.rate) throw new Error(`Unsupported currency: ${fiatCode}`)
|
||||
return BN(rates.rate)
|
||||
return BN(rates.rate.toString())
|
||||
}
|
||||
|
||||
exports.ticker = function ticker (account, fiatCode, cryptoCode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue