mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 12:39:23 +00:00
adjust amount by smallest volume increments
This commit is contained in:
parent
11451498f9
commit
9d5ea3db4c
1 changed files with 2 additions and 0 deletions
|
@ -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 a new issue