Trading View Json for Basket

This is a sample JSON for one of the basket
{
“secret”: “rMHzQ”,
“alertType”: “basket”,
“basket_id”: “bae75f73-2860-4f3c-928e-10036a201aa3”
}

Iirespective of basket name , in my case the secret attribute value is same. Is it not possible to include basket_id as the name of the basket ? Why is the basket name encrypted ? It would be easy for the user to manipulate the json rather than generating JSON for each basket name . The user would just put the actual basket name in nasket_id and directly call from trading view, since secret code is the same for all the baskets

Hello @ngbhat

As you rightly pointed out, secret parameter value will remain the same across all basket JSONs. This is because secret parameter is related to the Webhook URL and not the basket details.

basket_id is a system generated ID for each basket. This basket ID is unique in Dhan System and the webhooks place order on this parameter only. This is how the back-end system has been configured to avoid duplicacy and minimise probability of error.

Hello Hardik,

Basket name itself is unique for the user. One cannot create duplicate basket name against his logged in user id… Since basket name is Unique for the user, is it not possible to pass the basket name (which is user friendly) to webhook , rather than create GUID for it ?

I guess my assumption may be correct that it maybe a case of cumbersome implentation , unless someone from the team replies

Hello @ngbhat

I agree that basket name is unique to user, but again basket name duplicacy check is of case-sensitive nature which means “Basket 1” and “basket 1” can exist as two different baskets for a user. This increases probability of human error. Besides that, on Dhan, you can also modify basket names. So, in a scenario where mapping is done on Basket name, everytime a user modifies basket name, we will also have to change the instruments mapped to the basket. Hence, from a system perspective, assigning unique ID to baskets for execution makes more sense.

Meanwhile, we are working to enhance order placement via Webhooks which will simplify direct orders on Webhook.

Hello Hardik,

I got your point now… Based on your explanation I found an bug. Here are the repro steps

Case 1:

  1. Create a basket named “Test1” with an strike price in it "
  2. Try create another basket name “Test1”. You will get an message “Basket with same name already exists”
  3. Now create a new Basket name “Test2” with an instrument in it
  4. Now modify the basket name “Test2” with “Test1”
  5. The basket name is modified to “Test1”
  6. Now in the baskets you will find 2 entries with “Test1”

Now based on your explanation this is case sensitive and basket name is unique. If basket name is unique while creating new basket, the same test case fails while updation. You should not allow duplicate basket name while modification too… What criteria holds good during creation should hold good during modification too

Hello @ngbhat

Thank you for highlighting this. We replicated this scenario at our end and it holds. We have noted this down and will deploy fix in the next build.

Thanks Hardik… Also please include in the next build the issue of handling irritating pop ups during script deletion from the basket

Community thread for your reference