Commodity Option OHLC Intraday not available

This is future data for commodity, it is working fine
{“securityId”:252453,“exchangeSegment”:“MCX_COMM”,“instrument”:“FUTCOM”}

but the option data for one of the strike is not returning the data
{“securityId”:257336,“exchangeSegment”:“MCX_COMM”,“instrument”:“OPTFUT”}

Can you please help

Hello @Shashidhar

This is an inactive strike and no data is available for this instrument. Hence, there is no data being returned here.

Hardik
Could you please provide code example or links for accessing MCX crude oil and F&O related using dhan api python.
Thanks

Hello @saisaigraph

Sure. Can you tell me whether you want this for placing order or fetching data?

both please. Fetch the latest expiry place order and then check for target profit and stop loss which ever is satisfied then exit order.

@saisaigraph
Okay. So for placing order, you need to ensure exchange_segment as MCX (dhan.MCX for python) and product type can be dhan.INTRA or dhan.MARGIN, depending on order you want to place.

For fetching prices, you can again refer to Security ID master, which will have the security ID for all instruments.

Hi for placing order, Im providing exchange_segment as dhan.MCX ( python) and also tried adding MCX_COMM. but both not working, error keeps saying "invalid security id. Its the same security id fetched from the open crude oil position via api and it says this. PLz, what else is reuqired or wrong for a placing a commodity sell order? the same api works for selling NFO etc but not for commodity.
error below:
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Invalid SecurityId’}, ‘data’: {‘errorType’: ‘Input_Exception’, ‘errorCode’: ‘DH-905’, ‘errorMessage’: ‘Invalid SecurityId’}