Unable to Create PlaceOrder using Python API

Hello Team,

When I am creating a PlaceOrder(for SL), I am getting the following error message. Can you please let me know which parameter is missing.

Output - {‘errorType’: ‘Input_Exception’, ‘errorCode’: ‘DH-905’, ‘errorMessage’: ‘Missing required fields, bad values for parameters etc.’}

Note : I could able to successfully create Limit Order with the above parameters.

My Inputs are

  1. TriggerPrice is Lesser than Price - {“dhanClientId”: “xxx”, “transactionType”: “BUY”, “exchangeSegment”: “MCX_COMM”, “productType”: “MARGIN”, “orderType”: “SL”, “validity”: “DAY”, “securityId”: 472783, “quantity”: 1, “disclosedQuantity”: 0, “price”: 129560.0, “afterMarketOrder”: false, “boProfitValue”: null, “boStopLossValue”: null, “triggerPrice”: 129550.0
  2. TriggerPrice is More than Price - {“dhanClientId”: “xxx”, “transactionType”: “BUY”, “exchangeSegment”: “MCX_COMM”, “productType”: “MARGIN”, “orderType”: “SL”, “validity”: “DAY”, “securityId”: 472783, “quantity”: 1, “disclosedQuantity”: 0, “price”: 129560.0, “afterMarketOrder”: false, “boProfitValue”: null, “boStopLossValue”: null, “triggerPrice”: 129570.0
  3. TriggerPrice is Equal To Price - {“dhanClientId”: “xxx”, “transactionType”: “BUY”, “exchangeSegment”: “MCX_COMM”, “productType”: “MARGIN”, “orderType”: “SL”, “validity”: “DAY”, “securityId”: 472783, “quantity”: 1, “disclosedQuantity”: 0, “price”: 129560.0, “afterMarketOrder”: false, “boProfitValue”: null, “boStopLossValue”: null, “triggerPrice”: 129560.0}

Hey @Ameebha_D ,

To place a buy order above the market price, you can use the triggerPrice parameter. In this case, the trigger price should be lower than the price you specify.

Also, please ensure that the orderType in the payload is set to STOP_LOSS instead of SL.

Below is a sample payload for placing an order above the market:
{
“dhanClientId”: “xxxx”,
“transactionType”: “BUY”,
“exchangeSegment”: “MCX_COMM”,
“productType”: “MARGIN”,
“orderType”: “STOP_LOSS”,
“validity”: “DAY”,
“securityId”: “472783”,
“quantity”: 1,
“price”: xxxx,
“triggerPrice”: xxx
}

You may test this request structure in our sandbox as well Dhan API

Hello Shrutika,

Thank you for sharing the sample payload and it is working fine. Well appreciated for your support.

Thanks and Regards,

Arun