mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-13 11:09:10 +01:00
Merge pull request #5704 from ghubstan/fix-cli-alt-trade-volume-bug
CLI bug fix: show trade's contract volume, not moving offer volume
This commit is contained in:
commit
14c2e37cca
4 changed files with 17 additions and 4 deletions
|
@ -781,7 +781,7 @@ public class CliMain {
|
|||
stream.println();
|
||||
stream.format(rowFormat, editoffer.name(), "--offer-id=<offer-id> \\", "Edit offer with id");
|
||||
stream.format(rowFormat, "", "[--fixed-price=<price>] \\", "");
|
||||
stream.format(rowFormat, "", "[--market-price=margin=<percent>] \\", "");
|
||||
stream.format(rowFormat, "", "[--market-price-margin=<percent>] \\", "");
|
||||
stream.format(rowFormat, "", "[--trigger-price=<price>] \\", "");
|
||||
stream.format(rowFormat, "", "[--enabled=<true|false>]", "");
|
||||
stream.println();
|
||||
|
|
|
@ -159,12 +159,12 @@ public class TradeFormat {
|
|||
private static final Function<TradeInfo, String> priceFormat = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
? formatPrice(t.getTradePrice())
|
||||
: formatCryptoCurrencyPrice(t.getOffer().getPrice());
|
||||
: formatCryptoCurrencyPrice(t.getTradePrice());
|
||||
|
||||
private static final Function<TradeInfo, String> amountFormat = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
? formatSatoshis(t.getTradeAmountAsLong())
|
||||
: formatCryptoCurrencyOfferVolume(t.getOffer().getVolume());
|
||||
: formatCryptoCurrencyOfferVolume(t.getTradeVolume());
|
||||
|
||||
private static final BiFunction<TradeInfo, Boolean, String> makerTakerMinerTxFeeFormat = (t, isTaker) -> {
|
||||
if (isTaker) {
|
||||
|
@ -188,7 +188,7 @@ public class TradeFormat {
|
|||
|
||||
private static final Function<TradeInfo, String> tradeCostFormat = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
? formatOfferVolume(t.getOffer().getVolume())
|
||||
? formatOfferVolume(t.getTradeVolume())
|
||||
: formatSatoshis(t.getTradeAmountAsLong());
|
||||
|
||||
private static final BiFunction<TradeInfo, Boolean, String> bsqReceiveAddress = (t, showBsqBuyerAddress) -> {
|
||||
|
|
|
@ -51,6 +51,7 @@ public class TradeInfo implements Payload {
|
|||
private final String payoutTxId;
|
||||
private final long tradeAmountAsLong;
|
||||
private final long tradePrice;
|
||||
private final long tradeVolume;
|
||||
private final String tradingPeerNodeAddress;
|
||||
private final String state;
|
||||
private final String phase;
|
||||
|
@ -78,6 +79,7 @@ public class TradeInfo implements Payload {
|
|||
this.payoutTxId = builder.payoutTxId;
|
||||
this.tradeAmountAsLong = builder.tradeAmountAsLong;
|
||||
this.tradePrice = builder.tradePrice;
|
||||
this.tradeVolume = builder.tradeVolume;
|
||||
this.tradingPeerNodeAddress = builder.tradingPeerNodeAddress;
|
||||
this.state = builder.state;
|
||||
this.phase = builder.phase;
|
||||
|
@ -133,6 +135,7 @@ public class TradeInfo implements Payload {
|
|||
.withPayoutTxId(trade.getPayoutTxId())
|
||||
.withTradeAmountAsLong(trade.getTradeAmountAsLong())
|
||||
.withTradePrice(trade.getTradePrice().getValue())
|
||||
.withTradeVolume(trade.getTradeVolume() == null ? 0 : trade.getTradeVolume().getValue())
|
||||
.withTradingPeerNodeAddress(Objects.requireNonNull(
|
||||
trade.getTradingPeerNodeAddress()).getHostNameWithoutPostFix())
|
||||
.withState(trade.getState().name())
|
||||
|
@ -169,6 +172,7 @@ public class TradeInfo implements Payload {
|
|||
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
|
||||
.setTradeAmountAsLong(tradeAmountAsLong)
|
||||
.setTradePrice(tradePrice)
|
||||
.setTradeVolume(tradeVolume)
|
||||
.setTradingPeerNodeAddress(tradingPeerNodeAddress)
|
||||
.setState(state)
|
||||
.setPhase(phase)
|
||||
|
@ -199,6 +203,7 @@ public class TradeInfo implements Payload {
|
|||
.withPayoutTxId(proto.getPayoutTxId())
|
||||
.withTradeAmountAsLong(proto.getTradeAmountAsLong())
|
||||
.withTradePrice(proto.getTradePrice())
|
||||
.withTradeVolume(proto.getTradeVolume())
|
||||
.withTradePeriodState(proto.getTradePeriodState())
|
||||
.withState(proto.getState())
|
||||
.withPhase(proto.getPhase())
|
||||
|
@ -234,6 +239,7 @@ public class TradeInfo implements Payload {
|
|||
private String payoutTxId;
|
||||
private long tradeAmountAsLong;
|
||||
private long tradePrice;
|
||||
private long tradeVolume;
|
||||
private String tradingPeerNodeAddress;
|
||||
private String state;
|
||||
private String phase;
|
||||
|
@ -312,6 +318,11 @@ public class TradeInfo implements Payload {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoBuilder withTradeVolume(long tradeVolume) {
|
||||
this.tradeVolume = tradeVolume;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoBuilder withTradePeriodState(String tradePeriodState) {
|
||||
this.tradePeriodState = tradePeriodState;
|
||||
return this;
|
||||
|
@ -392,6 +403,7 @@ public class TradeInfo implements Payload {
|
|||
", payoutTxId='" + payoutTxId + '\'' + "\n" +
|
||||
", tradeAmountAsLong='" + tradeAmountAsLong + '\'' + "\n" +
|
||||
", tradePrice='" + tradePrice + '\'' + "\n" +
|
||||
", tradeVolume='" + tradeVolume + '\'' + "\n" +
|
||||
", tradingPeerNodeAddress='" + tradingPeerNodeAddress + '\'' + "\n" +
|
||||
", state='" + state + '\'' + "\n" +
|
||||
", phase='" + phase + '\'' + "\n" +
|
||||
|
|
|
@ -409,6 +409,7 @@ message TradeInfo {
|
|||
bool isWithdrawn = 23;
|
||||
string contractAsJson = 24;
|
||||
ContractInfo contract = 25;
|
||||
uint64 tradeVolume = 26;
|
||||
}
|
||||
|
||||
message ContractInfo {
|
||||
|
|
Loading…
Add table
Reference in a new issue