mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 23:36:00 -04:00
Fix wrong % calculation
This commit is contained in:
parent
605e9288e4
commit
565557b251
@ -248,7 +248,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
||||
double priceAsDouble = formatter.parseNumberStringToDouble(price.get());
|
||||
double relation = priceAsDouble / marketPriceAsDouble;
|
||||
relation = formatter.roundDouble(relation, 2);
|
||||
double marketPriceMargin = dataModel.getDirection() == Offer.Direction.BUY ? 1 - relation : 1 + relation;
|
||||
double marketPriceMargin = dataModel.getDirection() == Offer.Direction.BUY ? 1 - relation : relation - 1;
|
||||
priceAsPercentage.set(formatter.formatToPercent(marketPriceMargin, 2));
|
||||
} catch (NumberFormatException t) {
|
||||
priceAsPercentage.set("");
|
||||
|
Loading…
x
Reference in New Issue
Block a user