error code -50

Hi ,
I’m using fyers API v3 , and getting “{‘code’: -50, ‘message’: ‘stop_price does not match: 0’, ‘s’: ‘error’}” error, though after making the stop-loss multiple of tick_size, even rounding off to integer getting the same error. I’m using order placement API

sl = round(sl / tick_size) * tick_size

data = {

    "symbol":f"NSE:{symbol}-EQ",

    "qty":quantity,

    "type":order_type,

    "side":buy_sell_flag,

    "productType":"INTRADAY",

    "limitPrice":entry_price,

    "stopPrice":sl,

    "takeProfit":target, 

    "validity":"DAY",

    "disclosedQty":0,

    "offlineOrder":False,

}

response =[ fyers.plac](http://fyers.place)e_order(data=data)

I found two mistakes,

  1. The product type was incorrect, it should be “BO”
  2. The valid attribute is “stopLoss” and not stopPrice" for “BO”

it is working fine now.

Hey @114504570747008532661

Yes you are right , if you want to place a SL during initial order placement , you should make the product type as ‘BO’