Thanks for replying, guys! I did do my obligatory search before asking.
What I failed to make clear is that I'm not looking to calculate the VWAP based on past price history, that's the easy part. I want to implement a trading algorthm that will achieve the VWAP price by placing market and limit order as appropriate. The reason I want to do this is because guaranteed VWAP orders only work on large stocks, and IB's VWAP algo appear to be sub-optimal.