cotcube-indicators 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/cotcube-indicators/ema.rb +4 -2
- data/lib/cotcube-indicators/rsi.rb +0 -2
- data/lib/cotcube-indicators/sma.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98fa4ef0045f9137be38cfca9279bf35c9e482e2342a59ed758a8b3815b40fa5
|
4
|
+
data.tar.gz: d5b4ae3d93be6c0ed918f0c0421cf001b61e0b455989bb4d7ec6e3912f62b4c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c9d35924768befeb84eec7c2c4f71e03e612cc43e3759787db21cf1ad51ce012e51cf583b3edbf4fb38e7e19a782f381f0c499831659b8a42c9ff0a37adcfc
|
7
|
+
data.tar.gz: 1db27198c66a931a5822d6d58991a252c79356e78c71c269432251cc001d41c75cf15ba797f3606eca51c6b30c98e0ecee9a127f7eeed49f7d9aa67870916bd4
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
@@ -4,10 +4,12 @@ module Cotcube
|
|
4
4
|
module Indicators
|
5
5
|
# the classic exponential moving average
|
6
6
|
def ema(key:, length:, smoothing: nil)
|
7
|
-
raise '
|
7
|
+
raise ArgumentError, 'Improper :length parameter, should be positive Integer' unless length.is_a? Integer and length.positive?
|
8
8
|
|
9
9
|
smoothing ||= (2 / (length - 1).to_f.round(2))
|
10
|
-
|
10
|
+
raise ArgumentError, 'Improper smoothing, should be Numeric' unless smoothing.is_a? Numeric
|
11
|
+
|
12
|
+
carrier = Cotcube::Indicators::Carrier.new(length: length)
|
11
13
|
lambda do |x|
|
12
14
|
current = x[key.to_sym]
|
13
15
|
carrier << if carrier.empty?
|