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×tamp=${Date.now()}
Hope someone can help.