cotcube-indicators 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ec4481000ff50b9942da8148f1660af15473bf29a5f88dc8b3876f14cfaf1f1
4
- data.tar.gz: d0e2ae25f2fb53c7c041800e9b8386f28d8461725501f80f279f1590df5126b1
3
+ metadata.gz: e549845d62cd14b399913c4881c8491f1392d9b94df1b3fec8405fd95059bf84
4
+ data.tar.gz: ed52269218da6e88138221e116b8c35e68abc385346cd8376efb230933c71dce
5
5
  SHA512:
6
- metadata.gz: 11df83e20a57e00447cdc2d58bce8a6bcaee8c3b8de70bc2c226a2bba754141c3332036518953b243d1293f473eb7d2a95d34c1adb7cd4238b4daa02fb97203b
7
- data.tar.gz: e40de6cc45107c3eacc8de3ead08e48bb85f171f438db2635f029f39bcdf09121c71499d331798207afbb54c796140c0ed0f298058494735d9d7bd05315b6080
6
+ metadata.gz: e9f7f917c7c6e490d9263456f2d2e2887f672a9b85609546bcd17d695840275a0f4de7f2a34e1632ae9d6be359388f843397bb458e707ec9b0c0af097a657efa
7
+ data.tar.gz: c9650895d30c9e1457b37b56242916a81a2eb70257fbcc16bf45144ec9f55030b10ec82f0f52cf13307c67a12b9b474b93fed262d82961d7fb984ca572b9a035
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.15 (November 15, 2021)
2
+ - fixing ema and sma by applying to_f to divisors
3
+
1
4
  ## 0.1.14 (July 31, 2021)
2
5
  - calc: adding support for more param variables (a .. e)
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.15
@@ -2,9 +2,17 @@
2
2
 
3
3
  module Cotcube
4
4
  module Indicators
5
- def calc(a:, b:, c:nil, d:nil, e:nil, &block) # rubocop:disable Naming/MethodParameterName
5
+ def calc(a:, b:, c:nil, d:nil, e:nil, f:nil, g:nil, h:nil, finalize: :to_f, &block) # rubocop:disable Naming/MethodParameterName
6
6
  lambda do |x|
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
7
+ block.call(
8
+ x[a.to_sym],
9
+ (b.nil? ? nil : x[b.to_sym]),
10
+ (c.nil? ? nil : x[c.to_sym]),
11
+ (d.nil? ? nil : x[d.to_sym]),
12
+ (e.nil? ? nil : x[e.to_sym]),
13
+ (f.nil? ? nil : x[f.to_sym]),
14
+ (g.nil? ? nil : x[g.to_sym]),
15
+ ).send(finalize.to_sym)
8
16
  end
9
17
  end
10
18
  end
@@ -13,9 +13,9 @@ module Cotcube
13
13
  lambda do |x|
14
14
  current = x[key.to_sym]
15
15
  carrier << if carrier.empty?
16
- current * (smoothing / (1 + length))
16
+ current * (smoothing / (1.0 + length))
17
17
  else
18
- current * (smoothing / (1 + length)) + carrier.get[-1] * (1 - (smoothing / (1 + length)))
18
+ current * (smoothing / (1.0 + length)) + carrier.get[-1] * (1.0 - (smoothing / (1.0 + length)))
19
19
  end
20
20
  carrier.size < length ? -1.0 : carrier.get.last
21
21
  end
@@ -8,7 +8,7 @@ module Cotcube
8
8
  lambda do |x|
9
9
  current = x[key.to_sym]
10
10
  carrier << current
11
- carrier.size < length ? 0.0 : (carrier.get.reduce(:+) / carrier.length).to_f
11
+ carrier.size < length ? 0.0 : (carrier.get.reduce(:+) / carrier.length.to_f).to_f
12
12
  end
13
13
  end
14
14
  end
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.14
4
+ version: 0.1.15
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: 2021-07-31 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.1.2
102
+ rubygems_version: 3.1.6
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Lambda based indicators, decoupled from legacy cotcube