| jmcph4 |

Volume Weighted Average Price (VWAP)

The volume weighted average price (VWAP) of an asset over some arbitrary time period is a transformation of the actual price that adjusts for the volume over the period.[1][2]

vwap :: Fractional a => [(a, a)] -> a
vwap trades = (sum $ map (\(price, quantity) -> prices * quantity) trades) / (sum $ map (\(price, quantity) -> quantity) trades)

VWAP often only considers trades that are "on-market" -- i.e., any trades that can be accessed by randomly-selected market participants[3].

References

  1. Wikipedia entry
  2. Investopedia entry
  3. J. McCulloch and V. Kazakov, "Optimal VWAP Trading Strategy and Relative Volume", Quantitative Finance Research Centre, Sydney, 2007. Accessed: Jun. 25, 2022. [Online] Available: https://www.uts.edu.au/sites/default/files/qfr-archive-02/QFR-rp201.pdf