Logo

Coding preview

Volume Weighted Average Price

What this preview is

About this preview

Volume Weighted Average Price is a medium quant coding problem on language knowledge in Cpp / Python, asked at Quant.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Real-time VWAP calculation over a sliding window

This is a medium-difficulty coding problem common in buy-side and market-making interviews, where candidates must implement an efficient data structure to track a time-windowed aggregate metric on a live trade stream. It tests both correctness in computing the metric and algorithmic efficiency under repeated queries.

The core challenge is balancing two demands: the add_tick method must be fast (ticks arrive at high frequency), but get_vwap

  • Sliding-window aggregation patterns
  • Trade-offs between insertion and query cost
  • Timestamp-based filtering and data structure choice (deque, segment tree, or two-pointer sliding window)