API V2 Margin calculator endpoint

Hi Team,
Margin V2 endpoint is throwing error
'{“errorType”:“Order_Error”,“errorCode”:“DH-906”,“errorMessage”:“Incorrect request for order and cannot be processed”}

Request you to confirm if endpoint is working
Developer Kit SS

import http.client
import json

def calculate_margin(dhanClientId,token,exchangeSegment, transactionType, quantity, productType, securityId, price, triggerPrice):
    payload = {
        "dhanClientId": dhanClientId,
        "exchangeSegment": exchangeSegment,
        "transactionType": transactionType,
        "quantity": quantity,
        "productType": productType,
        "securityId": securityId,
        "price": price,
        "triggerPrice": triggerPrice
    }

    headers = {
        'access-token': token,
        'Content-Type': "application/json",
        'Accept': "application/json"
    }

    conn = http.client.HTTPSConnection("api.dhan.co")
    conn.request("POST", "/v2/margincalculator", json.dumps(payload), headers)

    res = conn.getresponse()
    data = res.read()

    return data.decode("utf-8")

response = calculate_margin(
    dhanClientId=client_id(),
    token= access_token(),
    exchangeSegment="NSE_EQ",
    transactionType="BUY",
    quantity=10,
    productType="CNC", 
    securityId="1594", #infy
    price=1500,
    triggerPrice=0
)

print(response)

Hallo @Dhan pls help

Hello @optionstrader

Checking this. Let me try to reproduce this and get back to you.

Hello @optionstrader

This is working now. Sorry for the delay in updating the same here.

1 Like

Hi, checked yesterday. Will retry and let you know

1 Like