Skip to content

Commit

Permalink
refactor(SMA): Re-use static getResultFromBatch method
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Oct 24, 2021
1 parent e387924 commit 89e08a6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/SMA/SMA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export class SMA extends MovingAverage {
}

if (this.prices.length === this.interval) {
const sum = this.prices.reduce((a: Big, b: BigSource) => a.plus(b), new Big('0'));
return this.setResult(sum.div(this.prices.length));
return this.setResult(SMA.getResultFromBatch(this.prices));
}
}

Expand Down

0 comments on commit 89e08a6

Please sign in to comment.