binary-indicators
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,0 +0,0 @@ const gulp = require('gulp'); |
@@ -26,2 +26,4 @@ 'use strict'; | ||
var stdDevDown = _config$stdDevDown === undefined ? 2 : _config$stdDevDown; | ||
var _config$pipSize = config.pipSize; | ||
var pipSize = _config$pipSize === undefined ? 2 : _config$pipSize; | ||
@@ -34,3 +36,3 @@ var vals = (0, _math.takeLast)(data, periods, field); | ||
return [middle, upper, lower]; | ||
return [+middle.toFixed(pipSize), +upper.toFixed(pipSize), +lower.toFixed(pipSize)]; | ||
}; | ||
@@ -37,0 +39,0 @@ |
@@ -6,26 +6,42 @@ 'use strict'; | ||
}); | ||
exports.exponentialMovingAverageArray = undefined; | ||
var _binaryUtils = require('binary-utils'); | ||
var _math = require('./math'); | ||
var _simpleMovingAverage = require('./simpleMovingAverage'); | ||
var ema = function ema(vals, periods) { | ||
if (vals.length === 1) { | ||
return vals[0]; | ||
} | ||
var _simpleMovingAverage2 = _interopRequireDefault(_simpleMovingAverage); | ||
var prev = ema(vals.slice(0, vals.length - 1), periods); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var EMA = function EMA(previousDay) { | ||
return 1; | ||
return (vals.slice(-1)[0] - prev) * (0, _math.weightingMultiplier)(periods) + prev; | ||
}; | ||
exports.default = function (data, config) { | ||
var exponentialMovingAverage = function exponentialMovingAverage(data, config) { | ||
var periods = config.periods; | ||
var field = config.field; | ||
var sma = (0, _simpleMovingAverage2.default)(data, config); | ||
var multiplier = (0, _math.weightingMultiplier)(periods); | ||
if (data.length < periods) { | ||
throw new Error('Periods longer than data length'); | ||
} | ||
// const prevEMA = EMA(previousDay); | ||
// const ema = close - prevEMA * multiplier + prevEMA; | ||
var vals = (0, _math.takeLast)(data, periods, field); | ||
return 0; | ||
}; | ||
return ema(vals, periods); | ||
}; | ||
var exponentialMovingAverageArray = exports.exponentialMovingAverageArray = function exponentialMovingAverageArray(data, config) { | ||
var periods = config.periods; | ||
var _config$pipSize = config.pipSize; | ||
var pipSize = _config$pipSize === undefined ? 2 : _config$pipSize; | ||
return (0, _binaryUtils.sequence)(data.length - periods + 1).map(function (x, i) { | ||
return +exponentialMovingAverage(data.slice(i, i + periods), config).toFixed(pipSize); | ||
}); | ||
}; | ||
exports.default = exponentialMovingAverage; |
@@ -28,5 +28,7 @@ 'use strict'; | ||
var periods = config.periods; | ||
var _config$pipSize = config.pipSize; | ||
var pipSize = _config$pipSize === undefined ? 2 : _config$pipSize; | ||
return (0, _binaryUtils.sequence)(data.length - periods + 1).map(function (x, i) { | ||
return simpleMovingAverage(data.slice(i, i + periods), config); | ||
return +simpleMovingAverage(data.slice(i, i + periods), config).toFixed(pipSize); | ||
}); | ||
@@ -33,0 +35,0 @@ }; |
{ | ||
"name": "binary-indicators", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Binary.com Indicators", | ||
@@ -9,8 +9,8 @@ "main": "index.js", | ||
"prepublish": "npm run build", | ||
"test": "mocha --compilers js:babel-core/register ./src/__tests__/*.js -R progress", | ||
"test:coverage": "./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha -- ./src/__tests__/*.js", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"test:eslint": "eslint src/**/*.js", | ||
"test:flow": "flow check --all --show-all-errors", | ||
"test:watch": "mocha --watch --compilers js:babel-core/register ./src/__tests__/*.js -R progress", | ||
"test:watch": "jest --watch", | ||
"test:full": "npm run test:eslint && npm run test:flow && npm run test:coveralls" | ||
@@ -25,5 +25,3 @@ }, | ||
"presets": [ | ||
"es2015", | ||
"es2016", | ||
"es2017" | ||
"latest" | ||
], | ||
@@ -41,25 +39,21 @@ "sourceMaps": true, | ||
"devDependencies": { | ||
"babel-cli": "^6.14.0", | ||
"babel-core": "^6.14.0", | ||
"babel-eslint": "^6.1.2", | ||
"babel-istanbul": "^0.11.0", | ||
"babel-cli": "^6.16.0", | ||
"babel-core": "^6.17.0", | ||
"babel-eslint": "^7.0.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.14.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-es2016": "^6.11.3", | ||
"babel-preset-es2017": "^6.14.0", | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.13", | ||
"eslint": "^3.4.0", | ||
"eslint-config-airbnb": "^10.0.1", | ||
"eslint-plugin-flowtype": "^2.11.4", | ||
"eslint-plugin-import": "^1.14.0", | ||
"eslint-plugin-jsx-a11y": "^2.2.1", | ||
"eslint-plugin-react": "^6.2.0", | ||
"babel-preset-latest": "^6.16.0", | ||
"coveralls": "^2.11.14", | ||
"eslint": "^3.7.1", | ||
"eslint-config-airbnb": "^12.0.0", | ||
"eslint-plugin-flowtype": "^2.20.0", | ||
"eslint-plugin-import": "^2.0.0", | ||
"eslint-plugin-jsx-a11y": "^2.2.3", | ||
"eslint-plugin-react": "^6.4.0", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
"mocha": "^3.0.2" | ||
"jest-cli": "^16.0.1" | ||
}, | ||
"dependencies": { | ||
"binary-utils": "^4.12.4" | ||
"binary-utils": "^4.19.1" | ||
} | ||
} |
@@ -0,0 +0,0 @@ #Binary.com Indicators |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import bollingerBands, { bollingerBandsArray } from '../bollingerBands'; | ||
@@ -13,3 +12,3 @@ | ||
const result = bollingerBands([5], { periods: 1 }); | ||
expect(result).to.deep.equal([5, 5, 5]); | ||
expect(result).toEqual([5, 5, 5]); | ||
}); | ||
@@ -20,3 +19,3 @@ | ||
const roundedResult = roundResult(result); | ||
expect(roundedResult).to.deep.equal([2, 3.63, 0.37]); | ||
expect(roundedResult).toEqual([2, 3.63, 0.37]); | ||
}); | ||
@@ -32,3 +31,3 @@ | ||
const roundedResult = roundResult(result); | ||
expect(roundedResult).to.deep.equal([2, 3.63, 0.37]); | ||
expect(roundedResult).toEqual([2, 3.63, 0.37]); | ||
}); | ||
@@ -40,3 +39,3 @@ | ||
const roundedResult = roundResult(result); | ||
expect(roundedResult).to.deep.equal([28.65, 29.09, 28.20]); | ||
expect(roundedResult).toEqual([28.65, 29.09, 28.20]); | ||
}); | ||
@@ -47,3 +46,3 @@ | ||
bollingerBands([1, 2, 3], { periods: 5 }) | ||
).to.throw(); | ||
).toThrow(); | ||
}); | ||
@@ -60,3 +59,3 @@ | ||
const roundedResult = result.map(x => roundResult(x)); | ||
expect(roundedResult).to.deep.equal(expected); | ||
expect(roundedResult).toEqual(expected); | ||
}); | ||
@@ -88,4 +87,4 @@ | ||
expect(roundedResult).to.deep.equal(wholeBand); | ||
expect(roundedResult).toEqual(wholeBand); | ||
}); | ||
}); |
@@ -1,32 +0,32 @@ | ||
import { expect } from 'chai'; | ||
import exponentialMovingAverage, { exponentialMovingAverageArray } from '../exponentialMovingAverage'; | ||
describe('exponentialMovingAverage', () => { | ||
it.skip('single value with periods of 1 equals the value', () => { | ||
it('single value with periods of 1 equals the value', () => { | ||
const result = exponentialMovingAverage([1], { periods: 1 }); | ||
expect(result).to.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
it.skip('whole data sample', () => { | ||
it('whole data sample', () => { | ||
const result = exponentialMovingAverage([1, 2, 3], { periods: 3 }); | ||
// const roundedResult = roundResult(result); | ||
expect(result).to.deep.equal(1); | ||
expect(result).toEqual(2.25); | ||
}); | ||
it.skip('wuut2', () => { | ||
it('wuut2', () => { | ||
const data = [1, 2, 3, 4, 5]; | ||
const result = exponentialMovingAverageArray(data, { periods: 3 }); | ||
expect(result).to.deep.equal([1, 1.5, 2.25, 3.125, 4.063]); | ||
expect(result).toEqual([2.25, 3.25, 4.25]); | ||
}); | ||
it.skip('real world', () => { | ||
it('real world', () => { | ||
const data = [22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29, | ||
22.15, 22.39, 22.38, 22.61, 23.36, 24.05, 23.75, 23.83, 23.95, 23.63, 23.82, | ||
23.87, 23.65, 23.19, 23.10, 23.33, 22.68, 23.10, 22.40, 22.17]; | ||
const ema10days = [22.22, 22.21, 22.24, 22.27, 22.33, 22.52, 22.80, 22.97, 23.13, | ||
23.28, 23.34, 23.43, 23.51, 23.54, 23.47, 23.40, 23.39, 23.26, 23.23, 23.08, 22.92]; | ||
const result = exponentialMovingAverage(data, { periods: 10 }); | ||
const ema10days = [22.25, 22.22, 22.24, 22.28, 22.34, 22.52, 22.81, | ||
23.01, 23.13, 23.29, 23.33, 23.45, 23.53, 23.58, 23.61, | ||
23.61, 23.52, 23.38, 23.34, 23.13, 22.98]; | ||
const result = exponentialMovingAverageArray(data, { periods: 10 }); | ||
const roundedResult = result.map(x => Math.round(x * 100) / 100); | ||
expect(roundedResult).to.deep.equal(ema10days); | ||
expect(roundedResult).toEqual(ema10days); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import macd, { macdArray } from '../relativeStrengthIndex'; | ||
@@ -7,3 +6,3 @@ | ||
const result = macd([1], { periods: 1 }); | ||
expect(result).to.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
@@ -14,3 +13,3 @@ | ||
// const roundedResult = roundResult(result); | ||
expect(result).to.deep.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
@@ -21,3 +20,3 @@ | ||
const result = macd(data, { periods: 3 }); | ||
expect(result).to.deep.equal([1, 1.5, 2.25, 3.125, 4.063]); | ||
expect(result).toEqual([1, 1.5, 2.25, 3.125, 4.063]); | ||
}); | ||
@@ -33,4 +32,4 @@ | ||
const roundedResult = result.map(x => Math.round(x * 100) / 100); | ||
expect(roundedResult).to.deep.equal(ema10days); | ||
expect(roundedResult).toEqual(ema10days); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import { mean, stddev, sum, takeLast, weightingMultiplier } from '../math'; | ||
@@ -6,33 +5,33 @@ | ||
it('mean', () => { | ||
expect(mean([1, 2, 3])).to.equal(2); | ||
expect(mean([3, 2, 1])).to.equal(2); | ||
expect(mean([1, 2, 3])).toEqual(2); | ||
expect(mean([3, 2, 1])).toEqual(2); | ||
}); | ||
it('stddev', () => { | ||
expect(stddev([1])).to.equal(0); | ||
expect(stddev([1, 2, 3])).to.be.within(0.8164, 0.8165); | ||
expect(stddev([3, 2, 1])).to.be.within(0.8164, 0.8165); | ||
expect(stddev([1])).toEqual(0); | ||
expect(stddev([1, 2, 3])).toBeCloseTo(0.8165); | ||
expect(stddev([3, 2, 1])).toBeCloseTo(0.8165); | ||
const data20 = [91.80, 92.66, 92.68, 92.30, 92.77, 92.54, 92.95, 93.20, 91.07, | ||
89.83, 89.74, 90.40, 90.74, 88.02, 88.09, 88.84, 90.78, 90.54, 91.39, 90.65]; | ||
expect(stddev(data20)).to.be.within(1.54, 1.55); | ||
expect(stddev(data20)).toBeCloseTo(1.55); | ||
}); | ||
it('sum', () => { | ||
expect(sum([1, 2, 3])).to.equal(6); | ||
expect(sum([3, 2, 1])).to.equal(6); | ||
expect(sum([-10, 10, 0])).to.equal(0); | ||
expect(sum([1, 2, 3])).toEqual(6); | ||
expect(sum([3, 2, 1])).toEqual(6); | ||
expect(sum([-10, 10, 0])).toEqual(0); | ||
}); | ||
it('takeLast', () => { | ||
expect(takeLast([1], 1)).to.deep.equal([1]); | ||
expect(takeLast([1, 2, 3], 2)).to.deep.equal([2, 3]); | ||
expect(takeLast([1, 2, 3], 5)).to.deep.equal([1, 2, 3]); | ||
expect(takeLast([{ close: 123 }], 1, 'close')).to.deep.equal([123]); | ||
expect(takeLast([1], 1)).toEqual([1]); | ||
expect(takeLast([1, 2, 3], 2)).toEqual([2, 3]); | ||
expect(takeLast([1, 2, 3], 5)).toEqual([1, 2, 3]); | ||
expect(takeLast([{ close: 123 }], 1, 'close')).toEqual([123]); | ||
}); | ||
it('weightingMultiplier', () => { | ||
expect(weightingMultiplier(10)).to.be.within(0.1818, 0.1819); | ||
expect(weightingMultiplier(20)).to.be.within(0.0952, 0.0953); | ||
expect(weightingMultiplier(10)).toBeCloseTo(0.1818); | ||
expect(weightingMultiplier(20)).toBeCloseTo(0.0952); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import relativeStrengthIndex, { relativeStrengthIndexArray } from '../relativeStrengthIndex'; | ||
@@ -7,3 +6,3 @@ | ||
const result = relativeStrengthIndex([1], { periods: 1 }); | ||
expect(result).to.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
@@ -14,3 +13,3 @@ | ||
// const roundedResult = roundResult(result); | ||
expect(result).to.deep.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
@@ -21,3 +20,3 @@ | ||
const result = relativeStrengthIndex(data, { periods: 3 }); | ||
expect(result).to.deep.equal([1, 1.5, 2.25, 3.125, 4.063]); | ||
expect(result).toEqual([1, 1.5, 2.25, 3.125, 4.063]); | ||
}); | ||
@@ -33,4 +32,4 @@ | ||
const roundedResult = result.map(x => Math.round(x * 100) / 100); | ||
expect(roundedResult).to.deep.equal(ema10days); | ||
expect(roundedResult).toEqual(ema10days); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import simpleMovingAverage, { simpleMovingAverageArray } from '../simpleMovingAverage'; | ||
@@ -7,3 +6,3 @@ | ||
const result = simpleMovingAverage([1], { periods: 1 }); | ||
expect(result).to.equal(1); | ||
expect(result).toEqual(1); | ||
}); | ||
@@ -13,3 +12,3 @@ | ||
const result = simpleMovingAverage([1, 2, 3], { periods: 3 }); | ||
expect(result).to.equal(2); | ||
expect(result).toEqual(2); | ||
}); | ||
@@ -20,3 +19,3 @@ | ||
const result = simpleMovingAverage(data, { periods: 5 }); | ||
expect(result).to.be.within(28.64, 28.65); | ||
expect(result).toBeCloseTo(28.65); | ||
}); | ||
@@ -27,3 +26,3 @@ | ||
simpleMovingAverage([1, 2, 3], { periods: 5 }) | ||
).to.throw(); | ||
).toThrow(); | ||
}); | ||
@@ -33,3 +32,3 @@ | ||
const result = simpleMovingAverage([1, 2, 3, 4, 5], { periods: 3 }); | ||
expect(result).to.deep.equal(4); | ||
expect(result).toEqual(4); | ||
}); | ||
@@ -39,3 +38,3 @@ | ||
const result = simpleMovingAverage([11, 12, 13, 14, 15, 16, 17], { periods: 5 }); | ||
expect(result).to.deep.equal([13, 14, 15]); | ||
expect(result).toEqual([13, 14, 15]); | ||
}); | ||
@@ -50,3 +49,3 @@ | ||
const result = simpleMovingAverage(data, { periods: 3, field: 'close' }); | ||
expect(result).to.equal(2); | ||
expect(result).toEqual(2); | ||
}); | ||
@@ -57,3 +56,3 @@ | ||
const result = simpleMovingAverageArray(data, { periods: 3 }); | ||
expect(result).to.deep.equal([37, 370, 3700]); | ||
expect(result).toEqual([37, 370, 3700]); | ||
}); | ||
@@ -66,7 +65,7 @@ | ||
const sma10days = [22.22, 22.21, 22.23, 22.26, 22.30, 22.42, 22.61, 22.77, 22.91, | ||
23.08, 23.21, 23.38, 23.53, 23.65, 23.71, 23.68, 23.61, 23.51, 23.43, 23.28, 23.13]; | ||
23.08, 23.21, 23.38, 23.52, 23.65, 23.71, 23.68, 23.61, 23.51, 23.43, 23.28, 23.13]; | ||
const result = simpleMovingAverageArray(data, { periods: 10 }); | ||
const roundedResult = result.map(x => Math.round(x * 100) / 100); | ||
expect(roundedResult).to.deep.equal(sma10days); | ||
expect(roundedResult).toEqual(sma10days); | ||
}); | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { expect } from 'chai'; | ||
import linearTrendline, { linear } from '../linearTrendline'; | ||
@@ -7,3 +6,3 @@ | ||
const result = linearTrendline([[1, 3], [2, 5], [3, 6.5]]); | ||
expect(result).to.deep.equal([[0, 0], [0, 0]]); | ||
expect(result).toEqual([[0, 0], [0, 0]]); | ||
}); | ||
@@ -13,3 +12,3 @@ | ||
const result = linear([], []); | ||
expect(result).to.deep.equal([[0, 0], [0, 0]]); | ||
expect(result).toEqual([[0, 0], [0, 0]]); | ||
}); | ||
@@ -19,3 +18,3 @@ | ||
const result = linear([1], [1]); | ||
expect(result).to.deep.equal([[1, 1], [1, NaN]]); | ||
expect(result).toEqual([[1, 1], [1, NaN]]); | ||
}); | ||
@@ -25,3 +24,3 @@ | ||
const result = linear([1, 2, 3], [1, 2, 3]); | ||
expect(result).to.deep.equal([[1, 1], [3, 3]]); | ||
expect(result).toEqual([[1, 1], [3, 3]]); | ||
}); | ||
@@ -31,3 +30,3 @@ | ||
const result = linear([3, 5, 6.5], [1, 2, 3]); | ||
expect(result).to.deep.equal([[3, 1], [6.5, 2.9459459459459456]]); | ||
expect(result).toEqual([[3, 1], [6.5, 2.9459459459459456]]); | ||
}); | ||
@@ -37,4 +36,4 @@ | ||
const result = linear([5, 1, 3], [1, 2, 3]); | ||
expect(result).to.deep.equal([[5, 1], [3, 2]]); | ||
expect(result).toEqual([[5, 1], [3, 2]]); | ||
}); | ||
}); |
@@ -14,2 +14,3 @@ import { sequence } from 'binary-utils'; | ||
stdDevDown: number, | ||
pipSize: number, | ||
}; | ||
@@ -20,3 +21,3 @@ | ||
const bollingerBands = (data: Candle[], config: BollingerBandConfig): BollingerBandEntry => { | ||
const { periods = 20, field, stdDevUp = 2, stdDevDown = 2 } = config; | ||
const { periods = 20, field, stdDevUp = 2, stdDevDown = 2, pipSize = 2 } = config; | ||
const vals = takeLast(data, periods, field); | ||
@@ -28,3 +29,7 @@ const middle = simpleMovingAverage(vals, { periods }); | ||
return [middle, upper, lower]; | ||
return [ | ||
+(middle.toFixed(pipSize)), | ||
+(upper.toFixed(pipSize)), | ||
+(lower.toFixed(pipSize)), | ||
]; | ||
}; | ||
@@ -31,0 +36,0 @@ |
@@ -1,23 +0,42 @@ | ||
import { weightingMultiplier } from './math'; | ||
import simpleMovingAverage from './simpleMovingAverage'; | ||
import { sequence } from 'binary-utils'; | ||
import { takeLast, weightingMultiplier } from './math'; | ||
type CandleKeys = 'open' | 'high' | 'low' | 'close'; | ||
type CandleField = 'open' | 'high' | 'low' | 'close'; | ||
type ExponentialMovingAverageConfig = { | ||
periods: number, | ||
field?: CandleKeys, | ||
field?: CandleField, | ||
pipSize?: number, | ||
}; | ||
const EMA = (previousDay: number): number => 1; | ||
const ema = (vals: [], periods: number) => { | ||
if (vals.length === 1) { | ||
return vals[0]; | ||
} | ||
export default (data: Candle[], config: ExponentialMovingAverageConfig) => { | ||
const { periods } = config; | ||
const sma = simpleMovingAverage(data, config); | ||
const prev = ema(vals.slice(0, vals.length - 1), periods); | ||
const multiplier = weightingMultiplier(periods); | ||
return (vals.slice(-1)[0] - prev) * weightingMultiplier(periods) + prev; | ||
}; | ||
// const prevEMA = EMA(previousDay); | ||
// const ema = close - prevEMA * multiplier + prevEMA; | ||
const exponentialMovingAverage = (data: Candle[], config: ExponentialMovingAverageConfig): number => { | ||
const { periods, field } = config; | ||
return 0; | ||
if (data.length < periods) { | ||
throw new Error('Periods longer than data length'); | ||
} | ||
const vals = takeLast(data, periods, field); | ||
return ema(vals, periods); | ||
}; | ||
export const exponentialMovingAverageArray = (data: Candle[], config: ExponentialMovingAverageConfig): number[] => { | ||
const { periods, pipSize = 2 } = config; | ||
return sequence(data.length - periods + 1) | ||
.map((x, i) => | ||
+(exponentialMovingAverage(data.slice(i, i + periods), config).toFixed(pipSize)) | ||
); | ||
}; | ||
export default exponentialMovingAverage; |
@@ -0,0 +0,0 @@ const sum = (arr: number[], valFunc) => |
@@ -0,0 +0,0 @@ type MomentumConfig = { |
@@ -0,0 +0,0 @@ export const takeLast = (arr: any[], n: number, field?: string): any[] => |
@@ -0,0 +0,0 @@ type RelativeStrengthIndexConfig = { |
@@ -9,2 +9,3 @@ import { sequence } from 'binary-utils'; | ||
field?: CandleField, | ||
pipSize?: number, | ||
}; | ||
@@ -25,6 +26,6 @@ | ||
export const simpleMovingAverageArray = (data: Candle[], config: SimpleMovingAverageConfig): number[] => { | ||
const { periods } = config; | ||
const { periods, pipSize = 2 } = config; | ||
return sequence(data.length - periods + 1) | ||
.map((x, i) => | ||
simpleMovingAverage(data.slice(i, i + periods), config) | ||
+(simpleMovingAverage(data.slice(i, i + periods), config).toFixed(pipSize)) | ||
); | ||
@@ -31,0 +32,0 @@ }; |
@@ -15,9 +15,7 @@ module.exports = wallaby => ({ | ||
}, | ||
testFramework: 'mocha', | ||
testFramework: 'jest', | ||
compilers: { | ||
'**/*.js': wallaby.compilers.babel({ | ||
presets: [ | ||
'es2015', | ||
'es2016', | ||
'es2017', | ||
'latest', | ||
], | ||
@@ -24,0 +22,0 @@ }), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
180192
15
32
684
0
Updatedbinary-utils@^4.19.1