Merge pull request #1768 from RafaelTaranto/backport/binance-default-market
LAM-767 fix: binance ticker default market fiat
This commit is contained in:
commit
812d246a10
3 changed files with 10 additions and 5 deletions
|
|
@ -23,7 +23,8 @@ const ALL = {
|
|||
bitpay: bitpay,
|
||||
coinbase: {
|
||||
CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON, TRX, LN],
|
||||
FIAT: 'ALL_CURRENCIES'
|
||||
FIAT: 'ALL_CURRENCIES',
|
||||
DEFAULT_FIAT_MARKET: 'EUR'
|
||||
},
|
||||
binance: binance,
|
||||
bitfinex: bitfinex
|
||||
|
|
@ -48,4 +49,8 @@ function isConfigValid (config, fields) {
|
|||
return _.every(it => it || it === 0)(values)
|
||||
}
|
||||
|
||||
module.exports = { buildMarket, ALL, verifyFiatSupport, isConfigValid }
|
||||
function defaultFiatMarket (serviceName) {
|
||||
return ALL[serviceName].DEFAULT_FIAT_MARKET
|
||||
}
|
||||
|
||||
module.exports = { buildMarket, ALL, verifyFiatSupport, isConfigValid, defaultFiatMarket }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const { ORDER_TYPES } = require('./consts')
|
|||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||
const { BTC, BCH, XMR, ETH, LTC, ZEC, LN } = COINS
|
||||
const CRYPTO = [BTC, ETH, LTC, ZEC, BCH, XMR, LN]
|
||||
const FIAT = ['USD', 'EUR']
|
||||
const FIAT = ['EUR']
|
||||
const DEFAULT_FIAT_MARKET = 'EUR'
|
||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey', 'currencyMarket']
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const ccxt = require('ccxt')
|
||||
|
||||
const BN = require('../../bn')
|
||||
const { buildMarket, verifyFiatSupport } = require('../common/ccxt')
|
||||
const { buildMarket, verifyFiatSupport, defaultFiatMarket } = require('../common/ccxt')
|
||||
const { getRate } = require('../../../lib/forex')
|
||||
|
||||
const RETRIES = 2
|
||||
|
|
@ -33,7 +33,7 @@ function ticker (fiatCode, cryptoCode, tickerName) {
|
|||
return getRate(RETRIES, fiatCode)
|
||||
.then(({ fxRate }) => {
|
||||
try {
|
||||
return getCurrencyRates(ticker, 'USD', cryptoCode)
|
||||
return getCurrencyRates(ticker, defaultFiatMarket(tickerName), cryptoCode)
|
||||
.then(res => ({
|
||||
rates: {
|
||||
ask: res.rates.ask.times(fxRate),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue