sqa 0.0.32 → 0.0.38

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +154 -1
  3. data/README.md +4 -0
  4. data/Rakefile +52 -10
  5. data/docs/advanced/index.md +1 -13
  6. data/docs/api/index.md +547 -61
  7. data/docs/api-reference/alphavantageapi.md +1057 -0
  8. data/docs/api-reference/apierror.md +31 -0
  9. data/docs/api-reference/index.md +221 -0
  10. data/docs/api-reference/notimplemented.md +27 -0
  11. data/docs/api-reference/sqa.md +267 -0
  12. data/docs/api-reference/sqa_backtest.md +171 -0
  13. data/docs/api-reference/sqa_backtest_results.md +530 -0
  14. data/docs/api-reference/sqa_badparametererror.md +13 -0
  15. data/docs/api-reference/sqa_config.md +538 -0
  16. data/docs/api-reference/sqa_configurationerror.md +13 -0
  17. data/docs/api-reference/sqa_datafetcherror.md +56 -0
  18. data/docs/api-reference/sqa_dataframe.md +779 -0
  19. data/docs/api-reference/sqa_dataframe_alphavantage.md +30 -0
  20. data/docs/api-reference/sqa_dataframe_data.md +325 -0
  21. data/docs/api-reference/sqa_dataframe_yahoofinance.md +25 -0
  22. data/docs/api-reference/sqa_ensemble.md +413 -0
  23. data/docs/api-reference/sqa_fpop.md +211 -0
  24. data/docs/api-reference/sqa_geneticprogram.md +325 -0
  25. data/docs/api-reference/sqa_geneticprogram_individual.md +114 -0
  26. data/docs/api-reference/sqa_marketregime.md +212 -0
  27. data/docs/api-reference/sqa_multitimeframe.md +227 -0
  28. data/docs/api-reference/sqa_patternmatcher.md +195 -0
  29. data/docs/api-reference/sqa_pluginmanager.md +55 -0
  30. data/docs/api-reference/sqa_portfolio.md +512 -0
  31. data/docs/api-reference/sqa_portfolio_position.md +220 -0
  32. data/docs/api-reference/sqa_portfolio_trade.md +332 -0
  33. data/docs/api-reference/sqa_portfoliooptimizer.md +248 -0
  34. data/docs/api-reference/sqa_riskmanager.md +388 -0
  35. data/docs/api-reference/sqa_seasonalanalyzer.md +121 -0
  36. data/docs/api-reference/sqa_sectoranalyzer.md +163 -0
  37. data/docs/api-reference/sqa_stock.md +661 -0
  38. data/docs/api-reference/sqa_strategy.md +178 -0
  39. data/docs/api-reference/sqa_strategy_bollingerbands.md +26 -0
  40. data/docs/api-reference/sqa_strategy_common.md +29 -0
  41. data/docs/api-reference/sqa_strategy_consensus.md +129 -0
  42. data/docs/api-reference/sqa_strategy_ema.md +41 -0
  43. data/docs/api-reference/sqa_strategy_kbs.md +154 -0
  44. data/docs/api-reference/sqa_strategy_macd.md +26 -0
  45. data/docs/api-reference/sqa_strategy_mp.md +41 -0
  46. data/docs/api-reference/sqa_strategy_mr.md +41 -0
  47. data/docs/api-reference/sqa_strategy_random.md +41 -0
  48. data/docs/api-reference/sqa_strategy_rsi.md +41 -0
  49. data/docs/api-reference/sqa_strategy_sma.md +41 -0
  50. data/docs/api-reference/sqa_strategy_stochastic.md +26 -0
  51. data/docs/api-reference/sqa_strategy_volumebreakout.md +26 -0
  52. data/docs/api-reference/sqa_strategygenerator.md +298 -0
  53. data/docs/api-reference/sqa_strategygenerator_pattern.md +264 -0
  54. data/docs/api-reference/sqa_strategygenerator_patterncontext.md +326 -0
  55. data/docs/api-reference/sqa_strategygenerator_profitablepoint.md +424 -0
  56. data/docs/api-reference/sqa_stream.md +256 -0
  57. data/docs/api-reference/sqa_ticker.md +175 -0
  58. data/docs/api-reference/string.md +135 -0
  59. data/docs/assets/images/advanced-workflow.svg +89 -0
  60. data/docs/assets/images/architecture.svg +107 -0
  61. data/docs/assets/images/data-flow.svg +138 -0
  62. data/docs/assets/images/getting-started-workflow.svg +88 -0
  63. data/docs/assets/images/strategy-flow.svg +78 -0
  64. data/docs/assets/images/system-architecture.svg +150 -0
  65. data/docs/concepts/index.md +292 -19
  66. data/docs/file_formats.md +250 -0
  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/backtest.rb +32 -0
  76. data/lib/sqa/config.rb +109 -28
  77. data/lib/sqa/data_frame/data.rb +13 -1
  78. data/lib/sqa/data_frame.rb +193 -26
  79. data/lib/sqa/errors.rb +79 -17
  80. data/lib/sqa/init.rb +70 -15
  81. data/lib/sqa/pattern_matcher.rb +4 -4
  82. data/lib/sqa/portfolio.rb +55 -1
  83. data/lib/sqa/sector_analyzer.rb +3 -11
  84. data/lib/sqa/stock.rb +180 -15
  85. data/lib/sqa/strategy.rb +62 -4
  86. data/lib/sqa/ticker.rb +106 -48
  87. data/lib/sqa/version.rb +1 -1
  88. data/lib/sqa.rb +4 -4
  89. data/mkdocs.yml +69 -81
  90. metadata +89 -21
  91. data/docs/README.md +0 -43
  92. data/examples/sinatra_app/Gemfile +0 -42
  93. data/examples/sinatra_app/Gemfile.lock +0 -268
  94. data/examples/sinatra_app/QUICKSTART.md +0 -169
  95. data/examples/sinatra_app/README.md +0 -471
  96. data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +0 -90
  97. data/examples/sinatra_app/TROUBLESHOOTING.md +0 -95
  98. data/examples/sinatra_app/app.rb +0 -404
  99. data/examples/sinatra_app/config.ru +0 -5
  100. data/examples/sinatra_app/public/css/style.css +0 -723
  101. data/examples/sinatra_app/public/debug_macd.html +0 -82
  102. data/examples/sinatra_app/public/js/app.js +0 -107
  103. data/examples/sinatra_app/start.sh +0 -53
  104. data/examples/sinatra_app/views/analyze.erb +0 -306
  105. data/examples/sinatra_app/views/backtest.erb +0 -325
  106. data/examples/sinatra_app/views/dashboard.erb +0 -831
  107. data/examples/sinatra_app/views/error.erb +0 -58
  108. data/examples/sinatra_app/views/index.erb +0 -118
  109. data/examples/sinatra_app/views/layout.erb +0 -61
  110. data/examples/sinatra_app/views/portfolio.erb +0 -43
@@ -0,0 +1,326 @@
1
+ # 📦 SQA::StrategyGenerator::PatternContext
2
+
3
+ !!! note "Description"
4
+ Pattern Context - metadata about when/where pattern is valid
5
+
6
+ !!! abstract "Source Information"
7
+ **Defined in:** [`lib/sqa/strategy_generator.rb:91`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L91)
8
+
9
+ **Inherits from:** `Object`
10
+
11
+ ## 🔨 Instance Methods
12
+
13
+ ### `#market_regime()`
14
+
15
+ Returns the value of attribute market_regime.
16
+
17
+
18
+
19
+
20
+ ??? info "Source Location"
21
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
22
+
23
+ ---
24
+
25
+ ### `#market_regime=(value)`
26
+
27
+ Sets the attribute market_regime
28
+
29
+ !!! info "Parameters"
30
+
31
+ | Name | Type | Description |
32
+ |------|------|-------------|
33
+ | `value` | `Any` | the value to set the attribute market_regime to. |
34
+
35
+
36
+ ??? info "Source Location"
37
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
38
+
39
+ ---
40
+
41
+ ### `#valid_months()`
42
+
43
+ Returns the value of attribute valid_months.
44
+
45
+
46
+
47
+
48
+ ??? info "Source Location"
49
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
50
+
51
+ ---
52
+
53
+ ### `#valid_months=(value)`
54
+
55
+ Sets the attribute valid_months
56
+
57
+ !!! info "Parameters"
58
+
59
+ | Name | Type | Description |
60
+ |------|------|-------------|
61
+ | `value` | `Any` | the value to set the attribute valid_months to. |
62
+
63
+
64
+ ??? info "Source Location"
65
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
66
+
67
+ ---
68
+
69
+ ### `#valid_quarters()`
70
+
71
+ Returns the value of attribute valid_quarters.
72
+
73
+
74
+
75
+
76
+ ??? info "Source Location"
77
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
78
+
79
+ ---
80
+
81
+ ### `#valid_quarters=(value)`
82
+
83
+ Sets the attribute valid_quarters
84
+
85
+ !!! info "Parameters"
86
+
87
+ | Name | Type | Description |
88
+ |------|------|-------------|
89
+ | `value` | `Any` | the value to set the attribute valid_quarters to. |
90
+
91
+
92
+ ??? info "Source Location"
93
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
94
+
95
+ ---
96
+
97
+ ### `#discovered_period()`
98
+
99
+ Returns the value of attribute discovered_period.
100
+
101
+
102
+
103
+
104
+ ??? info "Source Location"
105
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
106
+
107
+ ---
108
+
109
+ ### `#discovered_period=(value)`
110
+
111
+ Sets the attribute discovered_period
112
+
113
+ !!! info "Parameters"
114
+
115
+ | Name | Type | Description |
116
+ |------|------|-------------|
117
+ | `value` | `Any` | the value to set the attribute discovered_period to. |
118
+
119
+
120
+ ??? info "Source Location"
121
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
122
+
123
+ ---
124
+
125
+ ### `#validation_period()`
126
+
127
+ Returns the value of attribute validation_period.
128
+
129
+
130
+
131
+
132
+ ??? info "Source Location"
133
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
134
+
135
+ ---
136
+
137
+ ### `#validation_period=(value)`
138
+
139
+ Sets the attribute validation_period
140
+
141
+ !!! info "Parameters"
142
+
143
+ | Name | Type | Description |
144
+ |------|------|-------------|
145
+ | `value` | `Any` | the value to set the attribute validation_period to. |
146
+
147
+
148
+ ??? info "Source Location"
149
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
150
+
151
+ ---
152
+
153
+ ### `#stability_score()`
154
+
155
+ Returns the value of attribute stability_score.
156
+
157
+
158
+
159
+
160
+ ??? info "Source Location"
161
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
162
+
163
+ ---
164
+
165
+ ### `#stability_score=(value)`
166
+
167
+ Sets the attribute stability_score
168
+
169
+ !!! info "Parameters"
170
+
171
+ | Name | Type | Description |
172
+ |------|------|-------------|
173
+ | `value` | `Any` | the value to set the attribute stability_score to. |
174
+
175
+
176
+ ??? info "Source Location"
177
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
178
+
179
+ ---
180
+
181
+ ### `#sector()`
182
+
183
+ Returns the value of attribute sector.
184
+
185
+
186
+
187
+
188
+ ??? info "Source Location"
189
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
190
+
191
+ ---
192
+
193
+ ### `#sector=(value)`
194
+
195
+ Sets the attribute sector
196
+
197
+ !!! info "Parameters"
198
+
199
+ | Name | Type | Description |
200
+ |------|------|-------------|
201
+ | `value` | `Any` | the value to set the attribute sector to. |
202
+
203
+
204
+ ??? info "Source Location"
205
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
206
+
207
+ ---
208
+
209
+ ### `#volatility_regime()`
210
+
211
+ Returns the value of attribute volatility_regime.
212
+
213
+
214
+
215
+
216
+ ??? info "Source Location"
217
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
218
+
219
+ ---
220
+
221
+ ### `#volatility_regime=(value)`
222
+
223
+ Sets the attribute volatility_regime
224
+
225
+ !!! info "Parameters"
226
+
227
+ | Name | Type | Description |
228
+ |------|------|-------------|
229
+ | `value` | `Any` | the value to set the attribute volatility_regime to. |
230
+
231
+
232
+ ??? info "Source Location"
233
+ [`lib/sqa/strategy_generator.rb:92`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L92)
234
+
235
+ ---
236
+
237
+ ### `#initialize()`
238
+
239
+
240
+ !!! success "Returns"
241
+
242
+ **Type:** `PatternContext`
243
+
244
+
245
+
246
+ a new instance of PatternContext
247
+
248
+ ??? info "Source Location"
249
+ [`lib/sqa/strategy_generator.rb:96`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L96)
250
+
251
+ ---
252
+
253
+ ### `#valid?()`
254
+
255
+
256
+ !!! success "Returns"
257
+
258
+ **Type:** `Boolean`
259
+
260
+
261
+
262
+ ??? info "Source Location"
263
+ [`lib/sqa/strategy_generator.rb:107`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L107)
264
+
265
+ ---
266
+
267
+ ### `#summary()`
268
+
269
+
270
+
271
+
272
+ ??? info "Source Location"
273
+ [`lib/sqa/strategy_generator.rb:111`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L111)
274
+
275
+ ---
276
+
277
+ ### `#valid_for?(date: = nil, regime: = nil, sector: = nil)`
278
+
279
+ Check if pattern is valid for given date and conditions
280
+
281
+
282
+ !!! success "Returns"
283
+
284
+ **Type:** `Boolean`
285
+
286
+
287
+
288
+ ??? info "Source Location"
289
+ [`lib/sqa/strategy_generator.rb:121`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L121)
290
+
291
+ ---
292
+
293
+ ## 📝 Attributes
294
+
295
+ ### 🔄 `market_regime` <small>read/write</small>
296
+
297
+ Returns the value of attribute market_regime.
298
+
299
+ ### 🔄 `valid_months` <small>read/write</small>
300
+
301
+ Returns the value of attribute valid_months.
302
+
303
+ ### 🔄 `valid_quarters` <small>read/write</small>
304
+
305
+ Returns the value of attribute valid_quarters.
306
+
307
+ ### 🔄 `discovered_period` <small>read/write</small>
308
+
309
+ Returns the value of attribute discovered_period.
310
+
311
+ ### 🔄 `validation_period` <small>read/write</small>
312
+
313
+ Returns the value of attribute validation_period.
314
+
315
+ ### 🔄 `stability_score` <small>read/write</small>
316
+
317
+ Returns the value of attribute stability_score.
318
+
319
+ ### 🔄 `sector` <small>read/write</small>
320
+
321
+ Returns the value of attribute sector.
322
+
323
+ ### 🔄 `volatility_regime` <small>read/write</small>
324
+
325
+ Returns the value of attribute volatility_regime.
326
+