fix: market currency migration

This commit is contained in:
Sérgio Salgado 2022-10-07 02:02:11 +01:00 committed by Rafael
parent 7f168859d8
commit 47c548c956
11 changed files with 25 additions and 22 deletions

View file

@ -29,13 +29,12 @@ const ALL = {
bitfinex: bitfinex
}
function buildMarket (_fiatCode, cryptoCode, serviceName) {
function buildMarket (fiatCode, cryptoCode, serviceName) {
if (!_.includes(cryptoCode, ALL[serviceName].CRYPTO)) {
throw new Error('Unsupported crypto: ' + cryptoCode)
}
if (_.isNil(_fiatCode)) logger.debug('Missing fiat code information, defaulting to EUR markets')
const fiatCode = _fiatCode ?? 'EUR'
if (_.isNil(fiatCode)) throw new Error('Market pair building failed: Missing fiat code')
return cryptoCode + '/' + fiatCode
}