What should be the OrderType for COVER Order using API, whatever I give I get DH-906. Neither the error message is detailed enough nor the documentation quoting all possible combinations of OrderType and ProductType. Also no examples for each OrderType.
Hello @ramb
Great to see you after a while and exploring DhanHQ APIs.
If you are using python, there is examples file where you can find the same in the library. In case you are using REST APIs directly, would ask you to refer documentation.
If you are still facing issue, you can post your JSON request here and someone from community can help you out.
Thanks Hardik, Please find below details
Request
transaction_type=dhan.BUY
order_type=dhan.SLM
product_type=dhan.CO
dhan.place_order(security_id=security_id,exchange_segment=exchange_segment,transaction_type=transaction_type,quantity=qty,order_type=order_type,product_type=product_type,trigger_price=sltriggerr,price=0)
Resp
{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-906’, ‘error_type’: ‘Order_Error’, ‘error_message’: ‘Missing required fields, bad values for parameters etc.’}, ‘data’: {‘errorType’: ‘Order_Error’, ‘errorCode’: ‘DH-906’, ‘errorMessage’: ‘Missing required fields, bad values for parameters etc.’}}
@Hardik Can you pls check, below is postman request / response
{
“dhanClientId”:“1105414195”,
“transactionType”:“BUY”,
“exchangeSegment”:“NSE_EQ”,
“productType”:“CO”,
“orderType”:“STOP_LOSS_MARKET”,
“validity”:“DAY”,
“securityId”:“1594”,
“quantity”:“1”,
“price”:“0”,
“triggerPrice”:“1900”
}
{
“errorType”: “Input_Exception”,
“errorCode”: “DH-905”,
“errorMessage”: “Missing required fields, bad values for parameters etc.”
}
@Hardik Can you check it pls, I am getting the error for any order
Hello @ramb
Looks like you are placing cover order with order type as stop loss market. You can keep order type as simply market, because the initial leg will go as market order only.
SLM with COL worked, thanks