mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-05 10:29:36 +00:00
fiat trigger price has 4 decimals by fixing PriceUtil.formatMarketPrice()
This commit is contained in:
parent
75f5255050
commit
32a1a49d7e
2 changed files with 6 additions and 7 deletions
|
@ -49,7 +49,7 @@ public class Price extends MonetaryWrapper implements Comparable<Price> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the Bitcoin {@code Price} given a {@code currencyCode} and {@code inputValue}.
|
* Parse the Monero {@code Price} given a {@code currencyCode} and {@code inputValue}.
|
||||||
*
|
*
|
||||||
* @param currencyCode The currency code to parse, e.g "USD" or "LTC".
|
* @param currencyCode The currency code to parse, e.g "USD" or "LTC".
|
||||||
* @param input The input value to parse as a String, e.g "2.54" or "-0.0001".
|
* @param input The input value to parse as a String, e.g "2.54" or "-0.0001".
|
||||||
|
@ -64,7 +64,7 @@ public class Price extends MonetaryWrapper implements Comparable<Price> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the Bitcoin {@code Price} given a {@code currencyCode} and {@code inputValue}.
|
* Parse the Monero {@code Price} given a {@code currencyCode} and {@code inputValue}.
|
||||||
*
|
*
|
||||||
* @param currencyCode The currency code to parse, e.g "USD" or "LTC".
|
* @param currencyCode The currency code to parse, e.g "USD" or "LTC".
|
||||||
* @param value The value to parse.
|
* @param value The value to parse.
|
||||||
|
|
|
@ -196,10 +196,9 @@ public class PriceUtil {
|
||||||
return FormattingUtils.formatRoundedDoubleWithPrecision(priceAsDouble, precision);
|
return FormattingUtils.formatRoundedDoubleWithPrecision(priceAsDouble, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatMarketPrice(long price, String currencyCode) {
|
public static String formatMarketPrice(long priceAsLong, String currencyCode) {
|
||||||
int marketPricePrecision = getMarketPricePrecision(currencyCode);
|
Price price = Price.valueOf(currencyCode, priceAsLong);
|
||||||
double scaled = MathUtils.scaleDownByPowerOf10(price, marketPricePrecision);
|
return FormattingUtils.formatPrice(price);
|
||||||
return FormattingUtils.formatMarketPrice(scaled, marketPricePrecision);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMarketPricePrecision(String currencyCode) {
|
public static int getMarketPricePrecision(String currencyCode) {
|
||||||
|
|
Loading…
Reference in a new issue