Fix ratchet errors on commission and ticker
This commit is contained in:
parent
fe72b4fcaf
commit
3dd7503e45
5 changed files with 22 additions and 41 deletions
|
|
@ -32,14 +32,6 @@ const PONG_TTL = '1 week'
|
|||
const tradesQueues = {}
|
||||
|
||||
function plugins (settings, deviceId) {
|
||||
function getRawTickerPrice (fiatCode, cryptoCode) {
|
||||
return ticker.getRates(settings, fiatCode, cryptoCode)
|
||||
.then(tickers => ({
|
||||
cashIn: _.get(['rates', 'ask'], tickers),
|
||||
cashOut: _.get(['rates', 'bid'], tickers)
|
||||
}))
|
||||
}
|
||||
|
||||
function buildRates (tickers) {
|
||||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
const cryptoCodes = config.cryptoCurrencies
|
||||
|
|
@ -198,8 +190,8 @@ function plugins (settings, deviceId) {
|
|||
const config = configManager.scoped(cryptoCode, deviceId, settings.config)
|
||||
const minimumTx = BN(config.minimumTx)
|
||||
const cashInFee = BN(config.cashInFee)
|
||||
const cashInCommission = BN(config.cashInCommission || 0)
|
||||
const cashOutCommission = BN(config.cashOutCommission || 0)
|
||||
const cashInCommission = BN(config.cashInCommission)
|
||||
const cashOutCommission = config.cashOutCommission ? BN(config.cashOutCommission) : null
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
|
||||
return {
|
||||
|
|
@ -239,12 +231,13 @@ function plugins (settings, deviceId) {
|
|||
const balances = arr.slice(cryptoCodesCount + 3, 2 * cryptoCodesCount + 3)
|
||||
const testNets = arr.slice(2 * cryptoCodesCount + 3)
|
||||
const coinParams = _.zip(cryptoCodes, testNets)
|
||||
const coinsWithoutRate = _.map(mapCoinSettings, coinParams)
|
||||
|
||||
return {
|
||||
cassettes,
|
||||
rates: buildRates(tickers),
|
||||
balances: buildBalances(balances),
|
||||
coins: _.map(mapCoinSettings, coinParams),
|
||||
coins: _.zipWith(_.assign, coinsWithoutRate, tickers),
|
||||
configVersion
|
||||
}
|
||||
})
|
||||
|
|
@ -795,8 +788,7 @@ function plugins (settings, deviceId) {
|
|||
buy,
|
||||
sell,
|
||||
notificationsEnabled,
|
||||
notifyOperator,
|
||||
getRawTickerPrice
|
||||
notifyOperator
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue