SDK : How to know whether we can place D or I order for a Script

Hi Team,

I was trying to buy a stock but I hit the error that Intraday orders arent allowed in that stock. Is there a way I can check so that I place the right order type while placing the order.

The log:

 *****Placing order by sending the following body to Upstox : {'quantity': 37, 'product': 'I', 'validity': 'DAY', 'price': 0, 'tag': 'UPSTOX', 'instrument_token': 'NSE_EQ|INE864X01013', 'order_type': 'MARKET', 'transaction_type': 'BUY', 'disclosed_quantity': 0, 'trigger_price': 0, 'is_amo': 'false'}


Exception when calling OrderApi->place_order: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 05 Jan 2024 05:01:39 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'message': 'request failed', 'requestId': '65557832-94e0-4fea-aa66-90c4f4d02047', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Strict-Transport-Security': 'max-age=0; includeSubDomains', 'X-Frame-Options': 'DENY', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cf_bm=FmjronkJ0F9hRgOhybfy8MUUMFJ5fCtmhMgcbdxJOU8-1704430899-1-AdqPcQsmAUSL7ep4KiB3TnEQoYu5dDnhk+/ExWapCX+xaC6YDl5erdUD5IcSL8ANivkQUfKLH1FEb5P9Dd1YsX0=; path=/; expires=Fri, 05-Jan-24 05:31:39 GMT; domain=.upstox.com; HttpOnly; Secure; SameSite=None, _cfuvid=YhN25jpo95TYj6g4bHdq0Wgc8evviu23wMgCfQI0VqI-1704430899877-0-604800000; path=/; domain=.upstox.com; HttpOnly; Secure; SameSite=None', 'Server': 'cloudflare', 'CF-RAY': '84092a23da158583-BOM'})
HTTP response body: b'{"status":"error","errors":[{"errorCode":"UDAPI100500","message":"Intraday order is not allowed on this scrip. Place a delivery order instead.","propertyPath":null,"invalidValue":null,"error_code":"UDAPI100500","property_path":null,"invalid_value":null}]}'

I was checking in the stocks CSV but it doesn’t call out anything like that:

Thanks in advance.

Regards,
Rahul

cc: @Pradeep_Jaiswar

We currently don’t have this information exposed through the API. I will relay your feedback to the product team, and if there are any updates or progress, we will inform you.

Thanks @Pradeep_Jaiswar . So, for now, I should parse the error response and then take the decision?

Certainly, you can parse the response and decide based on that for now.