remove incomplete trades from trade summary to fix #1029

This commit is contained in:
woodser 2024-06-20 11:19:28 -04:00
parent 5108c22a29
commit 69a1e67da2
2 changed files with 9 additions and 1 deletions

View file

@ -41,6 +41,14 @@ public class ClosedTradableUtil {
public static Map<String, Long> getTotalVolumeByCurrency(List<Tradable> tradableList) { public static Map<String, Long> getTotalVolumeByCurrency(List<Tradable> tradableList) {
Map<String, Long> map = new HashMap<>(); Map<String, Long> map = new HashMap<>();
tradableList.stream() 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()) .flatMap(tradable -> tradable.getOptionalVolume().stream())
.forEach(volume -> { .forEach(volume -> {
String currencyCode = volume.getCurrencyCode(); String currencyCode = volume.getCurrencyCode();

View file

@ -2180,7 +2180,7 @@ public abstract class Trade implements Tradable, Model {
return tradeAmountTransferred(); return tradeAmountTransferred();
} }
private boolean tradeAmountTransferred() { public boolean tradeAmountTransferred() {
return isPaymentReceived() || (getDisputeResult() != null && getDisputeResult().getWinner() == DisputeResult.Winner.SELLER); return isPaymentReceived() || (getDisputeResult() != null && getDisputeResult().getWinner() == DisputeResult.Winner.SELLER);
} }