diff --git a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModel.java b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModel.java index b1eaadd5e3f..dc6fcf4de36 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModel.java @@ -279,6 +279,14 @@ private void updateChartData() { // Offer price can be null (if price feed unavailable), thus a null-tolerant comparator is used. Comparator offerPriceComparator = Comparator.comparing(Offer::getPrice, Comparator.nullsLast(Comparator.naturalOrder())); + + // Trading btc-fiat is considered as buying/selling BTC, but trading btc-altcoin is + // considered as buying/selling Altcoin. Because of this, when viewing a btc-altcoin pair, + // the buy column is actually the sell column and vice versa. To maintain the expected + // ordering, we have to reverse the price comparator. + boolean isCrypto = CurrencyUtil.isCryptoCurrency(getCurrencyCode()); + if (isCrypto) offerPriceComparator = offerPriceComparator.reversed(); + // Offer amounts are used for the secondary sort. They are sorted from high to low. Comparator offerAmountComparator = Comparator.comparing(Offer::getAmount).reversed();