diff --git a/core/src/main/java/haveno/core/monetary/Price.java b/core/src/main/java/haveno/core/monetary/Price.java index 98703aae..bfea2dbd 100644 --- a/core/src/main/java/haveno/core/monetary/Price.java +++ b/core/src/main/java/haveno/core/monetary/Price.java @@ -49,7 +49,7 @@ public class Price extends MonetaryWrapper implements Comparable { } /** - * 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 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 { } /** - * 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 value The value to parse. diff --git a/core/src/main/java/haveno/core/util/PriceUtil.java b/core/src/main/java/haveno/core/util/PriceUtil.java index e00806b3..01e20e88 100644 --- a/core/src/main/java/haveno/core/util/PriceUtil.java +++ b/core/src/main/java/haveno/core/util/PriceUtil.java @@ -196,14 +196,13 @@ public class PriceUtil { return FormattingUtils.formatRoundedDoubleWithPrecision(priceAsDouble, precision); } - public static String formatMarketPrice(long price, String currencyCode) { - int marketPricePrecision = getMarketPricePrecision(currencyCode); - double scaled = MathUtils.scaleDownByPowerOf10(price, marketPricePrecision); - return FormattingUtils.formatMarketPrice(scaled, marketPricePrecision); + public static String formatMarketPrice(long priceAsLong, String currencyCode) { + Price price = Price.valueOf(currencyCode, priceAsLong); + return FormattingUtils.formatPrice(price); } public static int getMarketPricePrecision(String currencyCode) { return CurrencyUtil.isTraditionalCurrency(currencyCode) ? TraditionalMoney.SMALLEST_UNIT_EXPONENT : CryptoMoney.SMALLEST_UNIT_EXPONENT; } -} +} \ No newline at end of file