1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#![warn(missing_docs, missing_debug_implementations)]
mod sma;
pub use sma::*;
mod wma;
pub use wma::*;
mod ema;
pub use ema::*;
mod wsma;
pub use wsma::*;
mod rma;
pub use rma::*;
mod smm;
pub use smm::*;
mod hma;
pub use hma::*;
mod lin_reg;
pub use lin_reg::*;
mod swma;
pub use swma::*;
mod conv;
pub use conv::*;
mod vwma;
pub use vwma::*;
mod trima;
pub use trima::*;
mod derivative;
pub use derivative::*;
mod integral;
pub use integral::*;
mod momentum;
pub use momentum::*;
mod rate_of_change;
pub use rate_of_change::*;
mod tsi;
pub use tsi::*;
mod st_dev;
pub use st_dev::*;
mod volatility;
pub use volatility::*;
mod cci;
pub use cci::*;
mod mean_abs_dev;
pub use mean_abs_dev::*;
mod median_abs_dev;
pub use median_abs_dev::*;
mod vidya;
pub use vidya::*;
mod cross;
pub use cross::*;
mod reversal;
pub use reversal::*;
mod highest_lowest;
pub use highest_lowest::*;
mod adi;
mod highest_lowest_index;
pub use adi::*;
pub use highest_lowest_index::*;
mod past;
pub use past::*;
#[cfg(test)]
mod tests {
use crate::core::{Method, ValueType};
use crate::helpers::assert_eq_float;
use std::fmt::Debug;
pub(super) fn test_const<P, I: Copy, O: Copy + Debug + PartialEq>(
method: &mut dyn Method<Params = P, Input = I, Output = O>,
input: I,
output: O,
) {
for _ in 0..100 {
assert_eq!(method.next(input), output);
}
}
pub(super) fn test_const_float<P, I: Copy>(
method: &mut dyn Method<Params = P, Input = I, Output = ValueType>,
input: I,
output: ValueType,
) {
for _ in 0..100 {
assert_eq_float(output, method.next(input));
}
}
}