refactor: replace trade uuid variable name

This commit is contained in:
José Oliveira 2021-07-08 15:28:51 +01:00 committed by Josh Harvey
parent 9b4bae4097
commit ca0f068bcf
2 changed files with 4 additions and 4 deletions

View file

@ -14,14 +14,14 @@ function trade (side, account, tradeEntry, exchangeName) {
const exchangeConfig = ALL[exchangeName]
if (!exchangeConfig) throw Error('Exchange configuration not found')
const { CUSTOM_KEY, loadOptions, loadConfig = _.noop, REQUIRED_CONFIG_FIELDS, ORDER_TYPE, AMOUNT_PRECISION } = exchangeConfig
const { USER_REF, loadOptions, loadConfig = _.noop, REQUIRED_CONFIG_FIELDS, ORDER_TYPE, AMOUNT_PRECISION } = exchangeConfig
if (!isConfigValid(account, REQUIRED_CONFIG_FIELDS)) throw Error('Invalid config')
const symbol = buildMarket(fiatCode, cryptoCode, exchangeName)
const precision = _.defaultTo(DEFAULT_AMOUNT_PRECISION, AMOUNT_PRECISION)
const amount = toUnit(cryptoAtoms, cryptoCode).toFixed(precision)
const accountOptions = _.isFunction(loadOptions) ? loadOptions(account) : {}
const withCustomKey = CUSTOM_KEY ? { [CUSTOM_KEY]: tradeId } : {}
const withCustomKey = USER_REF ? { [USER_REF]: tradeId } : {}
const options = _.assign(accountOptions, withCustomKey)
const exchange = new ccxt[exchangeName](loadConfig(account))