Dhan API failed to provide positions

Today my code triggered multiple calls because I was checking positions in dhan I code was triggering a call
I am considering I am in the market if there is any position apart from CLOSED.
But in my logs, I saw that returned blank json inside the data key

I didn’t log the entire response and it didn’t fail while parsing
I was using the same dhan object, so with the same obj it was keep on triggering new call options because I didn’t receive non-CLOSED positions. which caused the opening of 2 CALL positions in the market and the later 140 got failed because of insufficient money.

It was great trading, but I need a more reliable solution. So that I don’t have to handle such n number of scenarios in my code.

Hello @rsohlot

A better way to handle this is to call ‘Order by Order Id’ API [/orders/{order-id}] to check on the status of the order. Once the order is in EXECUTED state, then you can call Positions API to check.

This will avoid the scenario where order is not reflected in Positions because the order might be in PENDING status at that time.

Hope this helps!