mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Merge pull request #5849 from chimp1984/add-limit-to-tradestats
Add checks for trade statistics
This commit is contained in:
commit
e50cd42478
@ -17,12 +17,14 @@
|
||||
|
||||
package bisq.core.trade.statistics;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.monetary.Altcoin;
|
||||
import bisq.core.monetary.AltcoinExchangeRate;
|
||||
import bisq.core.monetary.Price;
|
||||
import bisq.core.monetary.Volume;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.offer.bisq_v1.OfferPayload;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.trade.model.bisq_v1.Trade;
|
||||
import bisq.core.trade.model.bsq_swap.BsqSwapTrade;
|
||||
import bisq.core.util.JsonUtil;
|
||||
@ -430,13 +432,23 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
if (currency == null) {
|
||||
return false;
|
||||
}
|
||||
long maxTradeLimit = Coin.COIN.multiply(2).value;
|
||||
try {
|
||||
maxTradeLimit = PaymentMethod.getPaymentMethodById(getPaymentMethod()).getMaxTradeLimitAsCoin(currency).value;
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
return amount > 0 &&
|
||||
amount <= maxTradeLimit &&
|
||||
price > 0 &&
|
||||
date > 0 &&
|
||||
paymentMethod != null &&
|
||||
!paymentMethod.isEmpty() &&
|
||||
currency != null &&
|
||||
!currency.isEmpty();
|
||||
!currency.isEmpty() &&
|
||||
(CurrencyUtil.getCryptoCurrency(currency).isPresent() ||
|
||||
CurrencyUtil.getFiatCurrency(currency).isPresent());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user