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

Weighted Moving Average

What this preview is

Weighted Moving Average is a easy quant coding problem on language knowledge in Python, asked at Quant.

Difficulty
Easy
Topic
Language Knowledge
Discipline
Quant development
Language
Python

Implementing a weighted moving average in Python

This is an easy coding problem that tests your ability to implement a core quantitative finance calculation cleanly. Weighted moving averages are used constantly in signal generation and trend filtering, so firms like quant trading desks expect candidates to code this accurately and efficiently on first attempt.

The problem rewards careful index handling and correct application of the weight formula. You need to iterate over valid window positions, compute the linearly-weighted sum of prices in each window, normalize by the sum of weights, and format the output properly. Edge cases (window too large, invalid sizes) should be handled explicitly.

  • Sliding window iteration and boundary conditions
  • Arithmetic series and weight normalization
  • List comprehension and rounding to specification

Unlock full access to getcracked

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