Precision is over the maximum defined for this asset.

I have a hard time trying to fix this error but I failed. I always get this error:

{ code: -1111, msg: ‘Precision is over the maximum defined for this asset.’ }

I need to create OCO sell orders in Node js.
Here is my approach:

let takeProfit = priceAtPurchase * (1 + 0.005)
let stopLoss = priceAtPurchase * (1 - 0.005)
let stopLossLimit = stopLoss * (1 - 0.001)

const stepSize = await getStepSize(pair)

takeProfit = roundStepSize(takeProfit, stepSize)
stopLoss = roundStepSize(stopLoss, stepSize)
stopLossLimit = roundStepSize(stopLossLimit, stepSize)

How can I implement these 3 variables above and yet keep the amount that Binance accept? … So I can pass them to the OCO order URL like this without issues:

const queryString = symbol=${pair}&side=SELL&quantity=${baseBalance}&price=${takeProfit}&stopPrice=${stopLoss}&stopLimitPrice=${stopLossLimit}&stopLimitTimeInForce=GTC&timestamp=${Date.now()}

Hope someone can help.

You should abide to the rule under the exchangeInfo endpoint → PRICE_FILTER → tickSize.
For example, if the tickSize shows 0.01, the maximum allowed precision for the price of the symbol is 2 decimal places.

1 Like