For example, this is a SPY daily history bar I retrieved using free API, is that possible to calculate the vwap column in another way that can be verified? I try to re-calculate vwap from cumulative 1 minute bars, but the result is different from this. What is the method to calculate daily vwap column?
|
open |
high |
low |
close |
volume |
trade_count |
vwap |
timestamp |
|
|
|
|
|
|
|
2023-01-03 05:00:00+00:00 |
384.370 |
386.430 |
377.8310 |
380.82 |
74330774 |
585048 |
380.961150 |
2023-01-04 05:00:00+00:00 |
383.180 |
385.880 |
380.0000 |
383.76 |
85425119 |
628498 |
383.151245 |
2023-01-05 05:00:00+00:00 |
381.720 |
381.760 |
378.7600 |
379.38 |
76079710 |
523811 |
380.264217 |
2023-01-06 05:00:00+00:00 |
382.610 |
389.250 |
379.4127 |
388.08 |
103741286 |
683816 |
385.248218 |
@PC_Tang One thing to appreciate about the calculations for the Open, High, Low, Close, Volume, and VWAP values for a bar is they don’t typically 1) look at all the trades within the bar and 2) the different calculations look at different trades. There is more detail on this in this post.The price calculations in a bar exclude a number of trades, most notably any ‘odd lot’ trades less than 100. However, the VWAP calculation includes all trades (at least all non-info-only trades) and is sum(price x trade_volume) / sum(trade_volume)
. So, there isn’t a way to calculate VWAP from minute bars. One would need to download all the trades and calculate it from those.
Thanks @Dan_Whitnable_Alpaca. I just want to estimate vwap unbiasly using my own way, but now it looks impossible because daily vwap is calculated by sum(price x trade_volume at that day) / sum(trade_volume at that day). I wonder if daily vwap is a live number or it’s only generated on a next day like minute bar, for example, if I query it at 3:59pm, it will aggregate all trades and volume from 4am until 3:59pm, can calculate vwap for me before market close which sounds a good estimation.
Thanks @Dan_Whitnable_Alpaca. I have figured out the way to calcuate daily vwap from minute bar. I wonder if Alpaca also provides the standard devation of volume weighted price at minute bar?
@PC_Tang Alpaca doesn’t currently provide anything but price, volume, and trade count. Standard Dev isn’t provided but is a good feature request. Thank you.