It looks like you're new here. If you want to get involved, click one of these buttons!

- 13.7K All Categories
- 0 Incidents
- 147 Node JS client
- 38 Go client
- 790 .Net API client
- 375 Kite Publisher
- 537 .Net / VBA / Excel (3rd party)
- 455 Algorithms and Strategies
- 988 Java client
- 1.1K API clients
- 402 PHP client
- 3.9K Python client
- 344 Mobile and Desktop apps
- 1.4K Market data (WebSockets)
- 3.3K General

Hi team,

We're trying to build a VWAP based strategy in Python and for that we're calculating VWAP using the formula given below;

**Σ (Volume x Price) / Σ (Volume)**

After testing this across multiple stocks and across multiple timeframes, we've observed that the VWAP value calculated using the formula above**does not match** the VWAP value that is plotted on Kite charts (VWAP indicator line).

We know that**Average Traded Price (ATP)** is already provided as part of the quote packet structure but there seems to be a lot of confusion about whether ATP is the same as VWAP? General observation shows that ATP (in market depth) and VWAP (on charts) are different values for most of the time.

It'd be really helpful if someone here could help us out in calculating the correct VWAP value which matches with the VWAP value plotted on the charts.

@sujith @Kailash @Vivek @tonystark @rakeshr

Also, we've already referred the following threads related to this topic but haven't got a satisfactory answer;

https://kite.trade/forum/discussion/3641/vwap

https://kite.trade/forum/discussion/4452/what-is-the-formula-used-for-vwap-in-kite

https://kite.trade/forum/discussion/6576/what-formula-does-zerodha-use-for-vwap-calculation

https://kite.trade/forum/discussion/6192/vwap-average-traded-price

https://kite.trade/forum/discussion/753/does-kite-connect-sdks-offer-vwap-as-a-function

We're trying to build a VWAP based strategy in Python and for that we're calculating VWAP using the formula given below;

After testing this across multiple stocks and across multiple timeframes, we've observed that the VWAP value calculated using the formula above

We know that

It'd be really helpful if someone here could help us out in calculating the correct VWAP value which matches with the VWAP value plotted on the charts.

@sujith @Kailash @Vivek @tonystark @rakeshr

Also, we've already referred the following threads related to this topic but haven't got a satisfactory answer;

https://kite.trade/forum/discussion/3641/vwap

https://kite.trade/forum/discussion/4452/what-is-the-formula-used-for-vwap-in-kite

https://kite.trade/forum/discussion/6576/what-formula-does-zerodha-use-for-vwap-calculation

https://kite.trade/forum/discussion/6192/vwap-average-traded-price

https://kite.trade/forum/discussion/753/does-kite-connect-sdks-offer-vwap-as-a-function

Tagged:

If you are still looking for an answer on getting the accurate values for vwap as seen zerodha charts, then try using the below.

For this you would required historical data.

import ta #ta library

data['vwap'] = ta.volume.volume_weighted_average_price(data['high'], data['low'], data['close'], data['volume'], window=90, fillna=True)

lst += [live_data[i]["average_price"]]

, use the above for VWAP calculation