median price
A cool upcoming feature of uniswap 2.0 is providing price feeds. Aside from providing the current price, one can provide a moving median price or a volume weighted median price for different time windows.
There are tricks to compute a moving median. You should basically maintain a binary tree for prices in a recent window keeping references between the tree and a circular buffer. At each update, delete the old element from the tree and insert a new one.
Volume weighted is a bit harder: a good compromise might be to take the median of snapshots of the k*n minutes volume-weighted and exponentially-weighted moving average every n minutes and take a median of the past m of those, e.g. n = 1, k = 2, m = 60.