diff --git a/core/src/main/java/bisq/core/trade/ClosedTradableManager.java b/core/src/main/java/bisq/core/trade/ClosedTradableManager.java index ab533462232..284a75f862f 100644 --- a/core/src/main/java/bisq/core/trade/ClosedTradableManager.java +++ b/core/src/main/java/bisq/core/trade/ClosedTradableManager.java @@ -53,6 +53,7 @@ import java.time.Instant; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -127,6 +128,7 @@ public void readPersisted(Runnable completeHandler) { public void onAllServicesInitialized() { cleanupMailboxMessagesService.handleTrades(getClosedTrades()); maybeClearSensitiveData(); + maybeIncreaseTradeLimit(); } public void add(Tradable tradable) { @@ -172,6 +174,24 @@ public Optional getTradableById(String id) { return closedTradables.stream().filter(e -> e.getId().equals(id)).findFirst(); } + // if user has closed trades of greater size to the default trade limit and has never customized their + // trade limit, then set the limit to the largest amount traded previously. + public void maybeIncreaseTradeLimit() { + if (!preferences.isUserHasRaisedTradeLimit()) { + Optional maxTradeSize = closedTradables.stream() + .filter(e -> e instanceof Trade) + .map(e -> (Trade) e) + .max(Comparator.comparing(Trade::getAmountAsLong)); + maxTradeSize.ifPresent(trade -> { + if (trade.getAmountAsLong() > preferences.getUserDefinedTradeLimit()) { + log.info("Increasing user trade limit to size of max completed trade: {}", trade.getAmount()); + preferences.setUserDefinedTradeLimit(trade.getAmountAsLong()); + preferences.setUserHasRaisedTradeLimit(true); + } + }); + } + } + public void maybeClearSensitiveData() { log.info("checking closed trades eligibility for having sensitive data cleared"); closedTradables.stream() diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 3896e386d68..570ffe7db05 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -3735,9 +3735,10 @@ payment.limits.info=Please be aware that all bank transfers carry a certain amou See more details on the wiki [HYPERLINK:https://bisq.wiki/Account_limits]. # suppress inspection "UnusedProperty" payment.limits.info.withSigning=To limit chargeback risk, Bisq sets per-trade limits for this payment account type based \ - on the following 2 factors:\n\n\ + on the following factors:\n\n\ 1. General chargeback risk for the payment method\n\ 2. Account signing status\n\ + 3. User-defined trade limit\n\ \n\ This payment account is not yet signed, so it is limited to buying {0} per trade. \ After signing, buy limits will increase as follows:\n\