Skip to content

Commit

Permalink
remove incomplete trades from trade summary to fix #1029
Browse files Browse the repository at this point in the history
woodser committed Jun 23, 2024
1 parent 5108c22 commit 69a1e67
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/src/main/java/haveno/core/trade/ClosedTradableUtil.java
Original file line number Diff line number Diff line change
@@ -41,6 +41,14 @@ public static BigInteger getTotalTxFee(List<Tradable> tradableList) {
public static Map<String, Long> getTotalVolumeByCurrency(List<Tradable> tradableList) {
Map<String, Long> map = new HashMap<>();
tradableList.stream()
.filter(tradable -> {
if (tradable instanceof Trade) {
Trade trade = castToTrade(tradable);
return trade.isCompleted(); // TODO: does not consider if trade was reverted by arbitrator
} else {
return false;
}
})
.flatMap(tradable -> tradable.getOptionalVolume().stream())
.forEach(volume -> {
String currencyCode = volume.getCurrencyCode();
2 changes: 1 addition & 1 deletion core/src/main/java/haveno/core/trade/Trade.java
Original file line number Diff line number Diff line change
@@ -2180,7 +2180,7 @@ public boolean shouldPublishTradeStatistics() {
return tradeAmountTransferred();
}

private boolean tradeAmountTransferred() {
public boolean tradeAmountTransferred() {
return isPaymentReceived() || (getDisputeResult() != null && getDisputeResult().getWinner() == DisputeResult.Winner.SELLER);
}

0 comments on commit 69a1e67

Please sign in to comment.