Quant Memo
Coding/●●●●●

Exponential moving average of a tick stream

An exponential moving average (EMA) smooths a series by weighting recent prices more heavily than old ones. Each new EMA blends the latest price with the previous EMA using a smoothing factor alpha (between 0 and 1): higher alpha reacts faster.

prices = [10, 20, 30], alpha = 0.5
-> [10, 15.0, 22.5]     # seed with first price, then blend

Return the EMA at each step, seeding the first value with the first price.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions