mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Update getAdjustedFiatVolume and getAdjustedAmount methods
This commit is contained in:
parent
005d330db9
commit
a2f2503b47
4 changed files with 9 additions and 8 deletions
|
@ -673,7 +673,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
|||
if (isHalCashAccount())
|
||||
volumeByAmount = OfferUtil.getAdjustedVolumeForHalCash(volumeByAmount);
|
||||
else if (CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get()))
|
||||
volumeByAmount = OfferUtil.getRoundedFiatVolume(volumeByAmount, tradeCurrencyCode.get());
|
||||
volumeByAmount = OfferUtil.getRoundedFiatVolume(volumeByAmount);
|
||||
|
||||
volume.set(volumeByAmount);
|
||||
} catch (Throwable t) {
|
||||
|
@ -695,7 +695,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
|||
if (isHalCashAccount())
|
||||
value = OfferUtil.getAdjustedAmountForHalCash(value, price.get(), getMaxTradeLimit());
|
||||
else if (CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get()))
|
||||
value = OfferUtil.getRoundedFiatAmount(value, price.get(), tradeCurrencyCode.get(), getMaxTradeLimit());
|
||||
value = OfferUtil.getRoundedFiatAmount(value, price.get(), getMaxTradeLimit());
|
||||
|
||||
calculateVolume();
|
||||
|
||||
|
|
|
@ -764,7 +764,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
if (dataModel.isHalCashAccount())
|
||||
volume = OfferUtil.getAdjustedVolumeForHalCash(volume);
|
||||
else if (CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get()))
|
||||
volume = OfferUtil.getRoundedFiatVolume(volume, tradeCurrencyCode.get());
|
||||
volume = OfferUtil.getRoundedFiatVolume(volume);
|
||||
|
||||
this.volume.set(btcFormatter.formatVolume(volume));
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
if (dataModel.isHalCashAccount())
|
||||
amount = OfferUtil.getAdjustedAmountForHalCash(amount, price, maxTradeLimit);
|
||||
else if (CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get()))
|
||||
amount = OfferUtil.getRoundedFiatAmount(amount, price, tradeCurrencyCode.get(), maxTradeLimit);
|
||||
amount = OfferUtil.getRoundedFiatAmount(amount, price, maxTradeLimit);
|
||||
}
|
||||
dataModel.setAmount(amount);
|
||||
if (syncMinAmountWithAmount ||
|
||||
|
@ -1003,7 +1003,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
if (dataModel.isHalCashAccount())
|
||||
minAmount = OfferUtil.getAdjustedAmountForHalCash(minAmount, price, maxTradeLimit);
|
||||
else if (CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get()))
|
||||
minAmount = OfferUtil.getRoundedFiatAmount(minAmount, price, tradeCurrencyCode.get(), maxTradeLimit);
|
||||
minAmount = OfferUtil.getRoundedFiatAmount(minAmount, price, maxTradeLimit);
|
||||
}
|
||||
|
||||
dataModel.setMinAmount(minAmount);
|
||||
|
|
|
@ -496,7 +496,7 @@ class TakeOfferDataModel extends OfferDataModel {
|
|||
if (offer.getPaymentMethod().getId().equals(PaymentMethod.HAL_CASH_ID))
|
||||
volumeByAmount = OfferUtil.getAdjustedVolumeForHalCash(volumeByAmount);
|
||||
else if (CurrencyUtil.isFiatCurrency(getCurrencyCode()))
|
||||
volumeByAmount = OfferUtil.getRoundedFiatVolume(volumeByAmount, getCurrencyCode());
|
||||
volumeByAmount = OfferUtil.getRoundedFiatVolume(volumeByAmount);
|
||||
|
||||
volume.set(volumeByAmount);
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
// We only apply the rounding if the amount is variable (minAmount is lower as amount).
|
||||
// Otherwise we could get an amount lower then the minAmount set by rounding
|
||||
Coin roundedAmount = OfferUtil.getRoundedFiatAmount(dataModel.getAmount().get(), tradePrice,
|
||||
dataModel.getCurrencyCode(), maxTradeLimit);
|
||||
maxTradeLimit);
|
||||
dataModel.applyAmount(roundedAmount);
|
||||
}
|
||||
amount.set(btcFormatter.formatCoin(dataModel.getAmount().get()));
|
||||
|
@ -566,7 +566,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
} else if (CurrencyUtil.isFiatCurrency(dataModel.getCurrencyCode()) && !isAmountEqualMinAmount(amount)) {
|
||||
// We only apply the rounding if the amount is variable (minAmount is lower as amount).
|
||||
// Otherwise we could get an amount lower then the minAmount set by rounding
|
||||
amount = OfferUtil.getRoundedFiatAmount(amount, price, dataModel.getCurrencyCode(), maxTradeLimit);
|
||||
amount = OfferUtil.getRoundedFiatAmount(amount, price, maxTradeLimit);
|
||||
}
|
||||
}
|
||||
dataModel.applyAmount(amount);
|
||||
|
@ -577,6 +577,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
return amount.value == offer.getMinAmount().value;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Reference in a new issue