sqa 0.0.31 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +104 -0
- data/CLAUDE.md +21 -0
- data/README.md +60 -32
- data/Rakefile +52 -10
- data/docs/IMPROVEMENT_PLAN.md +531 -0
- data/docs/advanced/index.md +1 -13
- data/docs/api/dataframe.md +0 -1
- data/docs/api/index.md +547 -61
- data/docs/api-reference/alphavantageapi.md +1057 -0
- data/docs/api-reference/apierror.md +31 -0
- data/docs/api-reference/index.md +221 -0
- data/docs/api-reference/notimplemented.md +27 -0
- data/docs/api-reference/sqa.md +267 -0
- data/docs/api-reference/sqa_backtest.md +137 -0
- data/docs/api-reference/sqa_backtest_results.md +530 -0
- data/docs/api-reference/sqa_badparametererror.md +13 -0
- data/docs/api-reference/sqa_config.md +538 -0
- data/docs/api-reference/sqa_configurationerror.md +13 -0
- data/docs/api-reference/sqa_datafetcherror.md +56 -0
- data/docs/api-reference/sqa_dataframe.md +752 -0
- data/docs/api-reference/sqa_dataframe_alphavantage.md +30 -0
- data/docs/api-reference/sqa_dataframe_data.md +325 -0
- data/docs/api-reference/sqa_dataframe_yahoofinance.md +25 -0
- data/docs/api-reference/sqa_ensemble.md +413 -0
- data/docs/api-reference/sqa_fpop.md +211 -0
- data/docs/api-reference/sqa_geneticprogram.md +325 -0
- data/docs/api-reference/sqa_geneticprogram_individual.md +114 -0
- data/docs/api-reference/sqa_marketregime.md +212 -0
- data/docs/api-reference/sqa_multitimeframe.md +227 -0
- data/docs/api-reference/sqa_patternmatcher.md +195 -0
- data/docs/api-reference/sqa_pluginmanager.md +55 -0
- data/docs/api-reference/sqa_portfolio.md +455 -0
- data/docs/api-reference/sqa_portfolio_position.md +220 -0
- data/docs/api-reference/sqa_portfolio_trade.md +332 -0
- data/docs/api-reference/sqa_portfoliooptimizer.md +248 -0
- data/docs/api-reference/sqa_riskmanager.md +388 -0
- data/docs/api-reference/sqa_seasonalanalyzer.md +121 -0
- data/docs/api-reference/sqa_sectoranalyzer.md +163 -0
- data/docs/api-reference/sqa_stock.md +649 -0
- data/docs/api-reference/sqa_strategy.md +178 -0
- data/docs/api-reference/sqa_strategy_bollingerbands.md +26 -0
- data/docs/api-reference/sqa_strategy_common.md +29 -0
- data/docs/api-reference/sqa_strategy_consensus.md +129 -0
- data/docs/api-reference/sqa_strategy_ema.md +41 -0
- data/docs/api-reference/sqa_strategy_kbs.md +154 -0
- data/docs/api-reference/sqa_strategy_macd.md +26 -0
- data/docs/api-reference/sqa_strategy_mp.md +41 -0
- data/docs/api-reference/sqa_strategy_mr.md +41 -0
- data/docs/api-reference/sqa_strategy_random.md +41 -0
- data/docs/api-reference/sqa_strategy_rsi.md +41 -0
- data/docs/api-reference/sqa_strategy_sma.md +41 -0
- data/docs/api-reference/sqa_strategy_stochastic.md +26 -0
- data/docs/api-reference/sqa_strategy_volumebreakout.md +26 -0
- data/docs/api-reference/sqa_strategygenerator.md +298 -0
- data/docs/api-reference/sqa_strategygenerator_pattern.md +264 -0
- data/docs/api-reference/sqa_strategygenerator_patterncontext.md +326 -0
- data/docs/api-reference/sqa_strategygenerator_profitablepoint.md +424 -0
- data/docs/api-reference/sqa_stream.md +256 -0
- data/docs/api-reference/sqa_ticker.md +175 -0
- data/docs/api-reference/string.md +135 -0
- data/docs/assets/images/advanced-workflow.svg +89 -0
- data/docs/assets/images/architecture.svg +107 -0
- data/docs/assets/images/data-flow.svg +138 -0
- data/docs/assets/images/getting-started-workflow.svg +88 -0
- data/docs/assets/images/sqa.jpg +0 -0
- data/docs/assets/images/strategy-flow.svg +78 -0
- data/docs/assets/images/system-architecture.svg +150 -0
- data/docs/concepts/index.md +292 -27
- data/docs/data_frame.md +0 -1
- data/docs/getting-started/index.md +1 -30
- data/docs/getting-started/installation.md +2 -2
- data/docs/getting-started/quick-start.md +4 -4
- data/docs/index.md +26 -25
- data/docs/llms.txt +109 -0
- data/docs/strategies/bollinger-bands.md +1 -1
- data/docs/strategies/kbs.md +15 -14
- data/docs/strategies/rsi.md +1 -1
- data/docs/strategy.md +381 -3
- data/docs/terms_of_use.md +1 -1
- data/examples/README.md +10 -0
- data/lib/api/alpha_vantage_api.rb +3 -7
- data/lib/sqa/config.rb +109 -28
- data/lib/sqa/data_frame/alpha_vantage.rb +13 -3
- data/lib/sqa/data_frame/data.rb +13 -1
- data/lib/sqa/data_frame.rb +189 -41
- data/lib/sqa/errors.rb +79 -17
- data/lib/sqa/indicator.rb +17 -4
- data/lib/sqa/init.rb +70 -15
- data/lib/sqa/pattern_matcher.rb +4 -4
- data/lib/sqa/portfolio.rb +1 -1
- data/lib/sqa/sector_analyzer.rb +3 -11
- data/lib/sqa/stock.rb +236 -20
- data/lib/sqa/strategy.rb +62 -4
- data/lib/sqa/ticker.rb +107 -42
- data/lib/sqa/version.rb +1 -1
- data/lib/sqa.rb +16 -8
- data/mkdocs.yml +68 -117
- metadata +90 -36
- data/docs/README.md +0 -43
- data/docs/alpha_vantage_technical_indicators.md +0 -62
- data/docs/average_true_range.md +0 -9
- data/docs/bollinger_bands.md +0 -15
- data/docs/candlestick_pattern_recognizer.md +0 -4
- data/docs/donchian_channel.md +0 -5
- data/docs/double_top_bottom_pattern.md +0 -3
- data/docs/exponential_moving_average.md +0 -19
- data/docs/fibonacci_retracement.md +0 -30
- data/docs/head_and_shoulders_pattern.md +0 -3
- data/docs/market_profile.md +0 -4
- data/docs/momentum.md +0 -19
- data/docs/moving_average_convergence_divergence.md +0 -23
- data/docs/peaks_and_valleys.md +0 -11
- data/docs/relative_strength_index.md +0 -6
- data/docs/simple_moving_average.md +0 -8
- data/docs/stochastic_oscillator.md +0 -4
- data/docs/ta_lib.md +0 -160
- data/docs/true_range.md +0 -12
- data/docs/true_strength_index.md +0 -46
- data/docs/weighted_moving_average.md +0 -48
- data/examples/sinatra_app/Gemfile +0 -22
- data/examples/sinatra_app/QUICKSTART.md +0 -159
- data/examples/sinatra_app/README.md +0 -461
- data/examples/sinatra_app/app.rb +0 -344
- data/examples/sinatra_app/config.ru +0 -5
- data/examples/sinatra_app/public/css/style.css +0 -659
- data/examples/sinatra_app/public/js/app.js +0 -107
- data/examples/sinatra_app/views/analyze.erb +0 -306
- data/examples/sinatra_app/views/backtest.erb +0 -325
- data/examples/sinatra_app/views/dashboard.erb +0 -419
- data/examples/sinatra_app/views/error.erb +0 -58
- data/examples/sinatra_app/views/index.erb +0 -118
- data/examples/sinatra_app/views/layout.erb +0 -61
- data/examples/sinatra_app/views/portfolio.erb +0 -43
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 📦 SQA::DataFrame::AlphaVantage
|
|
2
|
+
|
|
3
|
+
!!! abstract "Source Information"
|
|
4
|
+
**Defined in:** `lib/sqa/data_frame/alpha_vantage.rb:9`
|
|
5
|
+
|
|
6
|
+
**Inherits from:** `Object`
|
|
7
|
+
|
|
8
|
+
## 🏭 Class Methods
|
|
9
|
+
|
|
10
|
+
### `.recent(ticker, full: = false, from_date: = nil)`
|
|
11
|
+
|
|
12
|
+
Get recent data from Alpha Vantage API
|
|
13
|
+
|
|
14
|
+
ticker String the security to retrieve
|
|
15
|
+
full Boolean whether to fetch full history or compact (last 100 days)
|
|
16
|
+
from_date Date optional date to fetch data after (for incremental updates)
|
|
17
|
+
|
|
18
|
+
Returns: SQA::DataFrame sorted in ASCENDING order (oldest to newest)
|
|
19
|
+
Note: Alpha Vantage returns data newest-first, but we sort ascending for TA-Lib compatibility
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
??? info "Source Location"
|
|
25
|
+
`lib/sqa/data_frame/alpha_vantage.rb:46`
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📝 Attributes
|
|
30
|
+
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# 📦 SQA::DataFrame::Data
|
|
2
|
+
|
|
3
|
+
!!! note "Description"
|
|
4
|
+
Data class to store stock metadata
|
|
5
|
+
|
|
6
|
+
This class holds metadata about a stock including its ticker symbol,
|
|
7
|
+
name, exchange, data source, technical indicators, and company overview.
|
|
8
|
+
|
|
9
|
+
!!! abstract "Source Information"
|
|
10
|
+
**Defined in:** `lib/sqa/data_frame/data.rb:23`
|
|
11
|
+
|
|
12
|
+
**Inherits from:** `Object`
|
|
13
|
+
|
|
14
|
+
## 🔨 Instance Methods
|
|
15
|
+
|
|
16
|
+
### `#ticker()`
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
!!! success "Returns"
|
|
20
|
+
|
|
21
|
+
**Type:** `String, nil`
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Stock ticker symbol (e.g., 'AAPL', 'MSFT')
|
|
26
|
+
|
|
27
|
+
??? info "Source Location"
|
|
28
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### `#ticker=(value)`
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
!!! success "Returns"
|
|
36
|
+
|
|
37
|
+
**Type:** `String, nil`
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Stock ticker symbol (e.g., 'AAPL', 'MSFT')
|
|
42
|
+
|
|
43
|
+
??? info "Source Location"
|
|
44
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### `#name()`
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
!!! success "Returns"
|
|
52
|
+
|
|
53
|
+
**Type:** `String, nil`
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Company name
|
|
58
|
+
|
|
59
|
+
??? info "Source Location"
|
|
60
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### `#name=(value)`
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
!!! success "Returns"
|
|
68
|
+
|
|
69
|
+
**Type:** `String, nil`
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
Company name
|
|
74
|
+
|
|
75
|
+
??? info "Source Location"
|
|
76
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### `#exchange()`
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
!!! success "Returns"
|
|
84
|
+
|
|
85
|
+
**Type:** `String, nil`
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
Exchange where stock trades (e.g., 'NASDAQ', 'NYSE')
|
|
90
|
+
|
|
91
|
+
??? info "Source Location"
|
|
92
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### `#exchange=(value)`
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
!!! success "Returns"
|
|
100
|
+
|
|
101
|
+
**Type:** `String, nil`
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
Exchange where stock trades (e.g., 'NASDAQ', 'NYSE')
|
|
106
|
+
|
|
107
|
+
??? info "Source Location"
|
|
108
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### `#source()`
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
!!! success "Returns"
|
|
116
|
+
|
|
117
|
+
**Type:** `Symbol`
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
Data source (:alpha_vantage, :yahoo_finance)
|
|
122
|
+
|
|
123
|
+
??? info "Source Location"
|
|
124
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### `#source=(value)`
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
!!! success "Returns"
|
|
132
|
+
|
|
133
|
+
**Type:** `Symbol`
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
Data source (:alpha_vantage, :yahoo_finance)
|
|
138
|
+
|
|
139
|
+
??? info "Source Location"
|
|
140
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### `#indicators()`
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
!!! success "Returns"
|
|
148
|
+
|
|
149
|
+
**Type:** `Hash`
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
Technical indicators configuration and cached values
|
|
154
|
+
|
|
155
|
+
??? info "Source Location"
|
|
156
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### `#indicators=(value)`
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
!!! success "Returns"
|
|
164
|
+
|
|
165
|
+
**Type:** `Hash`
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
Technical indicators configuration and cached values
|
|
170
|
+
|
|
171
|
+
??? info "Source Location"
|
|
172
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### `#overview()`
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
!!! success "Returns"
|
|
180
|
+
|
|
181
|
+
**Type:** `Hash`
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
Company overview data from API
|
|
186
|
+
|
|
187
|
+
??? info "Source Location"
|
|
188
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### `#overview=(value)`
|
|
193
|
+
|
|
194
|
+
Sets the attribute overview
|
|
195
|
+
|
|
196
|
+
!!! info "Parameters"
|
|
197
|
+
|
|
198
|
+
| Name | Type | Description |
|
|
199
|
+
|------|------|-------------|
|
|
200
|
+
| `value` | `Any` | the value to set the attribute overview to. |
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
??? info "Source Location"
|
|
204
|
+
`lib/sqa/data_frame/data.rb:36`
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### `#initialize(data_hash = nil, ticker: = nil, name: = nil, exchange: = nil, source: = :alpha_vantage, indicators: = {}, overview: = {})`
|
|
209
|
+
|
|
210
|
+
Initializes stock metadata.
|
|
211
|
+
|
|
212
|
+
Can be called in two ways:
|
|
213
|
+
1. With a hash: SQA::DataFrame::Data.new(hash) - for JSON deserialization
|
|
214
|
+
2. With keyword args: SQA::DataFrame::Data.new(ticker: 'AAPL', source: :alpha_vantage, ...)
|
|
215
|
+
|
|
216
|
+
!!! info "Parameters"
|
|
217
|
+
|
|
218
|
+
| Name | Type | Description |
|
|
219
|
+
|------|------|-------------|
|
|
220
|
+
| `data_hash` | `Hash, nil` | Hash of all attributes (when passed as first positional arg) |
|
|
221
|
+
| `ticker` | `String, Symbol, nil` | Ticker symbol |
|
|
222
|
+
| `name` | `String, nil` | Stock name |
|
|
223
|
+
| `exchange` | `String, nil` | Exchange symbol (e.g., 'NASDAQ', 'NYSE') |
|
|
224
|
+
| `source` | `Symbol` | Data source (:alpha_vantage, :yahoo_finance) |
|
|
225
|
+
| `indicators` | `Hash` | Technical indicators configuration |
|
|
226
|
+
| `overview` | `Hash` | Company overview data |
|
|
227
|
+
!!! success "Returns"
|
|
228
|
+
|
|
229
|
+
**Type:** `Data`
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
a new instance of Data
|
|
234
|
+
|
|
235
|
+
??? info "Source Location"
|
|
236
|
+
`lib/sqa/data_frame/data.rb:52`
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### `#to_json(*args)`
|
|
241
|
+
|
|
242
|
+
Serialize to JSON string
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
!!! success "Returns"
|
|
246
|
+
|
|
247
|
+
**Type:** `String`
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
JSON representation
|
|
252
|
+
|
|
253
|
+
??? info "Source Location"
|
|
254
|
+
`lib/sqa/data_frame/data.rb:78`
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### `#to_h()`
|
|
259
|
+
|
|
260
|
+
Convert to hash
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
!!! success "Returns"
|
|
264
|
+
|
|
265
|
+
**Type:** `Hash`
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
Hash representation
|
|
270
|
+
|
|
271
|
+
??? info "Source Location"
|
|
272
|
+
`lib/sqa/data_frame/data.rb:85`
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### `#to_s()`
|
|
277
|
+
|
|
278
|
+
String representation
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
!!! success "Returns"
|
|
282
|
+
|
|
283
|
+
**Type:** `String`
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
Human-readable representation
|
|
288
|
+
|
|
289
|
+
??? info "Source Location"
|
|
290
|
+
`lib/sqa/data_frame/data.rb:99`
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
### `#inspect()`
|
|
295
|
+
|
|
296
|
+
String representation
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
!!! success "Returns"
|
|
300
|
+
|
|
301
|
+
**Type:** `String`
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
Human-readable representation
|
|
306
|
+
|
|
307
|
+
??? info "Source Location"
|
|
308
|
+
`lib/sqa/data_frame/data.rb:102`
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 📝 Attributes
|
|
313
|
+
|
|
314
|
+
### 🔄 `ticker` <small>read/write</small>
|
|
315
|
+
|
|
316
|
+
### 🔄 `name` <small>read/write</small>
|
|
317
|
+
|
|
318
|
+
### 🔄 `exchange` <small>read/write</small>
|
|
319
|
+
|
|
320
|
+
### 🔄 `source` <small>read/write</small>
|
|
321
|
+
|
|
322
|
+
### 🔄 `indicators` <small>read/write</small>
|
|
323
|
+
|
|
324
|
+
### 🔄 `overview` <small>read/write</small>
|
|
325
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 📦 SQA::DataFrame::YahooFinance
|
|
2
|
+
|
|
3
|
+
!!! abstract "Source Information"
|
|
4
|
+
**Defined in:** `lib/sqa/data_frame/yahoo_finance.rb:13`
|
|
5
|
+
|
|
6
|
+
**Inherits from:** `Object`
|
|
7
|
+
|
|
8
|
+
## 🏭 Class Methods
|
|
9
|
+
|
|
10
|
+
### `.recent(ticker)`
|
|
11
|
+
|
|
12
|
+
Scrape the Yahoo Finance website to get recent
|
|
13
|
+
historical prices for a specific ticker
|
|
14
|
+
returns a Polars DataFrame
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
??? info "Source Location"
|
|
20
|
+
`lib/sqa/data_frame/yahoo_finance.rb:40`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📝 Attributes
|
|
25
|
+
|