mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-31 04:24:39 -04:00
Fix wrong % calculation
This commit is contained in:
parent
605e9288e4
commit
565557b251
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue