mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Use marketPriceMarginParam from createOfferService
This commit is contained in:
parent
7d2016a839
commit
646808623c
2 changed files with 11 additions and 5 deletions
|
@ -128,14 +128,15 @@ public class CreateOfferService {
|
|||
return price != null && !useMarketBasedPriceValue ? price.getValue() : 0L;
|
||||
}
|
||||
|
||||
private boolean isUseMarketBasedPriceValue(boolean useMarketBasedPrice,
|
||||
String currencyCode,
|
||||
PaymentAccount paymentAccount) {
|
||||
public boolean isUseMarketBasedPriceValue(boolean useMarketBasedPrice,
|
||||
String currencyCode,
|
||||
PaymentAccount paymentAccount) {
|
||||
return useMarketBasedPrice &&
|
||||
isMarketPriceAvailable(currencyCode) &&
|
||||
!isHalCashAccount(paymentAccount);
|
||||
}
|
||||
|
||||
|
||||
private boolean isHalCashAccount(PaymentAccount paymentAccount) {
|
||||
return paymentAccount instanceof HalCashAccount;
|
||||
}
|
||||
|
@ -145,6 +146,9 @@ public class CreateOfferService {
|
|||
return marketPrice != null && marketPrice.isExternallyProvidedPrice();
|
||||
}
|
||||
|
||||
public double marketPriceMarginParam(boolean useMarketBasedPriceValue, double marketPriceMargin) {
|
||||
return useMarketBasedPriceValue ? marketPriceMargin : 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
|
@ -180,4 +184,5 @@ public class CreateOfferService {
|
|||
// MinSellerSecurityDepositAsCoin from Restrictions.
|
||||
return Coin.valueOf(Math.max(Restrictions.getMinSellerSecurityDepositAsCoin().value, value.value));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
|||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
Offer createAndGetOffer() {
|
||||
boolean useMarketBasedPriceValue = isUseMarketBasedPriceValue();
|
||||
boolean useMarketBasedPriceValue = createOfferService.isUseMarketBasedPriceValue(useMarketBasedPrice.get(), tradeCurrencyCode.get(), paymentAccount);
|
||||
|
||||
long priceAsLong = createOfferService.getPriceAsLong(price.get(), paymentAccount, useMarketBasedPrice.get(), tradeCurrencyCode.get());
|
||||
|
||||
|
@ -312,7 +312,8 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
|||
String baseCurrencyCode = isCryptoCurrency ? currencyCode : Res.getBaseCurrencyCode();
|
||||
String counterCurrencyCode = isCryptoCurrency ? Res.getBaseCurrencyCode() : currencyCode;
|
||||
|
||||
double marketPriceMarginParam = useMarketBasedPriceValue ? marketPriceMargin : 0;
|
||||
double marketPriceMarginParam = createOfferService.marketPriceMarginParam(useMarketBasedPriceValue, marketPriceMargin);
|
||||
|
||||
long amountAsLong = this.amount.get() != null ? this.amount.get().getValue() : 0L;
|
||||
long minAmountAsLong = this.minAmount.get() != null ? this.minAmount.get().getValue() : 0L;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue