Dhan Trading API: Profit and Loss Statement Calculation Using Dhan API

I am developing an application to calculate my trading profit, primarily for analyzing my trading strategies. To achieve this, I used the following API to fetch historical trading data along with associated charges and price details:

https://api.dhan.co/v2/trades/{from-date}/{to-date}/{page-number}

However, this API only provides details of orders executed on Dhan. How can I access information about expired contracts, such as the pricing and charges for buy or sell contract orders that have expired?

Any guidance would be greatly appreciated!

1 Like

Any update ??
Does Dhan provide any API for that?

Hello @arunondhan

Welcome to MadeForTrade community!

Can you elaborate more on this? If there are expired contracts that were open positions for your account, then you would like to view details of that. Is this correct?

Yes,

Suppose I bought a NIFTY option on the expiry day morning and let the contract expire without selling it in the evening.

I believe the above API will only give the details of the BUY order. Because of that, I can’t calculate the profit and loss of that trade.

Hello @arunondhan

Yes, in this scenario, the API will only give details about the BUY order, since the SELL order never actually took place.

Then , how iI can determine that trade is in profit or loss, How to calculate that using this partial data…
Is ther any other APi provides the information which is useful to calculate the profit and loss

Hello @arunondhan

We do not have P&L Statements as of now on APIs, but that should solve for this.

We are working on our back-office, as you might have seen on the community. Post that, will explore adding it on APIs as well.

This is one of the scenarios, but you can maintain a list of such positions, should be easy to calculate with the exception on this.