OCO order, Filter failure: PRICE_FILTER

I have bad response 400, exact error message:

{"code":-1013,"msg":"Filter failure: PRICE_FILTER"}

My post url:

https://api.binance.com/api/v3/orderList/oco?symbol=BTCUSDT&side=SELL&quantity=0.00012&timestamp=1738863746000&aboveType=LIMIT_MAKER&belowType=STOP_LOSS&abovePrice=98010.50603672&belowStopPrice=95953.85396328&newOrderRespType=FULL

Here is the data:

  1. at the Thu Feb 06 2025 17:42:26 GMT+0000 the price of the BTC_USDT was at 96982.17500000

  2. side=SELL

  3. aboveType=LIMIT_MAKER and belowType=STOP_LOSS

  4. abovePrice=98010.50603672 and belowStopPrice=95953.85396328

so in my opinion it looks like this,

if the price hits abovePrice then the above order should be executed with profit outcome and the below order should be cancelled,

if the price hits belowStopPrice then the below order should be executed with loss outcome and the above order should be cancelled.

The problem is that i cant understand what am I missing.

Yes i read the docs here, but it didn’t help.

You have too many decimal places. Please read this: Filters | Binance Open Platform

So you need to round your price and quantity like this:
roundedPrice = price - price % pricePrecision
roundedQuantity = quantity - quantity % quantityPrecision

You can get the precisions from the exchangeInfo endpoint:
PRICE_FILTER > ticksize for pricePrecision
LOT_SIZE > stepSize for quantityPrecision

Thanks for the answer, but I still misunderstand what I should do.

Like with price, i should round abovePrice:

abovePrice=98010.50603672

tickSize=0.01000000

Ok, i get the error when i do math with abovePrice like this:

98010.50603672 - 98010.50603672 % 0.01000000 = roundedPrice(ERROR)

DivisionByZeroError: Modulo by zero

Implicit conversion from float 98010.50603672 to int loses precision

Implicit conversion from float 0.01 to int loses precision

I think I got it :slight_smile:

abovePrice should be sent like this 98010.50000000, so after the 98010.50 should not be any numbers except zeros.

98010.50603672 - 98010.50603672 % 0.01000000 = 98010.5 Google Search

Or you could do 98010.50603672 / 0.01 → round to int → 9801050 * 0.01 = 98010.5

1 Like

This is exactly what I implemented. Thanks for your quick help!