Prepping for the 2027 recruiting cycle? Use code 2027RC for 10% off, valid until July 31st! Oh, and check out our members-only recruitment services.

Logo

Coding preview

Volume-Weighted Median Price

What this preview is

About this preview

Volume-Weighted Median Price is a easy quant coding problem on finance in 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.

Volume-weighted median price in Python

This easy coding problem tests your ability to implement a common market-microstructure calculation used by traders and quant analysts. It probes understanding of order aggregation, cumulative statistics, and careful handling of tie-breaking rules.

The core challenge is smaller than it appears: sort the trades by price, aggregate volume at each level, then walk the cumulative sum until you cross the halfway point. The wrinkle is that multiple trades at the same price must be grouped before you compute cumulative volumes. This is the kind of utility function that appears in real trading systems and must handle edge cases cleanly.

  • Aggregating trades by price level
  • Cumulative sum logic and boundary detection
  • Rounding and numeric precision
  • Why median is more robust than mean for skewed volume distributions