Use commission rate from machine instead of server
This commit is contained in:
parent
578a39a721
commit
9f3457f14d
2 changed files with 30 additions and 37 deletions
|
|
@ -32,22 +32,12 @@ const PONG_TTL = '1 week'
|
|||
const tradesQueues = {}
|
||||
|
||||
function plugins (settings, deviceId) {
|
||||
function getCommissionPercentage (cryptoCode) {
|
||||
const cryptoConfig = configManager.scoped(cryptoCode, deviceId, settings.config)
|
||||
|
||||
return {
|
||||
cashIn: BN(cryptoConfig.cashInCommission).div(100),
|
||||
cashOut: BN(cryptoConfig.cashOutCommission).div(100)
|
||||
}
|
||||
}
|
||||
|
||||
async function getRawTickerPrice (fiatCode, cryptoCode) {
|
||||
const tickers = await ticker.getRates(settings, fiatCode, cryptoCode)
|
||||
|
||||
return {
|
||||
cashIn: _.get(['rates', 'ask'], tickers),
|
||||
cashOut: _.get(['rates', 'bid'], tickers)
|
||||
}
|
||||
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) {
|
||||
|
|
@ -208,6 +198,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)
|
||||
const cashOutCommission = BN(config.cashOutCommission)
|
||||
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
|
||||
|
||||
return {
|
||||
|
|
@ -215,6 +207,8 @@ function plugins (settings, deviceId) {
|
|||
display: cryptoRec.display,
|
||||
minimumTx: BN.max(minimumTx, cashInFee),
|
||||
cashInFee,
|
||||
cashInCommission,
|
||||
cashOutCommission,
|
||||
cryptoNetwork
|
||||
}
|
||||
}
|
||||
|
|
@ -802,7 +796,6 @@ function plugins (settings, deviceId) {
|
|||
sell,
|
||||
notificationsEnabled,
|
||||
notifyOperator,
|
||||
getCommissionPercentage,
|
||||
getRawTickerPrice
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue