sqa 0.0.21 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,8 +13,6 @@ class SQA::Indicator; class << self
13
13
  true_ranges = true_range(high_prices, low_prices, close_prices)
14
14
  atr_values = []
15
15
 
16
- # debug_me{[ :period, :true_ranges ]}
17
-
18
16
  window_span = period - 1
19
17
 
20
18
  true_ranges.size.times do |inx|
@@ -25,14 +23,6 @@ class SQA::Indicator; class << self
25
23
 
26
24
  window = true_ranges[start_inx..end_inx]
27
25
 
28
- # debug_me{[
29
- # :inx,
30
- # :start_inx,
31
- # :end_inx,
32
- # :window,
33
- # "window.mean"
34
- # ]}
35
-
36
26
  atr_values << window.mean
37
27
  end
38
28
 
data/lib/sqa/init.rb CHANGED
@@ -23,7 +23,7 @@ module SQA
23
23
  # @@config = Config.new
24
24
 
25
25
  if defined? CLI
26
- CLI.run(argv)
26
+ CLI.run! # TODO: how to parse a fake argv? (argv)
27
27
  else
28
28
  # There are no real command line parameters
29
29
  # because the sqa gem is being required within
@@ -0,0 +1,20 @@
1
+ # lib/sqa/plugin_manager.rb
2
+
3
+ # This class gives plug-in commands a way
4
+ # to extend the SQA::Config class propertities.
5
+
6
+ module SQA
7
+ class PluginManager
8
+ @registered_properties = {}
9
+
10
+ class << self
11
+ attr_accessor :registered_properties
12
+
13
+ # name (Symbol)
14
+
15
+ def new_property(name, options = {})
16
+ @registered_properties[name.to_sym] = options
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/sqa/stock.rb CHANGED
@@ -16,6 +16,11 @@ class SQA::Stock
16
16
  attr_accessor :klass # class of historical and current prices
17
17
  attr_accessor :transformers # procs for changing column values from String to Numeric
18
18
 
19
+ # Holds the SQA::Strategy class name which seems to work
20
+ # the best for this stock.
21
+ attr_accessor :strategy # TODO: make part of the @data object
22
+
23
+
19
24
  def initialize(
20
25
  ticker:,
21
26
  source: :alpha_vantage
@@ -101,7 +106,7 @@ class SQA::Stock
101
106
  return if df2.nil? # CSV file is up to date.
102
107
 
103
108
  df_nrows = @df.nrows
104
- @df.append(df2)
109
+ @df.append!(df2)
105
110
 
106
111
  if @df.nrows > df_nrows
107
112
  @df.to_csv(@df_path)
@@ -146,6 +151,30 @@ class SQA::Stock
146
151
  end
147
152
 
148
153
 
154
+ def associate_best_strategy(strategies)
155
+ best_strategy = nil
156
+ best_accuracy = 0
157
+
158
+ strategies.each do |strategy|
159
+ accuracy = evaluate_strategy(strategy)
160
+
161
+ if accuracy > best_accuracy
162
+ best_strategy = strategy
163
+ best_accuracy = accuracy
164
+ end
165
+ end
166
+
167
+ self.strategy = best_strategy
168
+ end
169
+
170
+
171
+ def evaluate_strategy(strategy)
172
+ # TODO: Implement this method to evaluate the accuracy of the strategy
173
+ # on the historical data of this stock.
174
+ end
175
+
176
+
177
+
149
178
  #############################################
150
179
  ## Class Methods
151
180
 
@@ -24,8 +24,6 @@ class SQA::Strategy
24
24
  doc_filename = self.name.split('::').last.downcase + ".md"
25
25
  doc_path = Pathname.new(__dir__) + doc_filename
26
26
 
27
- debug_me{[ :doc_path ]}
28
-
29
27
  if doc_path.exist?
30
28
  doc = doc_path.read
31
29
  else
data/lib/sqa/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SQA
4
- VERSION = "0.0.21"
4
+ VERSION = "0.0.24"
5
5
 
6
6
  class << self
7
7
  def version
data/lib/sqa.rb CHANGED
@@ -13,12 +13,27 @@ unless defined?(HOME)
13
13
  HOME = Pathname.new(ENV['HOME'])
14
14
  end
15
15
 
16
+ # TODO: do we want to move the debug_me gem out of the
17
+ # development dependencies into the required?
18
+ #
19
+ if defined?(DebugMe)
20
+ unless respond_to?(:debug_me)
21
+ include DebugMe
22
+ end
23
+ else
24
+ require 'debug_me'
25
+ include DebugMe
26
+ end
27
+
28
+ $DEBUG_ME = true
29
+
16
30
  #############################################
17
31
  ## Additional Libraries
18
32
 
19
33
  require 'alphavantage'
20
34
  require 'api_key_manager'
21
35
  require 'amazing_print'
36
+ require 'dry/cli'
22
37
  require 'faraday'
23
38
  require 'hashie'
24
39
  require 'lite/statistics'
@@ -26,18 +41,23 @@ require 'lite/statistics/monkey_patches' # patch to Enumerable
26
41
  require 'nenv'
27
42
  require 'sem_version'
28
43
  require 'sem_version/core_ext'
29
- require 'tty-option'
30
44
  require 'tty-table'
31
45
 
32
46
 
33
47
  #############################################
34
48
  ## Apply core class monkey patches
35
49
 
50
+ # Using these monkey patches to remove need for
51
+ # ActiveSupport
36
52
  require_relative "patches/string.rb"
37
53
 
54
+ # Adds the global_header, global_footer, header, and footer
55
+ # class methods to enhance the HELP/Usage functionality
56
+ require_relative "patches/dry-cli.rb"
57
+
38
58
 
39
59
  #############################################
40
- ## SQA soecufuc code
60
+ ## SQA specific code
41
61
 
42
62
  require_relative "sqa/version"
43
63
  require_relative "sqa/errors"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.24
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-10-24 00:00:00.000000000 Z
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alphavantage
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-cli
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: faraday
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: tty-option
126
+ name: tty-table
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -123,13 +137,13 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: tty-table
140
+ name: amazing_print
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
- type: :runtime
146
+ type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
@@ -137,7 +151,7 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: amazing_print
154
+ name: bundler
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - ">="
@@ -151,7 +165,7 @@ dependencies:
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: bundler
168
+ name: debug_me
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ">="
@@ -165,7 +179,7 @@ dependencies:
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: debug_me
182
+ name: minitest
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
@@ -179,7 +193,7 @@ dependencies:
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
- name: minitest
196
+ name: rake
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - ">="
@@ -193,7 +207,7 @@ dependencies:
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
- name: tocer
210
+ name: simplecov
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - ">="
@@ -207,7 +221,7 @@ dependencies:
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
- name: rake
224
+ name: tocer
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - ">="
@@ -248,6 +262,9 @@ files:
248
262
  - checksums/sqa-0.0.2.gem.sha512
249
263
  - checksums/sqa-0.0.20.gem.sha512
250
264
  - checksums/sqa-0.0.21.gem.sha512
265
+ - checksums/sqa-0.0.22.gem.sha512
266
+ - checksums/sqa-0.0.23.gem.sha512
267
+ - checksums/sqa-0.0.24.gem.sha512
251
268
  - checksums/sqa-0.0.3.gem.sha512
252
269
  - checksums/sqa-0.0.4.gem.sha512
253
270
  - checksums/sqa-0.0.5.gem.sha512
@@ -281,13 +298,18 @@ files:
281
298
  - docs/simple_moving_average.md
282
299
  - docs/stochastic_oscillator.md
283
300
  - docs/strategy.md
301
+ - docs/ta_lib.md
284
302
  - docs/terms_of_use.md
285
303
  - docs/true_range.md
304
+ - lib/patches/dry-cli.rb
286
305
  - lib/patches/string.rb
287
306
  - lib/sqa.rb
288
307
  - lib/sqa/activity.rb
289
- - lib/sqa/analysis.rb
290
308
  - lib/sqa/cli.rb
309
+ - lib/sqa/commands.rb
310
+ - lib/sqa/commands/analysis.rb
311
+ - lib/sqa/commands/base.rb
312
+ - lib/sqa/commands/web.rb
291
313
  - lib/sqa/config.rb
292
314
  - lib/sqa/constants.rb
293
315
  - lib/sqa/data_frame.rb
@@ -317,6 +339,7 @@ files:
317
339
  - lib/sqa/indicator/stochastic_oscillator.rb
318
340
  - lib/sqa/indicator/true_range.rb
319
341
  - lib/sqa/init.rb
342
+ - lib/sqa/plugin_manager.rb
320
343
  - lib/sqa/portfolio.rb
321
344
  - lib/sqa/stock.rb
322
345
  - lib/sqa/strategy.rb
@@ -333,7 +356,6 @@ files:
333
356
  - lib/sqa/ticker.rb
334
357
  - lib/sqa/trade.rb
335
358
  - lib/sqa/version.rb
336
- - lib/sqa/web.rb
337
359
  homepage: https://github.com/MadBomber/sqa
338
360
  licenses:
339
361
  - MIT