Binance API return Error: Filter failure: LOT_SIZE

 The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts:

minQty defines the minimum quantity/icebergQty allowed.

maxQty defines the maximum quantity/icebergQty allowed.

stepSize defines the intervals that a quantity/icebergQty can be increased/decreased by.

In Binance, we use the API follow to get lot_size of symbol

GET /api/v3/exchangeInfo

We can use the function below to make valid quantity:

const getValidQuantity = (floatNumber, lotSize) => {
const n = lotSize.split('.')[1]?.indexOf('1') + 1;
return toFixedWithoutRounding(floatNumber, n);


const toFixedWithoutRounding = (floatNumber, n) => {
const x = Math.pow(10, n);
return parseFloat(
(parseInt(floatNumber * x) / x).toFixed(n)

I hope this helpful for you!

Nhận xét

Bài đăng phổ biến từ blog này

TypeORM should using repository or query buider ?

Type of children prop in React Typescript

MSAL: Difference between Public Client Application And Confidential Client Application