mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Fix CLI gettrades' Deviation column value format (do nothing)
This commit is contained in:
parent
2febe6b327
commit
8f93c27deb
@ -20,8 +20,6 @@ package bisq.cli.table.builder;
|
||||
import bisq.proto.grpc.ContractInfo;
|
||||
import bisq.proto.grpc.TradeInfo;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@ -215,9 +213,10 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
||||
? t.getOffer().getCounterCurrencyCode()
|
||||
: t.getOffer().getBaseCurrencyCode();
|
||||
|
||||
|
||||
protected final Function<TradeInfo, String> toPriceDeviation = (t) ->
|
||||
t.getOffer().getUseMarketBasedPrice()
|
||||
? formatToPercent(t.getOffer().getMarketPriceMarginPct())
|
||||
? t.getOffer().getMarketPriceMarginPct() + "%"
|
||||
: "N/A";
|
||||
|
||||
protected final Function<TradeInfo, Long> toMyMinerTxFee = (t) -> {
|
||||
@ -307,19 +306,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
||||
}
|
||||
};
|
||||
|
||||
// TODO Move to bisq/cli/CurrencyFormat.java ?
|
||||
|
||||
public static String formatToPercent(double value) {
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
decimalFormat.setMinimumFractionDigits(2);
|
||||
decimalFormat.setMaximumFractionDigits(2);
|
||||
return formatToPercent(value, decimalFormat);
|
||||
}
|
||||
|
||||
public static String formatToPercent(double value, DecimalFormat decimalFormat) {
|
||||
return decimalFormat.format(roundDouble(value * 100.0, 2)).replace(",", ".") + "%";
|
||||
}
|
||||
|
||||
public static double roundDouble(double value, int precision) {
|
||||
return roundDouble(value, precision, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user