diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index d1611b55b64..9480ee7ea5d 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -17,8 +17,6 @@ package bisq.core.offer; -import bisq.core.locale.CurrencyUtil; - import bisq.network.p2p.NodeAddress; import bisq.network.p2p.storage.payload.ExpirablePayload; import bisq.network.p2p.storage.payload.ProtectedStoragePayload; @@ -372,7 +370,7 @@ public PublicKey getOwnerPubKey() { // The rest of the app does not support yet that concept of base currency and counter currencies // so we map here for convenience public String getCurrencyCode() { - return CurrencyUtil.isCryptoCurrency(getBaseCurrencyCode()) ? getBaseCurrencyCode() : getCounterCurrencyCode(); + return getBaseCurrencyCode().equals("BTC") ? getCounterCurrencyCode() : getBaseCurrencyCode(); } @Override diff --git a/core/src/main/java/bisq/core/trade/statistics/AssetTradeActivityCheck.java b/core/src/main/java/bisq/core/trade/statistics/AssetTradeActivityCheck.java index 8127260c748..6f5dbdfa328 100644 --- a/core/src/main/java/bisq/core/trade/statistics/AssetTradeActivityCheck.java +++ b/core/src/main/java/bisq/core/trade/statistics/AssetTradeActivityCheck.java @@ -62,6 +62,7 @@ public void onAllServicesInitialized() { Map> tradeStatMap = new HashMap<>(); tradeStatisticsManager.getObservableTradeStatisticsSet().stream() + .filter(e -> !e.getBaseCurrency().equals("BTC")) .filter(e -> CurrencyUtil.isCryptoCurrency(e.getBaseCurrency())) .filter(e -> e.getTradeDate().getTime() > compareDate.getTime()) .forEach(e -> { diff --git a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics.java b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics.java index 3144a1c942f..f68b99838ae 100644 --- a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics.java +++ b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics.java @@ -17,7 +17,6 @@ package bisq.core.trade.statistics; -import bisq.core.locale.CurrencyUtil; import bisq.core.monetary.Altcoin; import bisq.core.monetary.AltcoinExchangeRate; import bisq.core.monetary.Price; @@ -223,7 +222,7 @@ public Price getTradePrice() { } public String getCurrencyCode() { - return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency; + return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency; } public Coin getTradeAmount() { diff --git a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java index c6e605c5573..8e1529ffb07 100644 --- a/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java +++ b/core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java @@ -17,7 +17,6 @@ package bisq.core.trade.statistics; -import bisq.core.locale.CurrencyUtil; import bisq.core.monetary.Altcoin; import bisq.core.monetary.AltcoinExchangeRate; import bisq.core.monetary.Price; @@ -248,7 +247,7 @@ public Price getTradePrice() { } public String getCurrencyCode() { - return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency; + return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency; } public Coin getTradeAmount() { diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index b1d83665edf..6e1e303e69d 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -103,9 +103,9 @@ public void testMaxCharactersForFiatBuyPrice() { model.activate(); assertEquals(7, model.maxPlacesForBuyPrice.intValue()); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 94016475L)))); - assertEquals(7, model.maxPlacesForBuyPrice.intValue()); + assertEquals(9, model.maxPlacesForBuyPrice.intValue()); // 9401.6475 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 101016475L)))); - assertEquals(7, model.maxPlacesForBuyPrice.intValue()); + assertEquals(10, model.maxPlacesForBuyPrice.intValue()); //10101.6475 } @Test @@ -132,9 +132,9 @@ public void testMaxCharactersForFiatBuyVolume() { model.activate(); assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); - assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //10.00 + assertEquals(5, model.maxPlacesForBuyVolume.intValue()); //10.00 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); - assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //2212.86 + assertEquals(7, model.maxPlacesForBuyVolume.intValue()); //2212.86 } @Test @@ -179,11 +179,11 @@ public void testMaxCharactersForFiatSellPrice() { final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); model.activate(); - assertEquals(7, model.maxPlacesForSellPrice.intValue()); + assertEquals(7, model.maxPlacesForSellPrice.intValue()); // 10.0000 default price offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 94016475L)))); - assertEquals(7, model.maxPlacesForSellPrice.intValue()); + assertEquals(9, model.maxPlacesForSellPrice.intValue()); // 9401.6475 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 101016475L)))); - assertEquals(7, model.maxPlacesForSellPrice.intValue()); + assertEquals(10, model.maxPlacesForSellPrice.intValue()); // 10101.6475 } @Test @@ -210,8 +210,8 @@ public void testMaxCharactersForFiatSellVolume() { model.activate(); assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); - assertEquals(4, model.maxPlacesForSellVolume.intValue()); //10.00 + assertEquals(5, model.maxPlacesForSellVolume.intValue()); //10.00 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); - assertEquals(4, model.maxPlacesForSellVolume.intValue()); //2212.86 + assertEquals(7, model.maxPlacesForSellVolume.intValue()); //2212.86 } } diff --git a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java index 58ec574b9fb..198f383c020 100644 --- a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java @@ -114,7 +114,7 @@ public void testFormatCoin() { @Test public void testFormatVolume() { - assertEquals("0.01", formatter.formatVolume(make(btcUsdOffer), true, 4)); + assertEquals("1.00", formatter.formatVolume(make(btcUsdOffer), true, 4)); assertEquals("100.00", formatter.formatVolume(make(usdVolume))); assertEquals("1774.62", formatter.formatVolume(make(usdVolume.but(with(volumeString, "1774.62"))))); }