Trap no dict exception in calc_vwap() as a NameError rather than UnboundLocalError