cotcube-indicators 0.1.10 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/VERSION +1 -1
- data/lib/cotcube-indicators/calc.rb +2 -2
- data/lib/cotcube-indicators/ema.rb +5 -4
- data/lib/cotcube-indicators/index.rb +1 -1
- data/lib/cotcube-indicators/rsi.rb +0 -2
- data/lib/cotcube-indicators/score.rb +1 -1
- data/lib/cotcube-indicators/sma.rb +0 -1
- data/lib/cotcube-indicators/threshold.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ec4481000ff50b9942da8148f1660af15473bf29a5f88dc8b3876f14cfaf1f1
|
4
|
+
data.tar.gz: d0e2ae25f2fb53c7c041800e9b8386f28d8461725501f80f279f1590df5126b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11df83e20a57e00447cdc2d58bce8a6bcaee8c3b8de70bc2c226a2bba754141c3332036518953b243d1293f473eb7d2a95d34c1adb7cd4238b4daa02fb97203b
|
7
|
+
data.tar.gz: e40de6cc45107c3eacc8de3ead08e48bb85f171f438db2635f029f39bcdf09121c71499d331798207afbb54c796140c0ed0f298058494735d9d7bd05315b6080
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.1.14 (July 31, 2021)
|
2
|
+
- calc: adding support for more param variables (a .. e)
|
3
|
+
|
4
|
+
## 0.1.13 (December 30, 2020)
|
5
|
+
- small fix to #score and #index to support missing values in series
|
6
|
+
|
7
|
+
## 0.1.12 (December 05, 2020)
|
8
|
+
- added tests for SMA, EMA, RSI
|
9
|
+
|
10
|
+
## 0.1.11 (December 05, 2020)
|
11
|
+
- Fixing 'smoothing' keyword argument in EMA
|
12
|
+
|
1
13
|
## 0.1.10 (December 03, 2020)
|
2
14
|
- added indicator 'threshold' including spec
|
3
15
|
- some minor improvements to .gitignore and .gemspec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.14
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Cotcube
|
4
4
|
module Indicators
|
5
|
-
def calc(a:, b:, &block) # rubocop:disable Naming/MethodParameterName
|
5
|
+
def calc(a:, b:, c:nil, d:nil, e:nil, &block) # rubocop:disable Naming/MethodParameterName
|
6
6
|
lambda do |x|
|
7
|
-
block.call(x[a.to_sym], x[b.to_sym]).to_f
|
7
|
+
block.call(x[a.to_sym], x[b.to_sym], x[c.to_sym], x[d.to_sym], x[e.to_sym]).to_f
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -3,12 +3,13 @@
|
|
3
3
|
module Cotcube
|
4
4
|
module Indicators
|
5
5
|
# the classic exponential moving average
|
6
|
-
def ema(key:, length:, smoothing:)
|
7
|
-
raise '
|
8
|
-
raise 'Missing parameter, need :key' if key.nil?
|
6
|
+
def ema(key:, length:, smoothing: nil)
|
7
|
+
raise ArgumentError, 'Improper :length parameter, should be positive Integer' unless length.is_a? Integer and length.positive?
|
9
8
|
|
10
9
|
smoothing ||= (2 / (length - 1).to_f.round(2))
|
11
|
-
|
10
|
+
raise ArgumentError, 'Improper smoothing, should be Numeric' unless smoothing.is_a? Numeric
|
11
|
+
|
12
|
+
carrier = Cotcube::Indicators::Carrier.new(length: length)
|
12
13
|
lambda do |x|
|
13
14
|
current = x[key.to_sym]
|
14
15
|
carrier << if carrier.empty?
|
@@ -7,7 +7,7 @@ module Cotcube
|
|
7
7
|
raise ArgumentError, "Need to set :upper: (set to Float::INFINITY to omit)" if upper.nil?
|
8
8
|
raise ArgumentError, "Need to set :lower unless :abs is set" if lower.nil? and not abs
|
9
9
|
raise ArgumentError, ":lower, upper must be numeric" if not upper.is_a?(Numeric) and ( abs ? true : lower.is_a?(Numeric) )
|
10
|
-
raise ArgumentError, "Found bogus, :lower #{lower} must be lower than :upper #{upper}" if not abs and lower
|
10
|
+
raise ArgumentError, "Found bogus, :lower #{lower} must be lower than :upper #{upper}" if not abs and lower > upper
|
11
11
|
# For this indicator, we just need to remembers -1, 0 or 1. That does not need a helper class.
|
12
12
|
carrier = 0
|
13
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cotcube-indicators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin L. Tischendorf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|