INTRADAY orders through DhanHQ Py Library

Hi @Hardik

Below code is not working for INTRA product_type. Checkout the responses for both product_type, where MARGIN was success and INTRA was failure. I observed this behavior on 16Dec, when I was trying to place INTRA order, as it was expiry day for CRUDEOIL. I thought some issue with MCX segment. But today when tried INTRA order in NSE_FNO, I got the same issue, hence reporting it. Please respond ASAP.

order_BUY = dhan.place_order(
security_id=symbol,
exchange_segment=exchange_seg,
transaction_type=dhan.BUY,
quantity=qty,
order_type=order_t,
product_type=product_t,
price=limitPrice
)
print(order_BUY)

Response for MARGIN product_type

exchange_seg : NSE_FNO : <class ‘str’>, security_id : 47399 : <class ‘str’>, quantity : 100 : <class ‘int’>, order_type : MARKET : <class ‘str’>, product_type : MARGIN : <class ‘str’>, limitPrice : 0.0 : <class ‘float’>, timestamp : 18-12-2024 11:26:54
{‘status’: ‘success’, ‘remarks’: ‘’, ‘data’: {‘orderId’: ‘22241218365708’, ‘orderStatus’: ‘TRANSIT’}}

Response for INTRA product_type

exchange_seg : NSE_FNO : <class ‘str’>, security_id : 47399 : <class ‘str’>, quantity : 100 : <class ‘int’>, order_type : MARKET : <class ‘str’>, product_type : INTRA : <class ‘str’>, limitPrice : 0.0 : <class ‘float’>, timestamp : 18-12-2024 11:32:55
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-905’, ‘error_type’: ‘Input_Exception’, ‘error_message’: ‘Missing required fields, bad values for parameters etc.’}, ‘data’: {‘errorType’: ‘Input_Exception’, ‘errorCode’: ‘DH-905’, ‘errorMessage’: ‘Missing required fields, bad values for parameters etc.’}}

Hello @Himanshu_S

If you look at the documentation, you actually need to pass “INTRADAY” if you wish to take intraday trade. INTRA works when you are using the constant defined in the library, as dhan.INTRA

Thanks @Hardik for the response. I will try that. Can u pls share the link for documents. This just to make sure that I am looking at the right place.

Hello @Himanshu_S

You can look at Github code as well and documentation at Orders - DhanHQ Ver 2.0 / API Document.