sqa 0.0.32 → 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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -1
  3. data/README.md +4 -0
  4. data/Rakefile +52 -10
  5. data/docs/IMPROVEMENT_PLAN.md +531 -0
  6. data/docs/advanced/index.md +1 -13
  7. data/docs/api/index.md +547 -61
  8. data/docs/api-reference/alphavantageapi.md +1057 -0
  9. data/docs/api-reference/apierror.md +31 -0
  10. data/docs/api-reference/index.md +221 -0
  11. data/docs/api-reference/notimplemented.md +27 -0
  12. data/docs/api-reference/sqa.md +267 -0
  13. data/docs/api-reference/sqa_backtest.md +137 -0
  14. data/docs/api-reference/sqa_backtest_results.md +530 -0
  15. data/docs/api-reference/sqa_badparametererror.md +13 -0
  16. data/docs/api-reference/sqa_config.md +538 -0
  17. data/docs/api-reference/sqa_configurationerror.md +13 -0
  18. data/docs/api-reference/sqa_datafetcherror.md +56 -0
  19. data/docs/api-reference/sqa_dataframe.md +752 -0
  20. data/docs/api-reference/sqa_dataframe_alphavantage.md +30 -0
  21. data/docs/api-reference/sqa_dataframe_data.md +325 -0
  22. data/docs/api-reference/sqa_dataframe_yahoofinance.md +25 -0
  23. data/docs/api-reference/sqa_ensemble.md +413 -0
  24. data/docs/api-reference/sqa_fpop.md +211 -0
  25. data/docs/api-reference/sqa_geneticprogram.md +325 -0
  26. data/docs/api-reference/sqa_geneticprogram_individual.md +114 -0
  27. data/docs/api-reference/sqa_marketregime.md +212 -0
  28. data/docs/api-reference/sqa_multitimeframe.md +227 -0
  29. data/docs/api-reference/sqa_patternmatcher.md +195 -0
  30. data/docs/api-reference/sqa_pluginmanager.md +55 -0
  31. data/docs/api-reference/sqa_portfolio.md +455 -0
  32. data/docs/api-reference/sqa_portfolio_position.md +220 -0
  33. data/docs/api-reference/sqa_portfolio_trade.md +332 -0
  34. data/docs/api-reference/sqa_portfoliooptimizer.md +248 -0
  35. data/docs/api-reference/sqa_riskmanager.md +388 -0
  36. data/docs/api-reference/sqa_seasonalanalyzer.md +121 -0
  37. data/docs/api-reference/sqa_sectoranalyzer.md +163 -0
  38. data/docs/api-reference/sqa_stock.md +649 -0
  39. data/docs/api-reference/sqa_strategy.md +178 -0
  40. data/docs/api-reference/sqa_strategy_bollingerbands.md +26 -0
  41. data/docs/api-reference/sqa_strategy_common.md +29 -0
  42. data/docs/api-reference/sqa_strategy_consensus.md +129 -0
  43. data/docs/api-reference/sqa_strategy_ema.md +41 -0
  44. data/docs/api-reference/sqa_strategy_kbs.md +154 -0
  45. data/docs/api-reference/sqa_strategy_macd.md +26 -0
  46. data/docs/api-reference/sqa_strategy_mp.md +41 -0
  47. data/docs/api-reference/sqa_strategy_mr.md +41 -0
  48. data/docs/api-reference/sqa_strategy_random.md +41 -0
  49. data/docs/api-reference/sqa_strategy_rsi.md +41 -0
  50. data/docs/api-reference/sqa_strategy_sma.md +41 -0
  51. data/docs/api-reference/sqa_strategy_stochastic.md +26 -0
  52. data/docs/api-reference/sqa_strategy_volumebreakout.md +26 -0
  53. data/docs/api-reference/sqa_strategygenerator.md +298 -0
  54. data/docs/api-reference/sqa_strategygenerator_pattern.md +264 -0
  55. data/docs/api-reference/sqa_strategygenerator_patterncontext.md +326 -0
  56. data/docs/api-reference/sqa_strategygenerator_profitablepoint.md +424 -0
  57. data/docs/api-reference/sqa_stream.md +256 -0
  58. data/docs/api-reference/sqa_ticker.md +175 -0
  59. data/docs/api-reference/string.md +135 -0
  60. data/docs/assets/images/advanced-workflow.svg +89 -0
  61. data/docs/assets/images/architecture.svg +107 -0
  62. data/docs/assets/images/data-flow.svg +138 -0
  63. data/docs/assets/images/getting-started-workflow.svg +88 -0
  64. data/docs/assets/images/strategy-flow.svg +78 -0
  65. data/docs/assets/images/system-architecture.svg +150 -0
  66. data/docs/concepts/index.md +292 -19
  67. data/docs/getting-started/index.md +1 -14
  68. data/docs/index.md +26 -23
  69. data/docs/llms.txt +109 -0
  70. data/docs/strategies/kbs.md +15 -14
  71. data/docs/strategy.md +381 -3
  72. data/docs/terms_of_use.md +1 -1
  73. data/examples/README.md +10 -0
  74. data/lib/api/alpha_vantage_api.rb +3 -7
  75. data/lib/sqa/config.rb +109 -28
  76. data/lib/sqa/data_frame/data.rb +13 -1
  77. data/lib/sqa/data_frame.rb +168 -26
  78. data/lib/sqa/errors.rb +79 -17
  79. data/lib/sqa/init.rb +70 -15
  80. data/lib/sqa/pattern_matcher.rb +4 -4
  81. data/lib/sqa/portfolio.rb +1 -1
  82. data/lib/sqa/sector_analyzer.rb +3 -11
  83. data/lib/sqa/stock.rb +169 -15
  84. data/lib/sqa/strategy.rb +62 -4
  85. data/lib/sqa/ticker.rb +106 -48
  86. data/lib/sqa/version.rb +1 -1
  87. data/lib/sqa.rb +4 -4
  88. data/mkdocs.yml +68 -81
  89. metadata +89 -21
  90. data/docs/README.md +0 -43
  91. data/examples/sinatra_app/Gemfile +0 -42
  92. data/examples/sinatra_app/Gemfile.lock +0 -268
  93. data/examples/sinatra_app/QUICKSTART.md +0 -169
  94. data/examples/sinatra_app/README.md +0 -471
  95. data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +0 -90
  96. data/examples/sinatra_app/TROUBLESHOOTING.md +0 -95
  97. data/examples/sinatra_app/app.rb +0 -404
  98. data/examples/sinatra_app/config.ru +0 -5
  99. data/examples/sinatra_app/public/css/style.css +0 -723
  100. data/examples/sinatra_app/public/debug_macd.html +0 -82
  101. data/examples/sinatra_app/public/js/app.js +0 -107
  102. data/examples/sinatra_app/start.sh +0 -53
  103. data/examples/sinatra_app/views/analyze.erb +0 -306
  104. data/examples/sinatra_app/views/backtest.erb +0 -325
  105. data/examples/sinatra_app/views/dashboard.erb +0 -831
  106. data/examples/sinatra_app/views/error.erb +0 -58
  107. data/examples/sinatra_app/views/index.erb +0 -118
  108. data/examples/sinatra_app/views/layout.erb +0 -61
  109. data/examples/sinatra_app/views/portfolio.erb +0 -43
@@ -0,0 +1,538 @@
1
+ # 📦 SQA::Config
2
+
3
+ !!! note "Description"
4
+ Configuration class for SQA settings.
5
+ Extends Hashie::Dash for property-based configuration with coercion.
6
+
7
+ !!! abstract "Source Information"
8
+ **Defined in:** `lib/sqa/config.rb:54`
9
+
10
+ **Inherits from:** `Hashie::Dash`
11
+
12
+ ## 🏭 Class Methods
13
+
14
+ ### `.reset()`
15
+
16
+ Resets the configuration to default values.
17
+ Creates a new Config instance and assigns it to SQA.config.
18
+
19
+
20
+ !!! success "Returns"
21
+
22
+ **Type:** `SQA::Config`
23
+
24
+
25
+
26
+ The new config instance
27
+
28
+ ??? info "Source Location"
29
+ `lib/sqa/config.rb:255`
30
+
31
+ ---
32
+
33
+ ### `.initialized?()`
34
+
35
+ Returns whether the configuration has been initialized.
36
+
37
+
38
+ !!! success "Returns"
39
+
40
+ **Type:** `Boolean`
41
+
42
+
43
+
44
+ true if reset has been called
45
+
46
+ ??? info "Source Location"
47
+ `lib/sqa/config.rb:263`
48
+
49
+ ---
50
+
51
+ ## 🔨 Instance Methods
52
+
53
+ ### `#command()`
54
+
55
+
56
+ !!! success "Returns"
57
+
58
+ **Type:** `String, nil`
59
+
60
+
61
+
62
+ Current command (nil, 'analysis', or 'web')
63
+
64
+ ??? info "Source Location"
65
+ `lib/sqa/config.rb:54`
66
+
67
+ ---
68
+
69
+ ### `#command=(value)`
70
+
71
+
72
+ !!! success "Returns"
73
+
74
+ **Type:** `String, nil`
75
+
76
+
77
+
78
+ Current command (nil, 'analysis', or 'web')
79
+
80
+ ??? info "Source Location"
81
+ `lib/sqa/config.rb:54`
82
+
83
+ ---
84
+
85
+ ### `#config_file()`
86
+
87
+
88
+ !!! success "Returns"
89
+
90
+ **Type:** `String, nil`
91
+
92
+
93
+
94
+ Path to configuration file
95
+
96
+ ??? info "Source Location"
97
+ `lib/sqa/config.rb:54`
98
+
99
+ ---
100
+
101
+ ### `#config_file=(value)`
102
+
103
+
104
+ !!! success "Returns"
105
+
106
+ **Type:** `String, nil`
107
+
108
+
109
+
110
+ Path to configuration file
111
+
112
+ ??? info "Source Location"
113
+ `lib/sqa/config.rb:54`
114
+
115
+ ---
116
+
117
+ ### `#dump_config()`
118
+
119
+
120
+ !!! success "Returns"
121
+
122
+ **Type:** `String, nil`
123
+
124
+
125
+
126
+ Path to dump current configuration
127
+
128
+ ??? info "Source Location"
129
+ `lib/sqa/config.rb:54`
130
+
131
+ ---
132
+
133
+ ### `#dump_config=(value)`
134
+
135
+
136
+ !!! success "Returns"
137
+
138
+ **Type:** `String, nil`
139
+
140
+
141
+
142
+ Path to dump current configuration
143
+
144
+ ??? info "Source Location"
145
+ `lib/sqa/config.rb:54`
146
+
147
+ ---
148
+
149
+ ### `#data_dir()`
150
+
151
+
152
+ !!! success "Returns"
153
+
154
+ **Type:** `String`
155
+
156
+
157
+
158
+ Directory for data storage (default: ~/sqa_data)
159
+
160
+ ??? info "Source Location"
161
+ `lib/sqa/config.rb:54`
162
+
163
+ ---
164
+
165
+ ### `#data_dir=(value)`
166
+
167
+
168
+ !!! success "Returns"
169
+
170
+ **Type:** `String`
171
+
172
+
173
+
174
+ Directory for data storage (default: ~/sqa_data)
175
+
176
+ ??? info "Source Location"
177
+ `lib/sqa/config.rb:54`
178
+
179
+ ---
180
+
181
+ ### `#portfolio_filename()`
182
+
183
+
184
+ !!! success "Returns"
185
+
186
+ **Type:** `String`
187
+
188
+
189
+
190
+ Portfolio CSV filename (default: portfolio.csv)
191
+
192
+ ??? info "Source Location"
193
+ `lib/sqa/config.rb:54`
194
+
195
+ ---
196
+
197
+ ### `#portfolio_filename=(value)`
198
+
199
+
200
+ !!! success "Returns"
201
+
202
+ **Type:** `String`
203
+
204
+
205
+
206
+ Portfolio CSV filename (default: portfolio.csv)
207
+
208
+ ??? info "Source Location"
209
+ `lib/sqa/config.rb:54`
210
+
211
+ ---
212
+
213
+ ### `#trades_filename()`
214
+
215
+
216
+ !!! success "Returns"
217
+
218
+ **Type:** `String`
219
+
220
+
221
+
222
+ Trades CSV filename (default: trades.csv)
223
+
224
+ ??? info "Source Location"
225
+ `lib/sqa/config.rb:54`
226
+
227
+ ---
228
+
229
+ ### `#trades_filename=(value)`
230
+
231
+
232
+ !!! success "Returns"
233
+
234
+ **Type:** `String`
235
+
236
+
237
+
238
+ Trades CSV filename (default: trades.csv)
239
+
240
+ ??? info "Source Location"
241
+ `lib/sqa/config.rb:54`
242
+
243
+ ---
244
+
245
+ ### `#log_level()`
246
+
247
+
248
+ !!! success "Returns"
249
+
250
+ **Type:** `Symbol`
251
+
252
+
253
+
254
+ Log level (:debug, :info, :warn, :error, :fatal)
255
+
256
+ ??? info "Source Location"
257
+ `lib/sqa/config.rb:54`
258
+
259
+ ---
260
+
261
+ ### `#log_level=(value)`
262
+
263
+
264
+ !!! success "Returns"
265
+
266
+ **Type:** `Symbol`
267
+
268
+
269
+
270
+ Log level (:debug, :info, :warn, :error, :fatal)
271
+
272
+ ??? info "Source Location"
273
+ `lib/sqa/config.rb:54`
274
+
275
+ ---
276
+
277
+ ### `#debug()`
278
+
279
+
280
+ !!! success "Returns"
281
+
282
+ **Type:** `Boolean`
283
+
284
+
285
+
286
+ Enable debug mode
287
+
288
+ ??? info "Source Location"
289
+ `lib/sqa/config.rb:54`
290
+
291
+ ---
292
+
293
+ ### `#debug=(value)`
294
+
295
+
296
+ !!! success "Returns"
297
+
298
+ **Type:** `Boolean`
299
+
300
+
301
+
302
+ Enable debug mode
303
+
304
+ ??? info "Source Location"
305
+ `lib/sqa/config.rb:54`
306
+
307
+ ---
308
+
309
+ ### `#verbose()`
310
+
311
+
312
+ !!! success "Returns"
313
+
314
+ **Type:** `Boolean`
315
+
316
+
317
+
318
+ Enable verbose output
319
+
320
+ ??? info "Source Location"
321
+ `lib/sqa/config.rb:54`
322
+
323
+ ---
324
+
325
+ ### `#verbose=(value)`
326
+
327
+
328
+ !!! success "Returns"
329
+
330
+ **Type:** `Boolean`
331
+
332
+
333
+
334
+ Enable verbose output
335
+
336
+ ??? info "Source Location"
337
+ `lib/sqa/config.rb:54`
338
+
339
+ ---
340
+
341
+ ### `#plotting_library()`
342
+
343
+
344
+ !!! success "Returns"
345
+
346
+ **Type:** `Symbol`
347
+
348
+
349
+
350
+ Plotting library to use (:gruff)
351
+
352
+ ??? info "Source Location"
353
+ `lib/sqa/config.rb:54`
354
+
355
+ ---
356
+
357
+ ### `#plotting_library=(value)`
358
+
359
+
360
+ !!! success "Returns"
361
+
362
+ **Type:** `Symbol`
363
+
364
+
365
+
366
+ Plotting library to use (:gruff)
367
+
368
+ ??? info "Source Location"
369
+ `lib/sqa/config.rb:54`
370
+
371
+ ---
372
+
373
+ ### `#lazy_update()`
374
+
375
+
376
+ !!! success "Returns"
377
+
378
+ **Type:** `Boolean`
379
+
380
+
381
+
382
+ Skip API updates if cached data exists
383
+
384
+ ??? info "Source Location"
385
+ `lib/sqa/config.rb:54`
386
+
387
+ ---
388
+
389
+ ### `#lazy_update=(value)`
390
+
391
+
392
+ !!! success "Returns"
393
+
394
+ **Type:** `Boolean`
395
+
396
+
397
+
398
+ Skip API updates if cached data exists
399
+
400
+ ??? info "Source Location"
401
+ `lib/sqa/config.rb:54`
402
+
403
+ ---
404
+
405
+ ### `#initialize(a_hash = {})`
406
+
407
+ Creates a new Config instance with optional initial values.
408
+ Automatically applies environment variable overrides.
409
+
410
+ !!! info "Parameters"
411
+
412
+ | Name | Type | Description |
413
+ |------|------|-------------|
414
+ | `a_hash` | `Hash` | Initial configuration values |
415
+ !!! success "Returns"
416
+
417
+ **Type:** `Config`
418
+
419
+
420
+
421
+ a new instance of Config
422
+
423
+ ??? info "Source Location"
424
+ `lib/sqa/config.rb:120`
425
+
426
+ ---
427
+
428
+ ### `#debug?()`
429
+
430
+ Returns whether debug mode is enabled.
431
+
432
+
433
+ !!! success "Returns"
434
+
435
+ **Type:** `Boolean`
436
+
437
+
438
+
439
+ true if debug mode is on
440
+
441
+ ??? info "Source Location"
442
+ `lib/sqa/config.rb:127`
443
+
444
+ ---
445
+
446
+ ### `#verbose?()`
447
+
448
+ Returns whether verbose mode is enabled.
449
+
450
+
451
+ !!! success "Returns"
452
+
453
+ **Type:** `Boolean`
454
+
455
+
456
+
457
+ true if verbose mode is on
458
+
459
+ ??? info "Source Location"
460
+ `lib/sqa/config.rb:131`
461
+
462
+ ---
463
+
464
+ ### `#from_file()`
465
+
466
+ Loads configuration from a file.
467
+ Supports YAML (.yml, .yaml), TOML (.toml), and JSON (.json) formats.
468
+
469
+
470
+ !!! success "Returns"
471
+
472
+ **Type:** `void`
473
+
474
+
475
+
476
+ ??? info "Source Location"
477
+ `lib/sqa/config.rb:141`
478
+
479
+ ---
480
+
481
+ ### `#dump_file()`
482
+
483
+ Writes current configuration to a file.
484
+ Format is determined by file extension.
485
+
486
+
487
+ !!! success "Returns"
488
+
489
+ **Type:** `void`
490
+
491
+
492
+
493
+ ??? info "Source Location"
494
+ `lib/sqa/config.rb:178`
495
+
496
+ ---
497
+
498
+ ### `#inject_additional_properties()`
499
+
500
+ Injects additional properties from plugins.
501
+ Allows external code to register new configuration options.
502
+
503
+
504
+ !!! success "Returns"
505
+
506
+ **Type:** `void`
507
+
508
+
509
+
510
+ ??? info "Source Location"
511
+ `lib/sqa/config.rb:206`
512
+
513
+ ---
514
+
515
+ ## 📝 Attributes
516
+
517
+ ### 🔄 `command` <small>read/write</small>
518
+
519
+ ### 🔄 `config_file` <small>read/write</small>
520
+
521
+ ### 🔄 `dump_config` <small>read/write</small>
522
+
523
+ ### 🔄 `data_dir` <small>read/write</small>
524
+
525
+ ### 🔄 `portfolio_filename` <small>read/write</small>
526
+
527
+ ### 🔄 `trades_filename` <small>read/write</small>
528
+
529
+ ### 🔄 `log_level` <small>read/write</small>
530
+
531
+ ### 🔄 `debug` <small>read/write</small>
532
+
533
+ ### 🔄 `verbose` <small>read/write</small>
534
+
535
+ ### 🔄 `plotting_library` <small>read/write</small>
536
+
537
+ ### 🔄 `lazy_update` <small>read/write</small>
538
+
@@ -0,0 +1,13 @@
1
+ # 📦 SQA::ConfigurationError
2
+
3
+ !!! note "Description"
4
+ Raised when SQA configuration is invalid or missing.
5
+ Common causes include missing API keys or invalid data directories.
6
+
7
+ !!! abstract "Source Information"
8
+ **Defined in:** `lib/sqa/errors.rb:46`
9
+
10
+ **Inherits from:** `StandardError`
11
+
12
+ ## 📝 Attributes
13
+
@@ -0,0 +1,56 @@
1
+ # 📦 SQA::DataFetchError
2
+
3
+ !!! note "Description"
4
+ Raised when unable to fetch data from a data source (API, file, etc.).
5
+ Wraps the original exception for debugging purposes.
6
+
7
+ !!! abstract "Source Information"
8
+ **Defined in:** `lib/sqa/errors.rb:26`
9
+
10
+ **Inherits from:** `StandardError`
11
+
12
+ ## 🔨 Instance Methods
13
+
14
+ ### `#original_error()`
15
+
16
+
17
+ !!! success "Returns"
18
+
19
+ **Type:** `Exception, nil`
20
+
21
+
22
+
23
+ The original exception that caused this error
24
+
25
+ ??? info "Source Location"
26
+ `lib/sqa/errors.rb:28`
27
+
28
+ ---
29
+
30
+ ### `#initialize(message, original: = nil)`
31
+
32
+ Creates a new DataFetchError.
33
+
34
+ !!! info "Parameters"
35
+
36
+ | Name | Type | Description |
37
+ |------|------|-------------|
38
+ | `message` | `String` | Error message describing the fetch failure |
39
+ | `original` | `Exception, nil` | The original exception that was caught |
40
+ !!! success "Returns"
41
+
42
+ **Type:** `DataFetchError`
43
+
44
+
45
+
46
+ a new instance of DataFetchError
47
+
48
+ ??? info "Source Location"
49
+ `lib/sqa/errors.rb:34`
50
+
51
+ ---
52
+
53
+ ## 📝 Attributes
54
+
55
+ ### 👁️ `original_error` <small>read-only</small>
56
+