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.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +104 -0
  3. data/CLAUDE.md +21 -0
  4. data/README.md +60 -32
  5. data/Rakefile +52 -10
  6. data/docs/IMPROVEMENT_PLAN.md +531 -0
  7. data/docs/advanced/index.md +1 -13
  8. data/docs/api/dataframe.md +0 -1
  9. data/docs/api/index.md +547 -61
  10. data/docs/api-reference/alphavantageapi.md +1057 -0
  11. data/docs/api-reference/apierror.md +31 -0
  12. data/docs/api-reference/index.md +221 -0
  13. data/docs/api-reference/notimplemented.md +27 -0
  14. data/docs/api-reference/sqa.md +267 -0
  15. data/docs/api-reference/sqa_backtest.md +137 -0
  16. data/docs/api-reference/sqa_backtest_results.md +530 -0
  17. data/docs/api-reference/sqa_badparametererror.md +13 -0
  18. data/docs/api-reference/sqa_config.md +538 -0
  19. data/docs/api-reference/sqa_configurationerror.md +13 -0
  20. data/docs/api-reference/sqa_datafetcherror.md +56 -0
  21. data/docs/api-reference/sqa_dataframe.md +752 -0
  22. data/docs/api-reference/sqa_dataframe_alphavantage.md +30 -0
  23. data/docs/api-reference/sqa_dataframe_data.md +325 -0
  24. data/docs/api-reference/sqa_dataframe_yahoofinance.md +25 -0
  25. data/docs/api-reference/sqa_ensemble.md +413 -0
  26. data/docs/api-reference/sqa_fpop.md +211 -0
  27. data/docs/api-reference/sqa_geneticprogram.md +325 -0
  28. data/docs/api-reference/sqa_geneticprogram_individual.md +114 -0
  29. data/docs/api-reference/sqa_marketregime.md +212 -0
  30. data/docs/api-reference/sqa_multitimeframe.md +227 -0
  31. data/docs/api-reference/sqa_patternmatcher.md +195 -0
  32. data/docs/api-reference/sqa_pluginmanager.md +55 -0
  33. data/docs/api-reference/sqa_portfolio.md +455 -0
  34. data/docs/api-reference/sqa_portfolio_position.md +220 -0
  35. data/docs/api-reference/sqa_portfolio_trade.md +332 -0
  36. data/docs/api-reference/sqa_portfoliooptimizer.md +248 -0
  37. data/docs/api-reference/sqa_riskmanager.md +388 -0
  38. data/docs/api-reference/sqa_seasonalanalyzer.md +121 -0
  39. data/docs/api-reference/sqa_sectoranalyzer.md +163 -0
  40. data/docs/api-reference/sqa_stock.md +649 -0
  41. data/docs/api-reference/sqa_strategy.md +178 -0
  42. data/docs/api-reference/sqa_strategy_bollingerbands.md +26 -0
  43. data/docs/api-reference/sqa_strategy_common.md +29 -0
  44. data/docs/api-reference/sqa_strategy_consensus.md +129 -0
  45. data/docs/api-reference/sqa_strategy_ema.md +41 -0
  46. data/docs/api-reference/sqa_strategy_kbs.md +154 -0
  47. data/docs/api-reference/sqa_strategy_macd.md +26 -0
  48. data/docs/api-reference/sqa_strategy_mp.md +41 -0
  49. data/docs/api-reference/sqa_strategy_mr.md +41 -0
  50. data/docs/api-reference/sqa_strategy_random.md +41 -0
  51. data/docs/api-reference/sqa_strategy_rsi.md +41 -0
  52. data/docs/api-reference/sqa_strategy_sma.md +41 -0
  53. data/docs/api-reference/sqa_strategy_stochastic.md +26 -0
  54. data/docs/api-reference/sqa_strategy_volumebreakout.md +26 -0
  55. data/docs/api-reference/sqa_strategygenerator.md +298 -0
  56. data/docs/api-reference/sqa_strategygenerator_pattern.md +264 -0
  57. data/docs/api-reference/sqa_strategygenerator_patterncontext.md +326 -0
  58. data/docs/api-reference/sqa_strategygenerator_profitablepoint.md +424 -0
  59. data/docs/api-reference/sqa_stream.md +256 -0
  60. data/docs/api-reference/sqa_ticker.md +175 -0
  61. data/docs/api-reference/string.md +135 -0
  62. data/docs/assets/images/advanced-workflow.svg +89 -0
  63. data/docs/assets/images/architecture.svg +107 -0
  64. data/docs/assets/images/data-flow.svg +138 -0
  65. data/docs/assets/images/getting-started-workflow.svg +88 -0
  66. data/docs/assets/images/sqa.jpg +0 -0
  67. data/docs/assets/images/strategy-flow.svg +78 -0
  68. data/docs/assets/images/system-architecture.svg +150 -0
  69. data/docs/concepts/index.md +292 -27
  70. data/docs/data_frame.md +0 -1
  71. data/docs/getting-started/index.md +1 -30
  72. data/docs/getting-started/installation.md +2 -2
  73. data/docs/getting-started/quick-start.md +4 -4
  74. data/docs/index.md +26 -25
  75. data/docs/llms.txt +109 -0
  76. data/docs/strategies/bollinger-bands.md +1 -1
  77. data/docs/strategies/kbs.md +15 -14
  78. data/docs/strategies/rsi.md +1 -1
  79. data/docs/strategy.md +381 -3
  80. data/docs/terms_of_use.md +1 -1
  81. data/examples/README.md +10 -0
  82. data/lib/api/alpha_vantage_api.rb +3 -7
  83. data/lib/sqa/config.rb +109 -28
  84. data/lib/sqa/data_frame/alpha_vantage.rb +13 -3
  85. data/lib/sqa/data_frame/data.rb +13 -1
  86. data/lib/sqa/data_frame.rb +189 -41
  87. data/lib/sqa/errors.rb +79 -17
  88. data/lib/sqa/indicator.rb +17 -4
  89. data/lib/sqa/init.rb +70 -15
  90. data/lib/sqa/pattern_matcher.rb +4 -4
  91. data/lib/sqa/portfolio.rb +1 -1
  92. data/lib/sqa/sector_analyzer.rb +3 -11
  93. data/lib/sqa/stock.rb +236 -20
  94. data/lib/sqa/strategy.rb +62 -4
  95. data/lib/sqa/ticker.rb +107 -42
  96. data/lib/sqa/version.rb +1 -1
  97. data/lib/sqa.rb +16 -8
  98. data/mkdocs.yml +68 -117
  99. metadata +90 -36
  100. data/docs/README.md +0 -43
  101. data/docs/alpha_vantage_technical_indicators.md +0 -62
  102. data/docs/average_true_range.md +0 -9
  103. data/docs/bollinger_bands.md +0 -15
  104. data/docs/candlestick_pattern_recognizer.md +0 -4
  105. data/docs/donchian_channel.md +0 -5
  106. data/docs/double_top_bottom_pattern.md +0 -3
  107. data/docs/exponential_moving_average.md +0 -19
  108. data/docs/fibonacci_retracement.md +0 -30
  109. data/docs/head_and_shoulders_pattern.md +0 -3
  110. data/docs/market_profile.md +0 -4
  111. data/docs/momentum.md +0 -19
  112. data/docs/moving_average_convergence_divergence.md +0 -23
  113. data/docs/peaks_and_valleys.md +0 -11
  114. data/docs/relative_strength_index.md +0 -6
  115. data/docs/simple_moving_average.md +0 -8
  116. data/docs/stochastic_oscillator.md +0 -4
  117. data/docs/ta_lib.md +0 -160
  118. data/docs/true_range.md +0 -12
  119. data/docs/true_strength_index.md +0 -46
  120. data/docs/weighted_moving_average.md +0 -48
  121. data/examples/sinatra_app/Gemfile +0 -22
  122. data/examples/sinatra_app/QUICKSTART.md +0 -159
  123. data/examples/sinatra_app/README.md +0 -461
  124. data/examples/sinatra_app/app.rb +0 -344
  125. data/examples/sinatra_app/config.ru +0 -5
  126. data/examples/sinatra_app/public/css/style.css +0 -659
  127. data/examples/sinatra_app/public/js/app.js +0 -107
  128. data/examples/sinatra_app/views/analyze.erb +0 -306
  129. data/examples/sinatra_app/views/backtest.erb +0 -325
  130. data/examples/sinatra_app/views/dashboard.erb +0 -419
  131. data/examples/sinatra_app/views/error.erb +0 -58
  132. data/examples/sinatra_app/views/index.erb +0 -118
  133. data/examples/sinatra_app/views/layout.erb +0 -61
  134. data/examples/sinatra_app/views/portfolio.erb +0 -43
@@ -0,0 +1,530 @@
1
+ # 📦 SQA::Backtest::Results
2
+
3
+ !!! note "Description"
4
+ Represents the results of a backtest
5
+
6
+ !!! abstract "Source Information"
7
+ **Defined in:** `lib/sqa/backtest.rb:11`
8
+
9
+ **Inherits from:** `Object`
10
+
11
+ ## 🔨 Instance Methods
12
+
13
+ ### `#total_return()`
14
+
15
+ Returns the value of attribute total_return.
16
+
17
+
18
+
19
+
20
+ ??? info "Source Location"
21
+ `lib/sqa/backtest.rb:12`
22
+
23
+ ---
24
+
25
+ ### `#total_return=(value)`
26
+
27
+ Sets the attribute total_return
28
+
29
+ !!! info "Parameters"
30
+
31
+ | Name | Type | Description |
32
+ |------|------|-------------|
33
+ | `value` | `Any` | the value to set the attribute total_return to. |
34
+
35
+
36
+ ??? info "Source Location"
37
+ `lib/sqa/backtest.rb:12`
38
+
39
+ ---
40
+
41
+ ### `#annualized_return()`
42
+
43
+ Returns the value of attribute annualized_return.
44
+
45
+
46
+
47
+
48
+ ??? info "Source Location"
49
+ `lib/sqa/backtest.rb:12`
50
+
51
+ ---
52
+
53
+ ### `#annualized_return=(value)`
54
+
55
+ Sets the attribute annualized_return
56
+
57
+ !!! info "Parameters"
58
+
59
+ | Name | Type | Description |
60
+ |------|------|-------------|
61
+ | `value` | `Any` | the value to set the attribute annualized_return to. |
62
+
63
+
64
+ ??? info "Source Location"
65
+ `lib/sqa/backtest.rb:12`
66
+
67
+ ---
68
+
69
+ ### `#sharpe_ratio()`
70
+
71
+ Returns the value of attribute sharpe_ratio.
72
+
73
+
74
+
75
+
76
+ ??? info "Source Location"
77
+ `lib/sqa/backtest.rb:12`
78
+
79
+ ---
80
+
81
+ ### `#sharpe_ratio=(value)`
82
+
83
+ Sets the attribute sharpe_ratio
84
+
85
+ !!! info "Parameters"
86
+
87
+ | Name | Type | Description |
88
+ |------|------|-------------|
89
+ | `value` | `Any` | the value to set the attribute sharpe_ratio to. |
90
+
91
+
92
+ ??? info "Source Location"
93
+ `lib/sqa/backtest.rb:12`
94
+
95
+ ---
96
+
97
+ ### `#max_drawdown()`
98
+
99
+ Returns the value of attribute max_drawdown.
100
+
101
+
102
+
103
+
104
+ ??? info "Source Location"
105
+ `lib/sqa/backtest.rb:12`
106
+
107
+ ---
108
+
109
+ ### `#max_drawdown=(value)`
110
+
111
+ Sets the attribute max_drawdown
112
+
113
+ !!! info "Parameters"
114
+
115
+ | Name | Type | Description |
116
+ |------|------|-------------|
117
+ | `value` | `Any` | the value to set the attribute max_drawdown to. |
118
+
119
+
120
+ ??? info "Source Location"
121
+ `lib/sqa/backtest.rb:12`
122
+
123
+ ---
124
+
125
+ ### `#total_trades()`
126
+
127
+ Returns the value of attribute total_trades.
128
+
129
+
130
+
131
+
132
+ ??? info "Source Location"
133
+ `lib/sqa/backtest.rb:12`
134
+
135
+ ---
136
+
137
+ ### `#total_trades=(value)`
138
+
139
+ Sets the attribute total_trades
140
+
141
+ !!! info "Parameters"
142
+
143
+ | Name | Type | Description |
144
+ |------|------|-------------|
145
+ | `value` | `Any` | the value to set the attribute total_trades to. |
146
+
147
+
148
+ ??? info "Source Location"
149
+ `lib/sqa/backtest.rb:12`
150
+
151
+ ---
152
+
153
+ ### `#winning_trades()`
154
+
155
+ Returns the value of attribute winning_trades.
156
+
157
+
158
+
159
+
160
+ ??? info "Source Location"
161
+ `lib/sqa/backtest.rb:12`
162
+
163
+ ---
164
+
165
+ ### `#winning_trades=(value)`
166
+
167
+ Sets the attribute winning_trades
168
+
169
+ !!! info "Parameters"
170
+
171
+ | Name | Type | Description |
172
+ |------|------|-------------|
173
+ | `value` | `Any` | the value to set the attribute winning_trades to. |
174
+
175
+
176
+ ??? info "Source Location"
177
+ `lib/sqa/backtest.rb:12`
178
+
179
+ ---
180
+
181
+ ### `#losing_trades()`
182
+
183
+ Returns the value of attribute losing_trades.
184
+
185
+
186
+
187
+
188
+ ??? info "Source Location"
189
+ `lib/sqa/backtest.rb:12`
190
+
191
+ ---
192
+
193
+ ### `#losing_trades=(value)`
194
+
195
+ Sets the attribute losing_trades
196
+
197
+ !!! info "Parameters"
198
+
199
+ | Name | Type | Description |
200
+ |------|------|-------------|
201
+ | `value` | `Any` | the value to set the attribute losing_trades to. |
202
+
203
+
204
+ ??? info "Source Location"
205
+ `lib/sqa/backtest.rb:12`
206
+
207
+ ---
208
+
209
+ ### `#win_rate()`
210
+
211
+ Returns the value of attribute win_rate.
212
+
213
+
214
+
215
+
216
+ ??? info "Source Location"
217
+ `lib/sqa/backtest.rb:12`
218
+
219
+ ---
220
+
221
+ ### `#win_rate=(value)`
222
+
223
+ Sets the attribute win_rate
224
+
225
+ !!! info "Parameters"
226
+
227
+ | Name | Type | Description |
228
+ |------|------|-------------|
229
+ | `value` | `Any` | the value to set the attribute win_rate to. |
230
+
231
+
232
+ ??? info "Source Location"
233
+ `lib/sqa/backtest.rb:12`
234
+
235
+ ---
236
+
237
+ ### `#average_win()`
238
+
239
+ Returns the value of attribute average_win.
240
+
241
+
242
+
243
+
244
+ ??? info "Source Location"
245
+ `lib/sqa/backtest.rb:12`
246
+
247
+ ---
248
+
249
+ ### `#average_win=(value)`
250
+
251
+ Sets the attribute average_win
252
+
253
+ !!! info "Parameters"
254
+
255
+ | Name | Type | Description |
256
+ |------|------|-------------|
257
+ | `value` | `Any` | the value to set the attribute average_win to. |
258
+
259
+
260
+ ??? info "Source Location"
261
+ `lib/sqa/backtest.rb:12`
262
+
263
+ ---
264
+
265
+ ### `#average_loss()`
266
+
267
+ Returns the value of attribute average_loss.
268
+
269
+
270
+
271
+
272
+ ??? info "Source Location"
273
+ `lib/sqa/backtest.rb:12`
274
+
275
+ ---
276
+
277
+ ### `#average_loss=(value)`
278
+
279
+ Sets the attribute average_loss
280
+
281
+ !!! info "Parameters"
282
+
283
+ | Name | Type | Description |
284
+ |------|------|-------------|
285
+ | `value` | `Any` | the value to set the attribute average_loss to. |
286
+
287
+
288
+ ??? info "Source Location"
289
+ `lib/sqa/backtest.rb:12`
290
+
291
+ ---
292
+
293
+ ### `#profit_factor()`
294
+
295
+ Returns the value of attribute profit_factor.
296
+
297
+
298
+
299
+
300
+ ??? info "Source Location"
301
+ `lib/sqa/backtest.rb:12`
302
+
303
+ ---
304
+
305
+ ### `#profit_factor=(value)`
306
+
307
+ Sets the attribute profit_factor
308
+
309
+ !!! info "Parameters"
310
+
311
+ | Name | Type | Description |
312
+ |------|------|-------------|
313
+ | `value` | `Any` | the value to set the attribute profit_factor to. |
314
+
315
+
316
+ ??? info "Source Location"
317
+ `lib/sqa/backtest.rb:12`
318
+
319
+ ---
320
+
321
+ ### `#start_date()`
322
+
323
+ Returns the value of attribute start_date.
324
+
325
+
326
+
327
+
328
+ ??? info "Source Location"
329
+ `lib/sqa/backtest.rb:12`
330
+
331
+ ---
332
+
333
+ ### `#start_date=(value)`
334
+
335
+ Sets the attribute start_date
336
+
337
+ !!! info "Parameters"
338
+
339
+ | Name | Type | Description |
340
+ |------|------|-------------|
341
+ | `value` | `Any` | the value to set the attribute start_date to. |
342
+
343
+
344
+ ??? info "Source Location"
345
+ `lib/sqa/backtest.rb:12`
346
+
347
+ ---
348
+
349
+ ### `#end_date()`
350
+
351
+ Returns the value of attribute end_date.
352
+
353
+
354
+
355
+
356
+ ??? info "Source Location"
357
+ `lib/sqa/backtest.rb:12`
358
+
359
+ ---
360
+
361
+ ### `#end_date=(value)`
362
+
363
+ Sets the attribute end_date
364
+
365
+ !!! info "Parameters"
366
+
367
+ | Name | Type | Description |
368
+ |------|------|-------------|
369
+ | `value` | `Any` | the value to set the attribute end_date to. |
370
+
371
+
372
+ ??? info "Source Location"
373
+ `lib/sqa/backtest.rb:12`
374
+
375
+ ---
376
+
377
+ ### `#initial_capital()`
378
+
379
+ Returns the value of attribute initial_capital.
380
+
381
+
382
+
383
+
384
+ ??? info "Source Location"
385
+ `lib/sqa/backtest.rb:12`
386
+
387
+ ---
388
+
389
+ ### `#initial_capital=(value)`
390
+
391
+ Sets the attribute initial_capital
392
+
393
+ !!! info "Parameters"
394
+
395
+ | Name | Type | Description |
396
+ |------|------|-------------|
397
+ | `value` | `Any` | the value to set the attribute initial_capital to. |
398
+
399
+
400
+ ??? info "Source Location"
401
+ `lib/sqa/backtest.rb:12`
402
+
403
+ ---
404
+
405
+ ### `#final_value()`
406
+
407
+ Returns the value of attribute final_value.
408
+
409
+
410
+
411
+
412
+ ??? info "Source Location"
413
+ `lib/sqa/backtest.rb:12`
414
+
415
+ ---
416
+
417
+ ### `#final_value=(value)`
418
+
419
+ Sets the attribute final_value
420
+
421
+ !!! info "Parameters"
422
+
423
+ | Name | Type | Description |
424
+ |------|------|-------------|
425
+ | `value` | `Any` | the value to set the attribute final_value to. |
426
+
427
+
428
+ ??? info "Source Location"
429
+ `lib/sqa/backtest.rb:12`
430
+
431
+ ---
432
+
433
+ ### `#initialize()`
434
+
435
+
436
+ !!! success "Returns"
437
+
438
+ **Type:** `Results`
439
+
440
+
441
+
442
+ a new instance of Results
443
+
444
+ ??? info "Source Location"
445
+ `lib/sqa/backtest.rb:17`
446
+
447
+ ---
448
+
449
+ ### `#to_h()`
450
+
451
+
452
+
453
+
454
+ ??? info "Source Location"
455
+ `lib/sqa/backtest.rb:31`
456
+
457
+ ---
458
+
459
+ ### `#summary()`
460
+
461
+
462
+
463
+
464
+ ??? info "Source Location"
465
+ `lib/sqa/backtest.rb:51`
466
+
467
+ ---
468
+
469
+ ## 📝 Attributes
470
+
471
+ ### 🔄 `total_return` <small>read/write</small>
472
+
473
+ Returns the value of attribute total_return.
474
+
475
+ ### 🔄 `annualized_return` <small>read/write</small>
476
+
477
+ Returns the value of attribute annualized_return.
478
+
479
+ ### 🔄 `sharpe_ratio` <small>read/write</small>
480
+
481
+ Returns the value of attribute sharpe_ratio.
482
+
483
+ ### 🔄 `max_drawdown` <small>read/write</small>
484
+
485
+ Returns the value of attribute max_drawdown.
486
+
487
+ ### 🔄 `total_trades` <small>read/write</small>
488
+
489
+ Returns the value of attribute total_trades.
490
+
491
+ ### 🔄 `winning_trades` <small>read/write</small>
492
+
493
+ Returns the value of attribute winning_trades.
494
+
495
+ ### 🔄 `losing_trades` <small>read/write</small>
496
+
497
+ Returns the value of attribute losing_trades.
498
+
499
+ ### 🔄 `win_rate` <small>read/write</small>
500
+
501
+ Returns the value of attribute win_rate.
502
+
503
+ ### 🔄 `average_win` <small>read/write</small>
504
+
505
+ Returns the value of attribute average_win.
506
+
507
+ ### 🔄 `average_loss` <small>read/write</small>
508
+
509
+ Returns the value of attribute average_loss.
510
+
511
+ ### 🔄 `profit_factor` <small>read/write</small>
512
+
513
+ Returns the value of attribute profit_factor.
514
+
515
+ ### 🔄 `start_date` <small>read/write</small>
516
+
517
+ Returns the value of attribute start_date.
518
+
519
+ ### 🔄 `end_date` <small>read/write</small>
520
+
521
+ Returns the value of attribute end_date.
522
+
523
+ ### 🔄 `initial_capital` <small>read/write</small>
524
+
525
+ Returns the value of attribute initial_capital.
526
+
527
+ ### 🔄 `final_value` <small>read/write</small>
528
+
529
+ Returns the value of attribute final_value.
530
+
@@ -0,0 +1,13 @@
1
+ # 📦 SQA::BadParameterError
2
+
3
+ !!! note "Description"
4
+ Raised when a method parameter is invalid.
5
+ Inherits from ArgumentError for semantic clarity.
6
+
7
+ !!! abstract "Source Information"
8
+ **Defined in:** `lib/sqa/errors.rb:54`
9
+
10
+ **Inherits from:** `ArgumentError`
11
+
12
+ ## 📝 Attributes
13
+