diff --git a/src/order-builder/helpers.ts b/src/order-builder/helpers.ts index a823852a..150b3e88 100644 --- a/src/order-builder/helpers.ts +++ b/src/order-builder/helpers.ts @@ -203,10 +203,10 @@ export const getMarketOrderRawAmounts = ( if (side === Side.BUY) { const rawMakerAmt = roundDown(amount, roundConfig.size); let rawTakerAmt = rawMakerAmt / rawPrice; - if (decimalPlaces(rawTakerAmt) > roundConfig.amount) { - rawTakerAmt = roundUp(rawTakerAmt, roundConfig.amount + 4); - if (decimalPlaces(rawTakerAmt) > roundConfig.amount) { - rawTakerAmt = roundDown(rawTakerAmt, roundConfig.amount); + if (decimalPlaces(rawTakerAmt) > roundConfig.size) { + rawTakerAmt = roundUp(rawTakerAmt, roundConfig.size + 4); + if (decimalPlaces(rawTakerAmt) > roundConfig.size) { + rawTakerAmt = roundDown(rawTakerAmt, roundConfig.size); } } return { @@ -217,10 +217,10 @@ export const getMarketOrderRawAmounts = ( } else { const rawMakerAmt = roundDown(amount, roundConfig.size); let rawTakerAmt = rawMakerAmt * rawPrice; - if (decimalPlaces(rawTakerAmt) > roundConfig.amount) { - rawTakerAmt = roundUp(rawTakerAmt, roundConfig.amount + 4); - if (decimalPlaces(rawTakerAmt) > roundConfig.amount) { - rawTakerAmt = roundDown(rawTakerAmt, roundConfig.amount); + if (decimalPlaces(rawTakerAmt) > roundConfig.size) { + rawTakerAmt = roundUp(rawTakerAmt, roundConfig.size + 4); + if (decimalPlaces(rawTakerAmt) > roundConfig.size) { + rawTakerAmt = roundDown(rawTakerAmt, roundConfig.size); } }