mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Show frozen fiat trade cost in CLI console
This is a bug fix for the CLI's displayed fiat trade cost value, which should be trade.volume, not offer.volume. Offer volume varies with BTC volatility, and the CLI should be showing the trade.volume value instead, frozen when the contract is made.
This commit is contained in:
parent
fae1852220
commit
484f882077
@ -188,7 +188,7 @@ public class TradeFormat {
|
|||||||
|
|
||||||
private static final Function<TradeInfo, String> tradeCostFormat = (t) ->
|
private static final Function<TradeInfo, String> tradeCostFormat = (t) ->
|
||||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||||
? formatOfferVolume(t.getOffer().getVolume())
|
? formatOfferVolume(t.getTradeVolume())
|
||||||
: formatSatoshis(t.getTradeAmountAsLong());
|
: formatSatoshis(t.getTradeAmountAsLong());
|
||||||
|
|
||||||
private static final BiFunction<TradeInfo, Boolean, String> bsqReceiveAddress = (t, showBsqBuyerAddress) -> {
|
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 String payoutTxId;
|
||||||
private final long tradeAmountAsLong;
|
private final long tradeAmountAsLong;
|
||||||
private final long tradePrice;
|
private final long tradePrice;
|
||||||
|
private final long tradeVolume;
|
||||||
private final String tradingPeerNodeAddress;
|
private final String tradingPeerNodeAddress;
|
||||||
private final String state;
|
private final String state;
|
||||||
private final String phase;
|
private final String phase;
|
||||||
@ -78,6 +79,7 @@ public class TradeInfo implements Payload {
|
|||||||
this.payoutTxId = builder.payoutTxId;
|
this.payoutTxId = builder.payoutTxId;
|
||||||
this.tradeAmountAsLong = builder.tradeAmountAsLong;
|
this.tradeAmountAsLong = builder.tradeAmountAsLong;
|
||||||
this.tradePrice = builder.tradePrice;
|
this.tradePrice = builder.tradePrice;
|
||||||
|
this.tradeVolume = builder.tradeVolume;
|
||||||
this.tradingPeerNodeAddress = builder.tradingPeerNodeAddress;
|
this.tradingPeerNodeAddress = builder.tradingPeerNodeAddress;
|
||||||
this.state = builder.state;
|
this.state = builder.state;
|
||||||
this.phase = builder.phase;
|
this.phase = builder.phase;
|
||||||
@ -133,6 +135,7 @@ public class TradeInfo implements Payload {
|
|||||||
.withPayoutTxId(trade.getPayoutTxId())
|
.withPayoutTxId(trade.getPayoutTxId())
|
||||||
.withTradeAmountAsLong(trade.getTradeAmountAsLong())
|
.withTradeAmountAsLong(trade.getTradeAmountAsLong())
|
||||||
.withTradePrice(trade.getTradePrice().getValue())
|
.withTradePrice(trade.getTradePrice().getValue())
|
||||||
|
.withTradeVolume(trade.getTradeVolume() == null ? 0 : trade.getTradeVolume().getValue())
|
||||||
.withTradingPeerNodeAddress(Objects.requireNonNull(
|
.withTradingPeerNodeAddress(Objects.requireNonNull(
|
||||||
trade.getTradingPeerNodeAddress()).getHostNameWithoutPostFix())
|
trade.getTradingPeerNodeAddress()).getHostNameWithoutPostFix())
|
||||||
.withState(trade.getState().name())
|
.withState(trade.getState().name())
|
||||||
@ -169,6 +172,7 @@ public class TradeInfo implements Payload {
|
|||||||
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
|
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
|
||||||
.setTradeAmountAsLong(tradeAmountAsLong)
|
.setTradeAmountAsLong(tradeAmountAsLong)
|
||||||
.setTradePrice(tradePrice)
|
.setTradePrice(tradePrice)
|
||||||
|
.setTradeVolume(tradeVolume)
|
||||||
.setTradingPeerNodeAddress(tradingPeerNodeAddress)
|
.setTradingPeerNodeAddress(tradingPeerNodeAddress)
|
||||||
.setState(state)
|
.setState(state)
|
||||||
.setPhase(phase)
|
.setPhase(phase)
|
||||||
@ -199,6 +203,7 @@ public class TradeInfo implements Payload {
|
|||||||
.withPayoutTxId(proto.getPayoutTxId())
|
.withPayoutTxId(proto.getPayoutTxId())
|
||||||
.withTradeAmountAsLong(proto.getTradeAmountAsLong())
|
.withTradeAmountAsLong(proto.getTradeAmountAsLong())
|
||||||
.withTradePrice(proto.getTradePrice())
|
.withTradePrice(proto.getTradePrice())
|
||||||
|
.withTradeVolume(proto.getTradeVolume())
|
||||||
.withTradePeriodState(proto.getTradePeriodState())
|
.withTradePeriodState(proto.getTradePeriodState())
|
||||||
.withState(proto.getState())
|
.withState(proto.getState())
|
||||||
.withPhase(proto.getPhase())
|
.withPhase(proto.getPhase())
|
||||||
@ -234,6 +239,7 @@ public class TradeInfo implements Payload {
|
|||||||
private String payoutTxId;
|
private String payoutTxId;
|
||||||
private long tradeAmountAsLong;
|
private long tradeAmountAsLong;
|
||||||
private long tradePrice;
|
private long tradePrice;
|
||||||
|
private long tradeVolume;
|
||||||
private String tradingPeerNodeAddress;
|
private String tradingPeerNodeAddress;
|
||||||
private String state;
|
private String state;
|
||||||
private String phase;
|
private String phase;
|
||||||
@ -312,6 +318,11 @@ public class TradeInfo implements Payload {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TradeInfoBuilder withTradeVolume(long tradeVolume) {
|
||||||
|
this.tradeVolume = tradeVolume;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public TradeInfoBuilder withTradePeriodState(String tradePeriodState) {
|
public TradeInfoBuilder withTradePeriodState(String tradePeriodState) {
|
||||||
this.tradePeriodState = tradePeriodState;
|
this.tradePeriodState = tradePeriodState;
|
||||||
return this;
|
return this;
|
||||||
@ -392,6 +403,7 @@ public class TradeInfo implements Payload {
|
|||||||
", payoutTxId='" + payoutTxId + '\'' + "\n" +
|
", payoutTxId='" + payoutTxId + '\'' + "\n" +
|
||||||
", tradeAmountAsLong='" + tradeAmountAsLong + '\'' + "\n" +
|
", tradeAmountAsLong='" + tradeAmountAsLong + '\'' + "\n" +
|
||||||
", tradePrice='" + tradePrice + '\'' + "\n" +
|
", tradePrice='" + tradePrice + '\'' + "\n" +
|
||||||
|
", tradeVolume='" + tradeVolume + '\'' + "\n" +
|
||||||
", tradingPeerNodeAddress='" + tradingPeerNodeAddress + '\'' + "\n" +
|
", tradingPeerNodeAddress='" + tradingPeerNodeAddress + '\'' + "\n" +
|
||||||
", state='" + state + '\'' + "\n" +
|
", state='" + state + '\'' + "\n" +
|
||||||
", phase='" + phase + '\'' + "\n" +
|
", phase='" + phase + '\'' + "\n" +
|
||||||
|
@ -409,6 +409,7 @@ message TradeInfo {
|
|||||||
bool isWithdrawn = 23;
|
bool isWithdrawn = 23;
|
||||||
string contractAsJson = 24;
|
string contractAsJson = 24;
|
||||||
ContractInfo contract = 25;
|
ContractInfo contract = 25;
|
||||||
|
uint64 tradeVolume = 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ContractInfo {
|
message ContractInfo {
|
||||||
|
Loading…
Reference in New Issue
Block a user