sqa 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/checksums/sqa-0.0.14.gem.sha512 +1 -1
- data/checksums/sqa-0.0.15.gem.sha512 +1 -0
- data/docs/alpha_vantage_technical_indicators.md +62 -0
- data/lib/patches/daru/plotting/svg-graph.rb +0 -1
- data/lib/sqa/cli.rb +0 -1
- data/lib/sqa/config.rb +7 -6
- data/lib/sqa/data_frame/alpha_vantage.rb +0 -2
- data/lib/sqa/data_frame/yahoo_finance.rb +0 -2
- data/lib/sqa/init.rb +46 -0
- data/lib/sqa/stock.rb +7 -10
- data/lib/sqa/version.rb +1 -4
- data/lib/sqa/web.rb +1 -1
- data/lib/sqa.rb +34 -54
- metadata +17 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fcc7dbda5b62549fa1fb9691bf7ef9af1a0ba5dfcff63494ce2cdf6ca7e578a
|
4
|
+
data.tar.gz: 9527508fa1573a09536ef4bf735671761d722d1611494d3aeb8615ba25385f2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ce2164cd95cf91c62e054dad4fef84ed105d7713207bf5f5e39fbad282785184217ed303fe73b24801b871e9ca0db371c0f514949803aace37b788ebec6140
|
7
|
+
data.tar.gz: f7336d71e365388d571267e87fbdd82a66dbd532da8e386e9670e1a9f7034d2279202e6df16ce30d14410b2ab39923ecf4bb78e0941b554bf11ee3101fdb9a41
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ae291d1c8a3a80fc6f24a6a1194c6db1b6e1fbdbee586546ae34db6ee304a3e431ea59a154ea976af0f25f3b0d6519f2e0a1aad4ddf3c3cdf77b7d37aabf425f
|
@@ -0,0 +1 @@
|
|
1
|
+
d4f3ab1bf26de034f0f044a5cab9d86e61221fc2d160056c1c24c166586e7ce72d90095ebea01965f5cabf989c4116e7409f8fc6749cabe7d5a13e34f87f4b96
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Alpha Vantage
|
2
|
+
## Technical Indicators
|
3
|
+
|
4
|
+
The following technical indicators are available from Alpha Vantage
|
5
|
+
using a free API key.
|
6
|
+
|
7
|
+
| Acronym | Indicator Description |
|
8
|
+
|-----------|----------------------------------------------------------|
|
9
|
+
| AD | Accumulation/Distribution |
|
10
|
+
| ADOSC | Accumulation/Distribution Oscillator |
|
11
|
+
| ADX | Average Directional Index |
|
12
|
+
| ADXR | Average Directional Movement Rating |
|
13
|
+
| APO | Absolute Price Oscillator |
|
14
|
+
| AROON | Aroon Indicator |
|
15
|
+
| AROONOSC | Aroon Oscillator |
|
16
|
+
| ATR | Average True Range |
|
17
|
+
| BBANDS | Bollinger Bands |
|
18
|
+
| BOP | Balance of Power |
|
19
|
+
| CCI | Commodity Channel Index |
|
20
|
+
| CMO | Chande Momentum Oscillator |
|
21
|
+
| DEMA | Double Exponential Moving Average |
|
22
|
+
| DX | Directional Movement Index |
|
23
|
+
| EMA | Exponential Moving Average |
|
24
|
+
| HT_DCPERIOD | Hilbert Transform - Dominant Cycle Period |
|
25
|
+
| HT_DCPHASE | Hilbert Transform - Dominant Cycle Phase |
|
26
|
+
| HT_PHASOR | Hilbert Transform - Phasor Components |
|
27
|
+
| HT_SINE | Hilbert Transform - SineWave |
|
28
|
+
| HT_TRENDLINE | Hilbert Transform - Instantaneous Trendline |
|
29
|
+
| HT_TRENDMODE | Hilbert Transform - Trend vs Cycle Mode |
|
30
|
+
| KAMA | Kaufman Adaptive Moving Average |
|
31
|
+
| MACD | Moving Average Convergence Divergence |
|
32
|
+
| MACDEXT | MACD with controllable MA type |
|
33
|
+
| MAMA | MESA Adaptive Moving Average |
|
34
|
+
| MFI | Money Flow Index |
|
35
|
+
| MIDPOINT | MidPoint over period |
|
36
|
+
| MIDPRICE | Midpoint Price over period |
|
37
|
+
| MINUS_DI | Minus Directional Indicator |
|
38
|
+
| MINUS_DM | Minus Directional Movement |
|
39
|
+
| MOM | Momentum |
|
40
|
+
| NATR | Normalized Average True Range |
|
41
|
+
| OBV | On Balance Volume |
|
42
|
+
| PLUS_DI | Plus Directional Indicator |
|
43
|
+
| PLUS_DM | Plus Directional Movement |
|
44
|
+
| PPO | Percentage Price Oscillator |
|
45
|
+
| ROC | Rate of Change |
|
46
|
+
| ROCR | Rate of Change Ratio |
|
47
|
+
| RSI | Relative Strength Index |
|
48
|
+
| SAR | Parabolic SAR |
|
49
|
+
| SMA | Simple Moving Average |
|
50
|
+
| STOCH | Stochastic Oscillator |
|
51
|
+
| STOCHF | Stochastic Fast |
|
52
|
+
| STOCHRSI | Stochastic Relative Strength Index |
|
53
|
+
| T3 | Triple Exponential Moving Average (T3) |
|
54
|
+
| TEMA | Triple Exponential Moving Average |
|
55
|
+
| TRANGE | True Range |
|
56
|
+
| TRIMA | Triangular Moving Average |
|
57
|
+
| TRIX | 1-day Rate of Change of a Triple Smooth EMA |
|
58
|
+
| ULTOSC | Ultimate Oscillator |
|
59
|
+
| VWAP | Volume Weighted Average Price |
|
60
|
+
| WILLR | Williams' %R |
|
61
|
+
| WMA | Weighted Moving Average |
|
62
|
+
|
data/lib/sqa/cli.rb
CHANGED
data/lib/sqa/config.rb
CHANGED
@@ -6,17 +6,18 @@
|
|
6
6
|
# config file ..... overrides envar
|
7
7
|
# command line parameters ...... overrides config file
|
8
8
|
|
9
|
-
require 'hashie'
|
10
|
-
require 'yaml'
|
11
|
-
require 'json'
|
12
|
-
require 'toml-rb'
|
13
|
-
|
14
9
|
|
15
10
|
module SQA
|
16
11
|
class Config < Hashie::Dash
|
17
12
|
include Hashie::Extensions::Dash::PropertyTranslation
|
18
13
|
include Hashie::Extensions::Coercion
|
19
|
-
|
14
|
+
|
15
|
+
# FIXME: Getting undefined error PredefinedValues
|
16
|
+
# I'm thinking that Ruby is dropping it from the ObjectSpace
|
17
|
+
# Looks like it is only used for the log level. Should
|
18
|
+
# able to work around that.
|
19
|
+
#
|
20
|
+
# include Hashie::Extensions::Dash::PredefinedValues
|
20
21
|
|
21
22
|
property :config_file #,a String filepath for the current config overriden by cli options
|
22
23
|
property :dump_config # a String filepath into which to dump the current config
|
data/lib/sqa/init.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# sqa/lib/sqa/init.rb
|
2
|
+
|
3
|
+
module SQA
|
4
|
+
class << self
|
5
|
+
@@config = nil
|
6
|
+
|
7
|
+
# Initializes the SQA modules
|
8
|
+
# returns the configuration
|
9
|
+
#
|
10
|
+
def init(argv=ARGV)
|
11
|
+
if argv.is_a? String
|
12
|
+
argv = argv.split()
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
# Ran at SQA::Config elaboration time
|
17
|
+
# @@config = Config.new
|
18
|
+
|
19
|
+
if defined? CLI
|
20
|
+
CLI.run(argv)
|
21
|
+
else
|
22
|
+
# There are no real command line parameters
|
23
|
+
# because the sqa gem is being required within
|
24
|
+
# the context of a larger program.
|
25
|
+
end
|
26
|
+
|
27
|
+
config.data_dir = homify(config.data_dir)
|
28
|
+
|
29
|
+
Daru.lazy_update = config.lazy_update
|
30
|
+
Daru.plotting_library = config.plotting_library
|
31
|
+
|
32
|
+
config
|
33
|
+
end
|
34
|
+
|
35
|
+
def debug?() = @@config.debug?
|
36
|
+
def verbose?() = @@config.verbose?
|
37
|
+
|
38
|
+
def homify(filepath) = filepath.gsub(/^~/, Nenv.home)
|
39
|
+
def data_dir() = Pathname.new(config.data_dir)
|
40
|
+
def config() = @@config
|
41
|
+
|
42
|
+
def config=(an_object)
|
43
|
+
@@config = an_object
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/sqa/stock.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# lib/sqa/stock.rb
|
2
2
|
|
3
|
-
require 'active_support/core_ext/string' # for String#underscore
|
4
|
-
require 'hashie' # for Hashie::Mash
|
5
|
-
|
6
3
|
|
7
4
|
# SMELL: SQA::Stock is now pretty coupled to the Alpha Vantage
|
8
5
|
# API service. Should that stuff be extracted into a
|
@@ -101,13 +98,13 @@ class SQA::Stock
|
|
101
98
|
def top
|
102
99
|
return @@top unless @@top.nil?
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
)
|
101
|
+
a_hash = JSON.parse(
|
102
|
+
CONNECTION.get(
|
103
|
+
"/query?function=TOP_GAINERS_LOSERS&apikey=#{Nenv.av_api_key}"
|
104
|
+
).to_hash[:body]
|
105
|
+
)
|
106
|
+
|
107
|
+
mash = Hashie::Mash.new(a_hash)
|
111
108
|
|
112
109
|
keys = mash.top_gainers.first.keys
|
113
110
|
|
data/lib/sqa/version.rb
CHANGED
data/lib/sqa/web.rb
CHANGED
data/lib/sqa.rb
CHANGED
@@ -1,77 +1,57 @@
|
|
1
1
|
# lib/sqa.rb
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
require 'active_support/core_ext/string'
|
6
|
-
require 'amazing_print'
|
7
|
-
require 'daru'
|
8
|
-
require 'date'
|
9
|
-
require 'descriptive_statistics'
|
10
|
-
require 'nenv'
|
11
|
-
require 'pathname'
|
4
|
+
# TODO: Create a new gem for the dumbstockapi website
|
12
5
|
|
13
|
-
|
14
|
-
|
6
|
+
#############################################
|
7
|
+
## Standard Libraries
|
15
8
|
|
9
|
+
require 'date'
|
10
|
+
require 'pathname'
|
16
11
|
|
17
12
|
unless defined?(HOME)
|
18
|
-
HOME = Pathname.new(
|
13
|
+
HOME = Pathname.new(ENV['HOME'])
|
19
14
|
end
|
20
15
|
|
16
|
+
#############################################
|
17
|
+
## Additional Libraries
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Ran at SQA::Config elaboration time
|
36
|
-
# @@config = Config.new
|
37
|
-
|
38
|
-
if defined? CLI
|
39
|
-
CLI.run(argv)
|
40
|
-
else
|
41
|
-
# There are no real command line parameters
|
42
|
-
# because the sqa gem is being required within
|
43
|
-
# the context of a larger program.
|
44
|
-
end
|
45
|
-
|
46
|
-
config.data_dir = homify(config.data_dir)
|
47
|
-
|
48
|
-
Daru.lazy_update = config.lazy_update
|
49
|
-
Daru.plotting_library = config.plotting_library
|
19
|
+
require 'active_support/core_ext/string'
|
20
|
+
require 'alphavantage' # TODO: add rate limiter to it
|
21
|
+
require 'amazing_print'
|
22
|
+
require 'daru' # TODO: Replace this gem with something better
|
23
|
+
require 'descriptive_statistics'
|
24
|
+
require 'faraday'
|
25
|
+
require 'hashie'
|
26
|
+
require 'nenv'
|
27
|
+
require 'sem_version'
|
28
|
+
require 'sem_version/core_ext'
|
29
|
+
require 'tty-option'
|
30
|
+
require 'tty-table'
|
50
31
|
|
51
|
-
config
|
52
|
-
end
|
53
32
|
|
54
|
-
|
55
|
-
|
33
|
+
#############################################
|
34
|
+
## SQA soecufuc code
|
56
35
|
|
57
|
-
|
58
|
-
|
59
|
-
def config() = @@config
|
36
|
+
require_relative "sqa/version"
|
37
|
+
require_relative "sqa/errors"
|
60
38
|
|
61
|
-
|
62
|
-
@@config = an_object
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
39
|
+
require_relative 'sqa/init.rb'
|
66
40
|
|
67
41
|
# require_relative "patches/daru" # TODO: extract Daru::DataFrame in new gem sqa-data_frame
|
68
42
|
|
43
|
+
# TODO: Some of these components make direct calls to the
|
44
|
+
# Alpha Vantage API. Convert them to use the
|
45
|
+
# alphavantage gem.
|
46
|
+
|
69
47
|
require_relative "sqa/config"
|
70
|
-
require_relative "sqa/constants"
|
71
|
-
require_relative "sqa/data_frame"
|
48
|
+
require_relative "sqa/constants" # SMELL: more app than gem
|
49
|
+
require_relative "sqa/data_frame" # TODO: drop the daru gem
|
72
50
|
require_relative "sqa/indicator"
|
73
51
|
require_relative "sqa/portfolio"
|
74
52
|
require_relative "sqa/strategy"
|
75
53
|
require_relative "sqa/stock"
|
76
54
|
require_relative "sqa/ticker"
|
77
|
-
require_relative "sqa/trade"
|
55
|
+
require_relative "sqa/trade" # SMELL: Not really a core gem; more of an application thing
|
56
|
+
|
57
|
+
|
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.
|
4
|
+
version: 0.0.15
|
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-09-
|
11
|
+
date: 2023-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: alphavantage
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,49 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
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'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: hashie
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: nenv
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: tty-logger
|
42
|
+
name: daru
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
45
|
- - ">="
|
@@ -95,7 +53,7 @@ dependencies:
|
|
95
53
|
- !ruby/object:Gem::Version
|
96
54
|
version: '0'
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
56
|
+
name: descriptive_statistics
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - ">="
|
@@ -109,7 +67,7 @@ dependencies:
|
|
109
67
|
- !ruby/object:Gem::Version
|
110
68
|
version: '0'
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
70
|
+
name: faraday
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - ">="
|
@@ -123,21 +81,21 @@ dependencies:
|
|
123
81
|
- !ruby/object:Gem::Version
|
124
82
|
version: '0'
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
84
|
+
name: hashie
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
|
-
- - "
|
87
|
+
- - "~>"
|
130
88
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
89
|
+
version: 4.1.0
|
132
90
|
type: :runtime
|
133
91
|
prerelease: false
|
134
92
|
version_requirements: !ruby/object:Gem::Requirement
|
135
93
|
requirements:
|
136
|
-
- - "
|
94
|
+
- - "~>"
|
137
95
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
96
|
+
version: 4.1.0
|
139
97
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
98
|
+
name: nenv
|
141
99
|
requirement: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
101
|
- - ">="
|
@@ -151,7 +109,7 @@ dependencies:
|
|
151
109
|
- !ruby/object:Gem::Version
|
152
110
|
version: '0'
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
112
|
+
name: sem_version
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
156
114
|
requirements:
|
157
115
|
- - ">="
|
@@ -165,7 +123,7 @@ dependencies:
|
|
165
123
|
- !ruby/object:Gem::Version
|
166
124
|
version: '0'
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
|
-
name: tty-
|
126
|
+
name: tty-option
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
170
128
|
requirements:
|
171
129
|
- - ">="
|
@@ -283,6 +241,7 @@ files:
|
|
283
241
|
- checksums/sqa-0.0.12.gem.sha512
|
284
242
|
- checksums/sqa-0.0.13.gem.sha512
|
285
243
|
- checksums/sqa-0.0.14.gem.sha512
|
244
|
+
- checksums/sqa-0.0.15.gem.sha512
|
286
245
|
- checksums/sqa-0.0.2.gem.sha512
|
287
246
|
- checksums/sqa-0.0.3.gem.sha512
|
288
247
|
- checksums/sqa-0.0.4.gem.sha512
|
@@ -293,6 +252,7 @@ files:
|
|
293
252
|
- checksums/sqa-0.0.9.gem.sha512
|
294
253
|
- docs/.gitignore
|
295
254
|
- docs/README.md
|
255
|
+
- docs/alpha_vantage_technical_indicators.md
|
296
256
|
- docs/average_true_range.md
|
297
257
|
- docs/bollinger_bands.md
|
298
258
|
- docs/candlestick_pattern_recognizer.md
|
@@ -356,6 +316,7 @@ files:
|
|
356
316
|
- lib/sqa/indicator/simple_moving_average_trend.rb
|
357
317
|
- lib/sqa/indicator/stochastic_oscillator.rb
|
358
318
|
- lib/sqa/indicator/true_range.rb
|
319
|
+
- lib/sqa/init.rb
|
359
320
|
- lib/sqa/portfolio.rb
|
360
321
|
- lib/sqa/stock.rb
|
361
322
|
- lib/sqa/strategy.rb
|