mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
restrict max price deviation to 20%
This commit is contained in:
parent
ed67b8d6b1
commit
f5254f2cb6
2 changed files with 10 additions and 8 deletions
|
@ -173,9 +173,6 @@ public final class Preferences implements Persistable {
|
|||
usePercentageBasedPrice = persisted.getUsePercentageBasedPrice();
|
||||
showOwnOffersInOfferBook = persisted.getShowOwnOffersInOfferBook();
|
||||
maxPriceDistanceInPercent = persisted.getMaxPriceDistanceInPercent();
|
||||
// Backward compatible to version 0.3.6. Can be removed after a while
|
||||
if (maxPriceDistanceInPercent == 0d)
|
||||
maxPriceDistanceInPercent = 0.2;
|
||||
|
||||
try {
|
||||
setNonTradeTxFeePerKB(persisted.getNonTradeTxFeePerKB());
|
||||
|
@ -195,7 +192,7 @@ public final class Preferences implements Persistable {
|
|||
dontShowAgainMap = new HashMap<>();
|
||||
preferredLocale = getDefaultLocale();
|
||||
preferredTradeCurrency = getDefaultTradeCurrency();
|
||||
maxPriceDistanceInPercent = 0.2;
|
||||
maxPriceDistanceInPercent = 0.1;
|
||||
|
||||
storage.queueUpForSave();
|
||||
}
|
||||
|
|
|
@ -297,15 +297,20 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
|||
deviationListener = (observable, oldValue, newValue) -> {
|
||||
try {
|
||||
double value = formatter.parsePercentStringToDouble(newValue);
|
||||
preferences.setMaxPriceDistanceInPercent(value);
|
||||
if (value <= 0.2) {
|
||||
preferences.setMaxPriceDistanceInPercent(value);
|
||||
} else {
|
||||
new Popup().warning("Amounts larger than 20 % are not allowed.").show();
|
||||
UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} catch (NumberFormatException t) {
|
||||
log.error("Exception at parseDouble deviation: " + t.toString());
|
||||
UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
|
||||
UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
};
|
||||
deviationFocusedListener = (observable1, oldValue1, newValue1) -> {
|
||||
if (oldValue1 && !newValue1)
|
||||
UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
|
||||
UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
|
||||
};
|
||||
|
||||
transactionFeeInputTextField = addLabelInputTextField(root, ++gridRow, "Withdrawal transaction fee (satoshi/byte):").second;
|
||||
|
@ -424,7 +429,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
|||
});
|
||||
blockChainExplorerComboBox.setOnAction(e -> preferences.setBlockChainExplorer(blockChainExplorerComboBox.getSelectionModel().getSelectedItem()));
|
||||
|
||||
deviationInputTextField.setText(formatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent()));
|
||||
deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent()));
|
||||
deviationInputTextField.textProperty().addListener(deviationListener);
|
||||
deviationInputTextField.focusedProperty().addListener(deviationFocusedListener);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue