What is the correct way to calculate VWAP and is Average Price the same as VWAP?

Hi team :wave:

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.

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

As per this answer this, VWAP = ATP but there seems to be a difference in those two values as per our observation. :point_down: @MohammedFaisal kindly help.

Also, in Zerodha’s official support documentation it says VWAP = ATP :point_down:

@siva @qna @nithin

Thank you.

@Shashank_Shirke, Yes, both ATP(Average Traded Price) and VWAP(Volume weighted average price) are the same by definition.
The ATP is received from the exchange and is the volume-weighted average price of all trades at the exchange, while the VWAP on the chart is calculated on our end based on the ticks received from the exchange.

We don’t receive ticks for all trades executed on the exchange. For example, SBIN might have 1000 trades executed in 1 second but the broker receives only 1 or 2 ticks for that second. Since the chart candles and VWAP are built using this data, not all trades are captured leading a difference. The number of ticks and the accuracy is explained in detail in this thread.
This difference can be found in 1 min charts. Over longer duration charts, you will see a lower variance.

Hope this helps!

1 Like