mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 13:13:36 +01:00
adjust amount by smallest volume increments
This commit is contained in:
parent
11451498f9
commit
9d5ea3db4c
@ -166,8 +166,10 @@ public class CoinUtil {
|
|||||||
long adjustedAmount = HavenoUtils.centinerosToAtomicUnits(Math.round(HavenoUtils.atomicUnitsToCentineros(amountByVolume) / 10000d) * 10000).longValueExact();
|
long adjustedAmount = HavenoUtils.centinerosToAtomicUnits(Math.round(HavenoUtils.atomicUnitsToCentineros(amountByVolume) / 10000d) * 10000).longValueExact();
|
||||||
|
|
||||||
// If we are above our trade limit we reduce the amount by the smallestUnitForAmount
|
// If we are above our trade limit we reduce the amount by the smallestUnitForAmount
|
||||||
|
BigInteger smallestUnitForAmountUnadjusted = price.getAmountByVolume(smallestUnitForVolume);
|
||||||
while (adjustedAmount > maxTradeLimit) {
|
while (adjustedAmount > maxTradeLimit) {
|
||||||
adjustedAmount -= smallestUnitForAmount.longValueExact();
|
adjustedAmount -= smallestUnitForAmount.longValueExact();
|
||||||
|
adjustedAmount -= smallestUnitForAmountUnadjusted.longValueExact();
|
||||||
}
|
}
|
||||||
adjustedAmount = Math.max(minTradeAmount, adjustedAmount);
|
adjustedAmount = Math.max(minTradeAmount, adjustedAmount);
|
||||||
adjustedAmount = Math.min(maxTradeLimit, adjustedAmount);
|
adjustedAmount = Math.min(maxTradeLimit, adjustedAmount);
|
||||||
|
Loading…
Reference in New Issue
Block a user