fix: don't add fixed fee twice for profit calculation
This commit is contained in:
parent
85afa6197a
commit
740f6dfc98
3 changed files with 5 additions and 22 deletions
|
|
@ -169,8 +169,8 @@ function simplifiedBatch (data) {
|
|||
const getCryptoAmount = it => coinUtils.toUnit(BN(it.cryptoAtoms), it.cryptoCode)
|
||||
|
||||
const getProfit = it => {
|
||||
/* fiat - crypto*tickerPrice + fee */
|
||||
const calcCashInProfit = (fiat, crypto, tickerPrice, fee) => fiat.minus(crypto.times(tickerPrice)).plus(fee)
|
||||
/* fiat - crypto*tickerPrice */
|
||||
const calcCashInProfit = (fiat, crypto, tickerPrice) => fiat.minus(crypto.times(tickerPrice))
|
||||
/* crypto*tickerPrice - fiat */
|
||||
const calcCashOutProfit = (fiat, crypto, tickerPrice) => crypto.times(tickerPrice).minus(fiat)
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ const getProfit = it => {
|
|||
const isCashIn = it.txClass === 'cashIn'
|
||||
|
||||
return isCashIn
|
||||
? calcCashInProfit(fiat, crypto, tickerPrice, BN(it.cashInFee))
|
||||
? calcCashInProfit(fiat, crypto, tickerPrice)
|
||||
: calcCashOutProfit(fiat, crypto, tickerPrice)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue