Unable to place BO orders via Fyers API V2

POST /api/v2/orders

Payload 1 - (Java request object details below)

(symbol=NSE:FINNIFTY2410921400CE, qty=40, type=1, side=1, productType=BO, limitPrice=116.35, stopPrice=0, disclosedQty=0, validity=DAY, offlineOrder=False, stopLoss=11.65, takeProfit=23.30)

Payload 2 - (Java request object details below)

(symbol=NSE:NIFTY2410421650CE, qty=50, type=1, side=1, productType=BO, limitPrice=57.25, stopPrice=0, disclosedQty=0, validity=DAY, offlineOrder=False, stopLoss=5.75, takeProfit=11.45)

Response: (for both payloads)

{“s”: “error”, “code”: 500, “message”: “Looks like you are passing an invalid entry”}

Can someone please help explain what is invalid in the request? The error is not clear to say what is invalid

Hi @the_pug

The take profit should be set above the limit price. In this scenario, with an entry price of 116.35, the specified take profit is 23.30.

For options , When the Last Traded Price (LTP) is above 50 rupees, the stop loss or take profit must be positioned at 40% above or below the LTP. and if the LTP is below 50 rupees, the stop loss or take profit should be set at 20% above or below the LTP.

Hi @WWhYB2qrsx - are you suggesting the TP should have been Limit Price + Desired TP. So, TP = 116.35 + 23.30

If that is the case, we just changed it based on Fyers API support to use 23.30 rather than 116.35 + 23.30. Either way we get the same error message

@WWhYB2qrsx do you have a sample Bracket order from your test suite that works with Options? Or can you please use my inputs and see what is the actual validation error?

For me right now there are 2 issues

  • No sandbox environment to test the api
  • No visibility of the actual violating field

Hey @the_pug

For example if bracket order is placed for a scrip with LTP of 6186 , please find the inputs:

“symbol”:“MCX:GOLDPETAL24JANFUT”,

"qty":1,

"type":2,

"side":1,

"productType":"BO",

"limitPrice":0,

"stopPrice":0,

"validity":"DAY",

"disclosedQty":0,

"offlineOrder":False,

"stoploss":20,

"takeProfit":30

Please refer to the order placement guide to see the parameters to place orders ,
https://myapi.fyers.in/docsv3#tag/Order-Placement-Guide

Currently we do not have a test environment as such.