fix: trade promises chain errors
This commit is contained in:
parent
89d555de89
commit
aa0d143679
2 changed files with 6 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
const { toUnit } = require('@lamassu/coins')
|
||||
const { utils: coinUtils } = require('@lamassu/coins')
|
||||
const _ = require('lodash/fp')
|
||||
const ccxt = require('ccxt')
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ function trade (side, account, tradeEntry, exchangeName) {
|
|||
|
||||
const symbol = buildMarket(fiatCode, cryptoCode, exchangeName)
|
||||
const precision = _.defaultTo(DEFAULT_AMOUNT_PRECISION, AMOUNT_PRECISION)
|
||||
const amount = toUnit(cryptoAtoms, cryptoCode).toFixed(precision)
|
||||
const amount = coinUtils.toUnit(cryptoAtoms, cryptoCode).toFixed(precision)
|
||||
const accountOptions = _.isFunction(loadOptions) ? loadOptions(account) : {}
|
||||
const withCustomKey = USER_REF ? { [USER_REF]: tradeId } : {}
|
||||
const options = _.assign(accountOptions, withCustomKey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue