diff --git a/Cargo.toml b/Cargo.toml index 88a657e..34756f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "traquer" -version = "0.6.1" +version = "0.7.0" edition = "2021" description = "technical analysis library" license = "Apache-2.0" diff --git a/src/volume.rs b/src/volume.rs index 33b4673..26a9cda 100644 --- a/src/volume.rs +++ b/src/volume.rs @@ -41,7 +41,7 @@ fn vforce<'a, T: ToPrimitive, U: ToPrimitive>( state.5 + dm }; *state = (h, l, c, trend, cm, dm); - Some(v * (1. - (dm / cm)) * trend * 200.0) + Some(v * ((dm / cm) - 1.0) * trend * 200.0) }, ) } @@ -88,7 +88,6 @@ fn vforce_alt<'a, T: ToPrimitive, U: ToPrimitive>( /// ## Sources /// /// [[1]](https://www.investopedia.com/terms/k/klingeroscillator.asp) -/// [[2]](https://www.daytrading.com/klinger-volume-oscillator) /// /// # Examples /// diff --git a/tests/volume_test.rs b/tests/volume_test.rs index c774175..ab17222 100644 --- a/tests/volume_test.rs +++ b/tests/volume_test.rs @@ -49,24 +49,24 @@ fn test_kvo() { assert_eq!(stats.close.len(), result.len()); assert_eq!( vec![ - 47653124.52312139, - 38871537.60795313, - 56551756.57617685, - 80719127.50187302, - 91381485.15827936, - 102487748.59386584, - 103133145.86686252, - 76544074.74621749, - 76362373.25709169, - 84632468.62962747, - 54766782.00020293, - 53496835.81130403, - 60063221.578486785, - 36156452.68826012, - 39470196.1311378, - 81568025.19964269, - 163166676.59742773, - 90486708.71792603 + -47653124.52312139, + -38871537.60795313, + -56551756.57617685, + -80719127.50187302, + -91381485.15827936, + -102487748.59386584, + -103133145.86686252, + -76544074.74621749, + -76362373.25709169, + -84632468.62962747, + -54766782.00020293, + -53496835.81130403, + -60063221.578486785, + -36156452.68826012, + -39470196.1311378, + -81568025.19964269, + -163166676.59742773, + -90486708.71792603 ], result[16..] );