-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix On Balance Volume (OBV) calculation. (#428)
# Describe Request Fix On Balance Volume (OBV) calculation. Fixed #426 # Change Type Bug Fix
- Loading branch information
Showing
2 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2022 Onur Cinar. All Rights Reserved. | ||
// https://github.com/cinar/indicatorts | ||
|
||
import { roundDigitsAll } from '../../index'; | ||
import { onBalanceVolume } from './onBalanceVolume'; | ||
|
||
describe('On Balance Volume (OBV)', () => { | ||
it('should be able to compute OBV', () => { | ||
const closings = [9, 11, 7, 10, 8]; | ||
const volumes = [100, 110, 80, 120, 90]; | ||
const expected = [0, 110, 30, 150, 60]; | ||
|
||
const actual = onBalanceVolume(closings, volumes); | ||
expect(roundDigitsAll(2, actual)).toStrictEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters