'DH-906', 'errorMessage': 'Incorrect request for order and cannot be processed'}

Team,

I am getting below error while placing a forever order using v2 API.

import requests

url = “https://api.dhan.co/v2/forever/orders

payload = {
“dhanClientId”: “XXXXX”,
“correlationId”: “123abc678”,
“orderFlag”: “SINGLE”,
“transactionType”: “BUY”,
“exchangeSegment”: “NSE_EQ”,
“productType”: “CNC”,
“orderType”: “LIMIT”,
“validity”: “DAY”,
“securityId”: “542012”,
“quantity”: 2,
“disclosedQuantity”: 2,
“price”: 874.2,
“triggerPrice”: 874.2,
“price1”: 874.2,
“triggerPrice1”: 874.2,
“quantity1”: 2
}
headers = {
“access-token”: “XXXXXX”,
“Content-Type”: “application/json”,
“Accept”: “application/json”
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())

Error:

{
“errorType”: “Order_Error”,
“errorCode”: “DH-906”,
“errorMessage”: “Incorrect request for order and cannot be processed”
}

Yes even i am getting the same error, earlier my code was working, from friday evening its not working. please someone help. also i have come to know that access token validity is reduced from 30 days to 24 hours. please increase the same.

1 Like

Hi @Ramyageethika ,

If you wish to place a Forever Single Order, you do not need to enter the fields “price1”, “triggerPrice1”, and “quantity1”. You may also remove the co-relation ID, as it is only conditionally required.

Please refer the document here - Forever Order - DhanHQ Ver 2.0 / API Document

Hi @Tanuja_Vasuja ,

Please help us with the Order Placement Request Code and the endpoints so that we can help you out.

Also, the access token validity has been changed to 24 hours as per the regulations set by the exchange and regulators.

You may read here - https://private-poc.madefortrade.in/t/guidelines-on-algorithmic-trading-for-retail-traders/55811