Can someone pls give me a sample code snippet for placing a SL-Limit order via api (python).

Hi,

I am trying to place a stop loss order for my options position. As SL-M orders are not allowed, the only option is to use SL-Limit order. However, this is constantly being rejected with a weird error code.

I am sure most of you are already placing SL-Limit orders are part of your algo. Could you share the code snippet pls. This would let me compare mine and find out what is the mistake.

This is the code I am using.

orderData = {‘symbol’: ‘NSE:NIFTY22O2017400CE’, ‘qty’: 50, ‘type’: 4, ‘side’: -1, ‘productType’: ‘INTRADAY’, ‘limitPrice’: 165.0, ‘stopPrice’: 165.05, ‘validity’: ‘DAY’, ‘disclosedQty’: 50, ‘offlineOrder’: False}

orderResp = fyers.place_order(orderData)

Order gets rejected with the following error:

Error message : EXCH:16416:Invalid Counter Broker Id