UNPKG

trading-utils

Version:

A collection of helpful trading utility functions.

14 lines 517 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.movingAverageService = void 0; const lodash_1 = require("lodash"); class MovingAverageServiceImpl { calculateSMA(prices) { return lodash_1.sum(prices) / prices.length; } calculateEMA(priceToday, prevEMA, multiplier) { return (priceToday - prevEMA) * multiplier + prevEMA; } } exports.movingAverageService = new MovingAverageServiceImpl(); //# sourceMappingURL=movingAverageService.js.map