sqa 0.0.15 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +170 -32
- data/checksums/sqa-0.0.17.gem.sha512 +1 -0
- data/checksums/sqa-0.0.18.gem.sha512 +1 -0
- data/lib/sqa/data_frame/alpha_vantage.rb +24 -69
- data/lib/sqa/data_frame/yahoo_finance.rb +4 -46
- data/lib/sqa/data_frame.rb +282 -32
- data/lib/sqa/errors.rb +27 -3
- data/lib/sqa/init.rb +9 -4
- data/lib/sqa/stock.rb +96 -36
- data/lib/sqa/strategy.rb +1 -1
- data/lib/sqa/version.rb +1 -1
- data/lib/sqa.rb +4 -4
- metadata +23 -29
- data/checksums/sqa-0.0.14.gem.sha512 +0 -1
- data/lib/patches/daru/category.rb +0 -19
- data/lib/patches/daru/data_frame.rb +0 -19
- data/lib/patches/daru/plotting/svg-graph/category.rb +0 -55
- data/lib/patches/daru/plotting/svg-graph/dataframe.rb +0 -105
- data/lib/patches/daru/plotting/svg-graph/vector.rb +0 -102
- data/lib/patches/daru/plotting/svg-graph.rb +0 -6
- data/lib/patches/daru/vector.rb +0 -19
- data/lib/patches/daru.rb +0 -19
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dewayne VanHoozer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.0.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: alphavantage
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: api_key_manager
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,33 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: hashie
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 4.1.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 4.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: lite-statistics
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: nenv
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,8 +240,9 @@ files:
|
|
240
240
|
- checksums/sqa-0.0.11.gem.sha512
|
241
241
|
- checksums/sqa-0.0.12.gem.sha512
|
242
242
|
- checksums/sqa-0.0.13.gem.sha512
|
243
|
-
- checksums/sqa-0.0.14.gem.sha512
|
244
243
|
- checksums/sqa-0.0.15.gem.sha512
|
244
|
+
- checksums/sqa-0.0.17.gem.sha512
|
245
|
+
- checksums/sqa-0.0.18.gem.sha512
|
245
246
|
- checksums/sqa-0.0.2.gem.sha512
|
246
247
|
- checksums/sqa-0.0.3.gem.sha512
|
247
248
|
- checksums/sqa-0.0.4.gem.sha512
|
@@ -276,14 +277,6 @@ files:
|
|
276
277
|
- docs/stochastic_oscillator.md
|
277
278
|
- docs/strategy.md
|
278
279
|
- docs/true_range.md
|
279
|
-
- lib/patches/daru.rb
|
280
|
-
- lib/patches/daru/category.rb
|
281
|
-
- lib/patches/daru/data_frame.rb
|
282
|
-
- lib/patches/daru/plotting/svg-graph.rb
|
283
|
-
- lib/patches/daru/plotting/svg-graph/category.rb
|
284
|
-
- lib/patches/daru/plotting/svg-graph/dataframe.rb
|
285
|
-
- lib/patches/daru/plotting/svg-graph/vector.rb
|
286
|
-
- lib/patches/daru/vector.rb
|
287
280
|
- lib/sqa.rb
|
288
281
|
- lib/sqa/activity.rb
|
289
282
|
- lib/sqa/analysis.rb
|
@@ -340,7 +333,8 @@ licenses:
|
|
340
333
|
metadata:
|
341
334
|
allowed_push_host: https://rubygems.org
|
342
335
|
homepage_uri: https://github.com/MadBomber/sqa
|
343
|
-
source_code_uri: https://github.com/MadBomber/
|
336
|
+
source_code_uri: https://github.com/MadBomber/sqa
|
337
|
+
changelog_uri: https://github.com/MadBomber/sqa
|
344
338
|
post_install_message:
|
345
339
|
rdoc_options: []
|
346
340
|
require_paths:
|
@@ -356,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
350
|
- !ruby/object:Gem::Version
|
357
351
|
version: '0'
|
358
352
|
requirements: []
|
359
|
-
rubygems_version: 3.4.
|
353
|
+
rubygems_version: 3.4.21
|
360
354
|
signing_key:
|
361
355
|
specification_version: 4
|
362
356
|
summary: sqa - Stock Qualitative Analysis
|
@@ -1 +0,0 @@
|
|
1
|
-
ae291d1c8a3a80fc6f24a6a1194c6db1b6e1fbdbee586546ae34db6ee304a3e431ea59a154ea976af0f25f3b0d6519f2e0a1aad4ddf3c3cdf77b7d37aabf425f
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# lib/patches/daru/category.rb
|
2
|
-
|
3
|
-
module Daru
|
4
|
-
module Category
|
5
|
-
|
6
|
-
def plotting_lig lib
|
7
|
-
if :svg_graph = lib
|
8
|
-
@plotting_library = lib
|
9
|
-
if Daru.send("has_#{lib}?".to_sym)
|
10
|
-
extend Module.const_get(
|
11
|
-
"Daru::Plotting::Category::#{lib.to_s.capitalize}Library"
|
12
|
-
)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# lib/patches/daru/data_frame.rb
|
2
|
-
|
3
|
-
module Daru
|
4
|
-
module DataFrame
|
5
|
-
|
6
|
-
def plotting_lig lib
|
7
|
-
if :svg_graph = lib
|
8
|
-
@plotting_library = lib
|
9
|
-
if Daru.send("has_#{lib}?".to_sym)
|
10
|
-
extend Module.const_get(
|
11
|
-
"Daru::Plotting::DataFrame::#{lib.to_s.capitalize}Library"
|
12
|
-
)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# lib/patches/daru/plotting/svg-graph/category.rb
|
2
|
-
|
3
|
-
# NOTE: Code originally from Gruff
|
4
|
-
# TODO: Tailor the code to SvgGraph
|
5
|
-
|
6
|
-
module Daru
|
7
|
-
module Plotting
|
8
|
-
module Category
|
9
|
-
module SvgGraphLibrary
|
10
|
-
def plot opts={}
|
11
|
-
type = opts[:type] || :bar
|
12
|
-
size = opts[:size] || 500
|
13
|
-
case type
|
14
|
-
when :bar, :pie, :sidebar
|
15
|
-
plot = send("category_#{type}_plot".to_sym, size, opts[:method])
|
16
|
-
else
|
17
|
-
raise ArgumentError, 'This type of plot is not supported.'
|
18
|
-
end
|
19
|
-
yield plot if block_given?
|
20
|
-
plot
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def category_bar_plot size, method
|
26
|
-
plot = SvgGraph::Bar.new size
|
27
|
-
method ||= :count
|
28
|
-
dv = frequencies(method)
|
29
|
-
plot.labels = size.times.to_a.zip(dv.index.to_a).to_h
|
30
|
-
plot.data name || :vector, dv.to_a
|
31
|
-
plot
|
32
|
-
end
|
33
|
-
|
34
|
-
def category_pie_plot size, method
|
35
|
-
plot = SvgGraph::Pie.new size
|
36
|
-
method ||= :count
|
37
|
-
frequencies(method).each_with_index do |data, index|
|
38
|
-
plot.data index, data
|
39
|
-
end
|
40
|
-
plot
|
41
|
-
end
|
42
|
-
|
43
|
-
def category_sidebar_plot size, method
|
44
|
-
plot = SvgGraph::SideBar.new size
|
45
|
-
plot.labels = {0 => (name.to_s || 'vector')}
|
46
|
-
method ||= :count
|
47
|
-
frequencies(method).each_with_index do |data, index|
|
48
|
-
plot.data index, data
|
49
|
-
end
|
50
|
-
plot
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
# lib/patches/daru/plotting/svg-graph/dataframe.rb
|
2
|
-
|
3
|
-
# NOTE: Code originally from Gruff
|
4
|
-
# TODO: Tailor the code to SvgGraph
|
5
|
-
|
6
|
-
module Daru
|
7
|
-
module Plotting
|
8
|
-
module DataFrame
|
9
|
-
module SvgGraphLibrary
|
10
|
-
def plot opts={}
|
11
|
-
opts[:type] ||= :line
|
12
|
-
opts[:size] ||= 500
|
13
|
-
|
14
|
-
x = extract_x_vector opts[:x]
|
15
|
-
y = extract_y_vectors opts[:y]
|
16
|
-
|
17
|
-
opts[:type] = process_type opts[:type], opts[:categorized]
|
18
|
-
|
19
|
-
type = opts[:type]
|
20
|
-
|
21
|
-
if %o[line bar scatter].include? type
|
22
|
-
graph = send("#{type}_plot", size, x, y)
|
23
|
-
|
24
|
-
elsif :scatter_categorized == type
|
25
|
-
graph = scatter_with_category(size, x, y, opts[:categorized])
|
26
|
-
|
27
|
-
else
|
28
|
-
raise ArgumentError, 'This type of plot is not supported.'
|
29
|
-
end
|
30
|
-
|
31
|
-
yield graph if block_given?
|
32
|
-
graph
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def process_type type, categorized
|
38
|
-
type == :scatter && categorized ? :scatter_categorized : type
|
39
|
-
end
|
40
|
-
|
41
|
-
##########################################################
|
42
|
-
def line_plot size, x, y
|
43
|
-
plot = SvgGraph::Line.new size
|
44
|
-
plot.labels = size.times.to_a.zip(x).to_h
|
45
|
-
y.each do |vec|
|
46
|
-
plot.data vec.name || :vector, vec.to_a
|
47
|
-
end
|
48
|
-
plot
|
49
|
-
end
|
50
|
-
|
51
|
-
##########################################################
|
52
|
-
def bar_plot size, x, y
|
53
|
-
plot = SvgGraph::Bar.new size
|
54
|
-
plot.labels = size.times.to_a.zip(x).to_h
|
55
|
-
y.each do |vec|
|
56
|
-
plot.data vec.name || :vector, vec.to_a
|
57
|
-
end
|
58
|
-
plot
|
59
|
-
end
|
60
|
-
|
61
|
-
##########################################################
|
62
|
-
def scatter_plot size, x, y
|
63
|
-
plot = SvgGraph::Scatter.new size
|
64
|
-
y.each do |vec|
|
65
|
-
plot.data vec.name || :vector, x, vec.to_a
|
66
|
-
end
|
67
|
-
plot
|
68
|
-
end
|
69
|
-
|
70
|
-
##########################################################
|
71
|
-
def scatter_with_category size, x, y, opts
|
72
|
-
x = Daru::Vector.new x
|
73
|
-
y = y.first
|
74
|
-
plot = SvgGraph::Scatter.new size
|
75
|
-
cat_dv = self[opts[:by]]
|
76
|
-
|
77
|
-
cat_dv.categories.each do |cat|
|
78
|
-
bools = cat_dv.eq cat
|
79
|
-
plot.data cat, x.where(bools).to_a, y.where(bools).to_a
|
80
|
-
end
|
81
|
-
|
82
|
-
plot
|
83
|
-
end
|
84
|
-
|
85
|
-
def extract_x_vector x_name
|
86
|
-
x_name && self[x_name].to_a || index.to_a
|
87
|
-
end
|
88
|
-
|
89
|
-
def extract_y_vectors y_names
|
90
|
-
y_names =
|
91
|
-
case y_names
|
92
|
-
when nil
|
93
|
-
vectors.to_a
|
94
|
-
when Array
|
95
|
-
y_names
|
96
|
-
else
|
97
|
-
[y_names]
|
98
|
-
end
|
99
|
-
|
100
|
-
y_names.map { |y| self[y] }.select(&:numeric?)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# lib/patches/daru/plotting/svg-graph/vector.rb
|
2
|
-
|
3
|
-
# NOTE: Code originally from Gruff
|
4
|
-
# TODO: Tailor the code to SvgGraph
|
5
|
-
|
6
|
-
module Daru
|
7
|
-
module Plotting
|
8
|
-
module Vector
|
9
|
-
module SvgGraphLibrary
|
10
|
-
def plot opts={}
|
11
|
-
opts[:type] ||= :line
|
12
|
-
opts[:size] ||= 500 # SMELL: What is this?
|
13
|
-
opts[:height] ||= 720
|
14
|
-
opts[:width] ||= 720
|
15
|
-
opts[:title] ||= name || :vector
|
16
|
-
|
17
|
-
debug_me{[
|
18
|
-
:opts,
|
19
|
-
:self
|
20
|
-
]}
|
21
|
-
|
22
|
-
if %i[line bar pie scatter sidebar].include? type
|
23
|
-
graph = send("#{type}_plot", opts)
|
24
|
-
else
|
25
|
-
raise ArgumentError, 'This type of plot is not supported.'
|
26
|
-
end
|
27
|
-
|
28
|
-
yield graph if block_given?
|
29
|
-
|
30
|
-
graph
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
####################################################
|
36
|
-
def line_plot opts={}
|
37
|
-
graph = SVG::Graph::Line.new opts
|
38
|
-
|
39
|
-
graph.add_data(
|
40
|
-
data: to_a,
|
41
|
-
title: opts[:title]
|
42
|
-
)
|
43
|
-
|
44
|
-
graph
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
####################################################
|
49
|
-
def bar_plot opts
|
50
|
-
graph = SVG::Graph::Bar.new opts
|
51
|
-
|
52
|
-
graph.add_data(
|
53
|
-
data: to_a,
|
54
|
-
title: opts[:title]
|
55
|
-
)
|
56
|
-
|
57
|
-
graph
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
####################################################
|
62
|
-
def pie_plot opts
|
63
|
-
graph = SVG::Graph::Pie.new opts
|
64
|
-
|
65
|
-
graph.add_data(
|
66
|
-
data: to_a,
|
67
|
-
title: opts[:title]
|
68
|
-
)
|
69
|
-
|
70
|
-
graph
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
####################################################
|
75
|
-
def scatter_plot size
|
76
|
-
graph = SVG::Graph::Plot.new opts
|
77
|
-
|
78
|
-
|
79
|
-
graph.add_data(
|
80
|
-
data: to_a.zip(index.to_a)
|
81
|
-
title: opts[:title]
|
82
|
-
)
|
83
|
-
|
84
|
-
graph
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
####################################################
|
89
|
-
def sidebar_plot size
|
90
|
-
graph = SVG::Graph::BarHorizontal.new opts
|
91
|
-
|
92
|
-
graph.add_data(
|
93
|
-
data: to_a,
|
94
|
-
title: opts[:title]
|
95
|
-
)
|
96
|
-
|
97
|
-
graph
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
data/lib/patches/daru/vector.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# lib/patches/daru/vector.rb
|
2
|
-
|
3
|
-
module Daru
|
4
|
-
module Vector
|
5
|
-
|
6
|
-
def plotting_lig lib
|
7
|
-
if :svg_graph = lib
|
8
|
-
@plotting_library = lib
|
9
|
-
if Daru.send("has_#{lib}?".to_sym)
|
10
|
-
extend Module.const_get(
|
11
|
-
"Daru::Plotting::Vector::#{lib.to_s.capitalize}Library"
|
12
|
-
)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/patches/daru.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# lib/patches/daru.rb
|
2
|
-
|
3
|
-
require_relative 'daru/category'
|
4
|
-
require_relative 'daru/data_frame'
|
5
|
-
require_relative 'daru/vector'
|
6
|
-
|
7
|
-
module Daru
|
8
|
-
create_has_library :svg_graph
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def plotting_library lib
|
12
|
-
if :svg_graph = lib
|
13
|
-
@plotting_library = lib
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|