How to pass the filters PRICE_FILTER and LOT_SIZE?

After seeing how sometimes the orders that I placed were not executed, I decided to implement a filter verification to obtain the correct price and quantity before placing the order, the process is simple, first lower the average price according to the following endpoint 'GET / api / v3 / avgPrice 'and later do the verification that is mentioned in the documentation, this is the code that I implement to achieve it and pass the filters

        await avgPrice(symbol, d => aPrice = parseFloat(parseFloat(d.price).toFixed(fix)))
        priceFilter = parseFloat(((aPrice - minPrice) % tickSize).toFixed(fix))

        while(priceFilter != 0){
            console.error('PRICE FILTER ERRR', priceFilter, aPrice)
            aPrice = parseFloat((aPrice + tickSize).toFixed(fix))
            priceFilter = parseFloat(((aPrice - minPrice) % tickSize).toFixed(fix))

        if(aPrice > price * multiplierUp || aPrice < price * multiplierDown){
            throw new TypeError('PERCENT_PRICE ERROR')

        quantity = parseFloat((amount / aPrice).toFixed(fixQty))
        lotSizeFilter = parseFloat(((quantity - minQty) % stepSize).toFixed(fix))

        while(lotSizeFilter != 0){
            console.error('LOT_SIZE ERROR', lotSizeFilter, quantity)
            quantity = parseFloat((quantity + stepSize).toFixed(fix))
            lotSizeFilter = parseFloat(((quantity - minQty) % stepSize).toFixed(fix))

        if(quantity * aPrice <= minNotional){
            throw new TypeError('Total value must be at least ' + minNotional)

        var mkOrder = await marketOrder('TEST', symbol, 'BUY', quantity, null, null, d => console.log('OPEN LONG', d))

In some cases it works well, sometimes it passes the filters to the first as seen in the image

And in others after increasing the price a few times according to the tickSize it manages to pass the filter as seen in the following image

The problem is that there are certain cryptos that only pass the price filter after increasing the price too much and even after the first filter passes, they also increase the quantity to buy too much to pass the LOT_SIZE filter, such is the case of TRONUSDT or EOSUSDT and I suppose there are many more but those are the ones I check for now

What can I do in these cases?
Is it necessary to do filter validation on all cryptos?
How can I place an order in cryptos that raise the price and quantity to buy too much to be able to pass the filters as in the case of TRONUSDT?
How is it possible that the Binance app can pass these filters without raising both the price and the quantity to buy?

It’s necessary to understand all filters on each symbols, which is available from /api/v3/exchangeInfo. It may be a good idea to call this endpoint and fetch the filters value to help with new orders.

I do it

async function openLong(){
        var aPrice, priceFilter, quantity, lotSizeFilter, buyPrice,
        filters = symbols[symbol].filters,
        stepSize = parseFloat(filters.LOT_SIZE.stepSize),
        minQty = parseFloat(filters.LOT_SIZE.minQty),
        minNotional = parseFloat(filters.MIN_NOTIONAL.minNotional),
        minPrice = parseFloat(filters.PRICE_FILTER.minPrice),
        tickSize = parseFloat(filters.PRICE_FILTER.tickSize),
        multiplierUp = parseFloat(filters.PERCENT_PRICE.multiplierUp),
        multiplierDown = parseFloat(filters.PERCENT_PRICE.multiplierDown),
        fixQty = stepSize.toString().indexOf(1, 0) - stepSize.toString().indexOf('.', 0),
        quoteAsset = symbols[symbol].quoteAsset,
        quoteBalance = await assetBalance('MARGIN', quoteAsset)