tx.commission_percentage added

This commit is contained in:
Fabio Cigliano 2018-11-23 16:00:51 +13:00 committed by Josh Harvey
parent 038a22aba7
commit 03279c8d2c
7 changed files with 140 additions and 42 deletions

View file

@ -32,6 +32,15 @@ const PONG_TTL = '1 week'
const tradesQueues = {}
function plugins (settings, deviceId) {
function getCommissionForTx (tx) {
const direction = _.get('direction', tx)
const cryptoCode = _.get('cryptoCode', tx)
const cryptoConfig = configManager.scoped(cryptoCode, deviceId, settings.config)
if (direction === 'cashIn') return /* cashInCommission */ BN(cryptoConfig.cashInCommission).div(100)
if (direction === 'cashOut') return /* cashOutCommission */ BN(cryptoConfig.cashOutCommission).div(100)
}
function buildRates (tickers) {
const config = configManager.machineScoped(deviceId, settings.config)
const cryptoCodes = config.cryptoCurrencies
@ -783,7 +792,8 @@ function plugins (settings, deviceId) {
buy,
sell,
notificationsEnabled,
notifyOperator
notifyOperator,
getCommissionForTx
}
}