[api] Added `lib/moving-average.js` for calculating Simple, Weighted, and Exponentially Weighted Moving averages.