Regarding DhanHQ API V2

Hi @Hardik & Dhan Team,

Couldn’t make it to Mumbai on time therefore attended the API session via live feed on YouTube today.

First of all many thanks and congratulations for organizing an event dedicated to API traders, appreciate your Team’s focus on this community.

Also, i requested this info earlier but finally happy to know that the processing time of order API is under 75ms, which is very good and i hope it is improved further and made as quick as Dhan Web platform (<25ms)

Very excited for new features introduced in Version 2 of DhanHQ API, specially the sandbox, it will save us an considerable amount of time and money.

As you launched the V2 today in this event, but i am still unable to find DhanHQ API V2 on Github dhan-oss (Dhan) · GitHub

And also on another note, as discussed in below thread Urgent: Positions Miscalculated dhan.getpositions()

has this been fixed in this major update ?

Does the get position in the V2 contain a field (net_qty_BuyAvg Price / net_qty_SellAvg Price) that provides only the current open position BuyAvg price or SellAvg price.

As discussed in that thread the get position as in current version 1.3 provides avg price but it also includes the closed positions while calculating this, thus making the ‘buyAvg’ and ‘sellAvg’ inaccurate for current open position.

Whereas the total averages of all position for the day should only be displayed in ‘dayBuyQty’: , ‘daySellQty’: , ‘dayBuyValue’: , ‘daySellValue’:

I sincerely hope it has been fixed in this major update.

1 Like

Hello @Tushar11

Welcome to MadeForTrade community!

Currently, we have not updated our Python library, it is in works.

On the Positions point, it is not an issue but the intended behaviour for the following scenario:

  1. Let’s say you buy Nifty Option for carry forward position on Day 1.
  2. On Day 2, the value will be in carryForward* tags and average price/quantity tags.
  3. If you add more quantity for same contract in CNC or Intraday, the new quantity and price will come in day* quantity/price and the average values will be updated for the same.

I hope this clarifies on the fields and their use case.