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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +154 -1
- data/README.md +4 -0
- data/Rakefile +52 -10
- data/docs/advanced/index.md +1 -13
- 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 +171 -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 +779 -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 +512 -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 +661 -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/strategy-flow.svg +78 -0
- data/docs/assets/images/system-architecture.svg +150 -0
- data/docs/concepts/index.md +292 -19
- data/docs/file_formats.md +250 -0
- data/docs/getting-started/index.md +1 -14
- data/docs/index.md +26 -23
- data/docs/llms.txt +109 -0
- data/docs/strategies/kbs.md +15 -14
- 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/backtest.rb +32 -0
- data/lib/sqa/config.rb +109 -28
- data/lib/sqa/data_frame/data.rb +13 -1
- data/lib/sqa/data_frame.rb +193 -26
- data/lib/sqa/errors.rb +79 -17
- data/lib/sqa/init.rb +70 -15
- data/lib/sqa/pattern_matcher.rb +4 -4
- data/lib/sqa/portfolio.rb +55 -1
- data/lib/sqa/sector_analyzer.rb +3 -11
- data/lib/sqa/stock.rb +180 -15
- data/lib/sqa/strategy.rb +62 -4
- data/lib/sqa/ticker.rb +106 -48
- data/lib/sqa/version.rb +1 -1
- data/lib/sqa.rb +4 -4
- data/mkdocs.yml +69 -81
- metadata +89 -21
- data/docs/README.md +0 -43
- data/examples/sinatra_app/Gemfile +0 -42
- data/examples/sinatra_app/Gemfile.lock +0 -268
- data/examples/sinatra_app/QUICKSTART.md +0 -169
- data/examples/sinatra_app/README.md +0 -471
- data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +0 -90
- data/examples/sinatra_app/TROUBLESHOOTING.md +0 -95
- data/examples/sinatra_app/app.rb +0 -404
- data/examples/sinatra_app/config.ru +0 -5
- data/examples/sinatra_app/public/css/style.css +0 -723
- data/examples/sinatra_app/public/debug_macd.html +0 -82
- data/examples/sinatra_app/public/js/app.js +0 -107
- data/examples/sinatra_app/start.sh +0 -53
- 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 -831
- 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,424 @@
|
|
|
1
|
+
# 📦 SQA::StrategyGenerator::ProfitablePoint
|
|
2
|
+
|
|
3
|
+
!!! note "Description"
|
|
4
|
+
Represents a profitable trade opportunity discovered in historical data
|
|
5
|
+
|
|
6
|
+
!!! abstract "Source Information"
|
|
7
|
+
**Defined in:** [`lib/sqa/strategy_generator.rb:38`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L38)
|
|
8
|
+
|
|
9
|
+
**Inherits from:** `Object`
|
|
10
|
+
|
|
11
|
+
## 🔨 Instance Methods
|
|
12
|
+
|
|
13
|
+
### `#entry_index()`
|
|
14
|
+
|
|
15
|
+
Returns the value of attribute entry_index.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
??? info "Source Location"
|
|
21
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### `#entry_index=(value)`
|
|
26
|
+
|
|
27
|
+
Sets the attribute entry_index
|
|
28
|
+
|
|
29
|
+
!!! info "Parameters"
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
|------|------|-------------|
|
|
33
|
+
| `value` | `Any` | the value to set the attribute entry_index to. |
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
??? info "Source Location"
|
|
37
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### `#entry_price()`
|
|
42
|
+
|
|
43
|
+
Returns the value of attribute entry_price.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
??? info "Source Location"
|
|
49
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### `#entry_price=(value)`
|
|
54
|
+
|
|
55
|
+
Sets the attribute entry_price
|
|
56
|
+
|
|
57
|
+
!!! info "Parameters"
|
|
58
|
+
|
|
59
|
+
| Name | Type | Description |
|
|
60
|
+
|------|------|-------------|
|
|
61
|
+
| `value` | `Any` | the value to set the attribute entry_price to. |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
??? info "Source Location"
|
|
65
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### `#exit_index()`
|
|
70
|
+
|
|
71
|
+
Returns the value of attribute exit_index.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
??? info "Source Location"
|
|
77
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### `#exit_index=(value)`
|
|
82
|
+
|
|
83
|
+
Sets the attribute exit_index
|
|
84
|
+
|
|
85
|
+
!!! info "Parameters"
|
|
86
|
+
|
|
87
|
+
| Name | Type | Description |
|
|
88
|
+
|------|------|-------------|
|
|
89
|
+
| `value` | `Any` | the value to set the attribute exit_index to. |
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
??? info "Source Location"
|
|
93
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### `#exit_price()`
|
|
98
|
+
|
|
99
|
+
Returns the value of attribute exit_price.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
??? info "Source Location"
|
|
105
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### `#exit_price=(value)`
|
|
110
|
+
|
|
111
|
+
Sets the attribute exit_price
|
|
112
|
+
|
|
113
|
+
!!! info "Parameters"
|
|
114
|
+
|
|
115
|
+
| Name | Type | Description |
|
|
116
|
+
|------|------|-------------|
|
|
117
|
+
| `value` | `Any` | the value to set the attribute exit_price to. |
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
??? info "Source Location"
|
|
121
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### `#gain_percent()`
|
|
126
|
+
|
|
127
|
+
Returns the value of attribute gain_percent.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
??? info "Source Location"
|
|
133
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### `#gain_percent=(value)`
|
|
138
|
+
|
|
139
|
+
Sets the attribute gain_percent
|
|
140
|
+
|
|
141
|
+
!!! info "Parameters"
|
|
142
|
+
|
|
143
|
+
| Name | Type | Description |
|
|
144
|
+
|------|------|-------------|
|
|
145
|
+
| `value` | `Any` | the value to set the attribute gain_percent to. |
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
??? info "Source Location"
|
|
149
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### `#holding_days()`
|
|
154
|
+
|
|
155
|
+
Returns the value of attribute holding_days.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
??? info "Source Location"
|
|
161
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### `#holding_days=(value)`
|
|
166
|
+
|
|
167
|
+
Sets the attribute holding_days
|
|
168
|
+
|
|
169
|
+
!!! info "Parameters"
|
|
170
|
+
|
|
171
|
+
| Name | Type | Description |
|
|
172
|
+
|------|------|-------------|
|
|
173
|
+
| `value` | `Any` | the value to set the attribute holding_days to. |
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
??? info "Source Location"
|
|
177
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### `#indicators()`
|
|
182
|
+
|
|
183
|
+
Returns the value of attribute indicators.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
??? info "Source Location"
|
|
189
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### `#indicators=(value)`
|
|
194
|
+
|
|
195
|
+
Sets the attribute indicators
|
|
196
|
+
|
|
197
|
+
!!! info "Parameters"
|
|
198
|
+
|
|
199
|
+
| Name | Type | Description |
|
|
200
|
+
|------|------|-------------|
|
|
201
|
+
| `value` | `Any` | the value to set the attribute indicators to. |
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
??? info "Source Location"
|
|
205
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### `#fpl_min_delta()`
|
|
210
|
+
|
|
211
|
+
Returns the value of attribute fpl_min_delta.
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
??? info "Source Location"
|
|
217
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### `#fpl_min_delta=(value)`
|
|
222
|
+
|
|
223
|
+
Sets the attribute fpl_min_delta
|
|
224
|
+
|
|
225
|
+
!!! info "Parameters"
|
|
226
|
+
|
|
227
|
+
| Name | Type | Description |
|
|
228
|
+
|------|------|-------------|
|
|
229
|
+
| `value` | `Any` | the value to set the attribute fpl_min_delta to. |
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
??? info "Source Location"
|
|
233
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### `#fpl_max_delta()`
|
|
238
|
+
|
|
239
|
+
Returns the value of attribute fpl_max_delta.
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
??? info "Source Location"
|
|
245
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### `#fpl_max_delta=(value)`
|
|
250
|
+
|
|
251
|
+
Sets the attribute fpl_max_delta
|
|
252
|
+
|
|
253
|
+
!!! info "Parameters"
|
|
254
|
+
|
|
255
|
+
| Name | Type | Description |
|
|
256
|
+
|------|------|-------------|
|
|
257
|
+
| `value` | `Any` | the value to set the attribute fpl_max_delta to. |
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
??? info "Source Location"
|
|
261
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### `#fpl_risk()`
|
|
266
|
+
|
|
267
|
+
Returns the value of attribute fpl_risk.
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
??? info "Source Location"
|
|
273
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
### `#fpl_risk=(value)`
|
|
278
|
+
|
|
279
|
+
Sets the attribute fpl_risk
|
|
280
|
+
|
|
281
|
+
!!! info "Parameters"
|
|
282
|
+
|
|
283
|
+
| Name | Type | Description |
|
|
284
|
+
|------|------|-------------|
|
|
285
|
+
| `value` | `Any` | the value to set the attribute fpl_risk to. |
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
??? info "Source Location"
|
|
289
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### `#fpl_direction()`
|
|
294
|
+
|
|
295
|
+
Returns the value of attribute fpl_direction.
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
??? info "Source Location"
|
|
301
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
### `#fpl_direction=(value)`
|
|
306
|
+
|
|
307
|
+
Sets the attribute fpl_direction
|
|
308
|
+
|
|
309
|
+
!!! info "Parameters"
|
|
310
|
+
|
|
311
|
+
| Name | Type | Description |
|
|
312
|
+
|------|------|-------------|
|
|
313
|
+
| `value` | `Any` | the value to set the attribute fpl_direction to. |
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
??? info "Source Location"
|
|
317
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### `#fpl_magnitude()`
|
|
322
|
+
|
|
323
|
+
Returns the value of attribute fpl_magnitude.
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
??? info "Source Location"
|
|
329
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### `#fpl_magnitude=(value)`
|
|
334
|
+
|
|
335
|
+
Sets the attribute fpl_magnitude
|
|
336
|
+
|
|
337
|
+
!!! info "Parameters"
|
|
338
|
+
|
|
339
|
+
| Name | Type | Description |
|
|
340
|
+
|------|------|-------------|
|
|
341
|
+
| `value` | `Any` | the value to set the attribute fpl_magnitude to. |
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
??? info "Source Location"
|
|
345
|
+
[`lib/sqa/strategy_generator.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L39)
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### `#initialize(entry_index:, entry_price:, exit_index:, exit_price:, fpl_data: = nil)`
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
!!! success "Returns"
|
|
353
|
+
|
|
354
|
+
**Type:** `ProfitablePoint`
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
a new instance of ProfitablePoint
|
|
359
|
+
|
|
360
|
+
??? info "Source Location"
|
|
361
|
+
[`lib/sqa/strategy_generator.rb:43`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L43)
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
### `#to_s()`
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
??? info "Source Location"
|
|
371
|
+
[`lib/sqa/strategy_generator.rb:62`](https://github.com/madbomber/sqa/blob/main/lib/sqa/strategy_generator.rb#L62)
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 📝 Attributes
|
|
376
|
+
|
|
377
|
+
### 🔄 `entry_index` <small>read/write</small>
|
|
378
|
+
|
|
379
|
+
Returns the value of attribute entry_index.
|
|
380
|
+
|
|
381
|
+
### 🔄 `entry_price` <small>read/write</small>
|
|
382
|
+
|
|
383
|
+
Returns the value of attribute entry_price.
|
|
384
|
+
|
|
385
|
+
### 🔄 `exit_index` <small>read/write</small>
|
|
386
|
+
|
|
387
|
+
Returns the value of attribute exit_index.
|
|
388
|
+
|
|
389
|
+
### 🔄 `exit_price` <small>read/write</small>
|
|
390
|
+
|
|
391
|
+
Returns the value of attribute exit_price.
|
|
392
|
+
|
|
393
|
+
### 🔄 `gain_percent` <small>read/write</small>
|
|
394
|
+
|
|
395
|
+
Returns the value of attribute gain_percent.
|
|
396
|
+
|
|
397
|
+
### 🔄 `holding_days` <small>read/write</small>
|
|
398
|
+
|
|
399
|
+
Returns the value of attribute holding_days.
|
|
400
|
+
|
|
401
|
+
### 🔄 `indicators` <small>read/write</small>
|
|
402
|
+
|
|
403
|
+
Returns the value of attribute indicators.
|
|
404
|
+
|
|
405
|
+
### 🔄 `fpl_min_delta` <small>read/write</small>
|
|
406
|
+
|
|
407
|
+
Returns the value of attribute fpl_min_delta.
|
|
408
|
+
|
|
409
|
+
### 🔄 `fpl_max_delta` <small>read/write</small>
|
|
410
|
+
|
|
411
|
+
Returns the value of attribute fpl_max_delta.
|
|
412
|
+
|
|
413
|
+
### 🔄 `fpl_risk` <small>read/write</small>
|
|
414
|
+
|
|
415
|
+
Returns the value of attribute fpl_risk.
|
|
416
|
+
|
|
417
|
+
### 🔄 `fpl_direction` <small>read/write</small>
|
|
418
|
+
|
|
419
|
+
Returns the value of attribute fpl_direction.
|
|
420
|
+
|
|
421
|
+
### 🔄 `fpl_magnitude` <small>read/write</small>
|
|
422
|
+
|
|
423
|
+
Returns the value of attribute fpl_magnitude.
|
|
424
|
+
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# 📦 SQA::Stream
|
|
2
|
+
|
|
3
|
+
!!! abstract "Source Information"
|
|
4
|
+
**Defined in:** [`lib/sqa/stream.rb:39`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L39)
|
|
5
|
+
|
|
6
|
+
**Inherits from:** `Object`
|
|
7
|
+
|
|
8
|
+
## 🔨 Instance Methods
|
|
9
|
+
|
|
10
|
+
### `#ticker()`
|
|
11
|
+
|
|
12
|
+
Returns the value of attribute ticker.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
??? info "Source Location"
|
|
18
|
+
[`lib/sqa/stream.rb:40`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L40)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### `#window_size()`
|
|
23
|
+
|
|
24
|
+
Returns the value of attribute window_size.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
??? info "Source Location"
|
|
30
|
+
[`lib/sqa/stream.rb:40`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L40)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### `#strategies()`
|
|
35
|
+
|
|
36
|
+
Returns the value of attribute strategies.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
??? info "Source Location"
|
|
42
|
+
[`lib/sqa/stream.rb:40`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L40)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### `#data_buffer()`
|
|
47
|
+
|
|
48
|
+
Returns the value of attribute data_buffer.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
??? info "Source Location"
|
|
54
|
+
[`lib/sqa/stream.rb:40`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L40)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### `#indicator_cache()`
|
|
59
|
+
|
|
60
|
+
Returns the value of attribute indicator_cache.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
??? info "Source Location"
|
|
66
|
+
[`lib/sqa/stream.rb:40`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L40)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `#initialize(ticker:, window_size: = 100, strategies: = [])`
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
!!! success "Returns"
|
|
74
|
+
|
|
75
|
+
**Type:** `Stream`
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
a new instance of Stream
|
|
80
|
+
|
|
81
|
+
??? info "Source Location"
|
|
82
|
+
[`lib/sqa/stream.rb:42`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L42)
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### `#add_strategy(strategy)`
|
|
87
|
+
|
|
88
|
+
Add a strategy to the stream processor
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
??? info "Source Location"
|
|
94
|
+
[`lib/sqa/stream.rb:65`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L65)
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### `#on_signal(&block)`
|
|
99
|
+
|
|
100
|
+
Register callback for trading signals
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
stream.on_signal do |signal, data|
|
|
104
|
+
puts "#{signal.upcase} at $#{data[:price]}"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
??? info "Source Location"
|
|
111
|
+
[`lib/sqa/stream.rb:78`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L78)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### `#on_update(&block)`
|
|
116
|
+
|
|
117
|
+
Register callback for price updates
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
stream.on_update do |data|
|
|
121
|
+
puts "Price updated: $#{data[:price]}"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
??? info "Source Location"
|
|
128
|
+
[`lib/sqa/stream.rb:89`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L89)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### `#update(price:, volume: = nil, high: = nil, low: = nil, timestamp: = Time.now)`
|
|
133
|
+
|
|
134
|
+
Update stream with new market data
|
|
135
|
+
|
|
136
|
+
Required fields: price
|
|
137
|
+
Optional fields: volume, high, low, timestamp
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
??? info "Source Location"
|
|
143
|
+
[`lib/sqa/stream.rb:98`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L98)
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `#current_price()`
|
|
148
|
+
|
|
149
|
+
Get current price
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
??? info "Source Location"
|
|
155
|
+
[`lib/sqa/stream.rb:136`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L136)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### `#recent_prices(count = nil)`
|
|
160
|
+
|
|
161
|
+
Get recent prices
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
??? info "Source Location"
|
|
167
|
+
[`lib/sqa/stream.rb:141`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L141)
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### `#recent_volumes(count = nil)`
|
|
172
|
+
|
|
173
|
+
Get recent volumes
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
??? info "Source Location"
|
|
179
|
+
[`lib/sqa/stream.rb:148`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L148)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### `#indicator(name, **options)`
|
|
184
|
+
|
|
185
|
+
Calculate or retrieve cached indicator
|
|
186
|
+
|
|
187
|
+
Example:
|
|
188
|
+
rsi = stream.indicator(:rsi, period: 14)
|
|
189
|
+
sma = stream.indicator(:sma, period: 20)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
??? info "Source Location"
|
|
195
|
+
[`lib/sqa/stream.rb:159`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L159)
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### `#current_signal()`
|
|
200
|
+
|
|
201
|
+
Get current trading signal from last strategy execution
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
??? info "Source Location"
|
|
207
|
+
[`lib/sqa/stream.rb:177`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L177)
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### `#stats()`
|
|
212
|
+
|
|
213
|
+
Get statistics about the stream
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
??? info "Source Location"
|
|
219
|
+
[`lib/sqa/stream.rb:182`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L182)
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### `#reset()`
|
|
224
|
+
|
|
225
|
+
Reset the stream (clear all data)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
??? info "Source Location"
|
|
231
|
+
[`lib/sqa/stream.rb:199`](https://github.com/madbomber/sqa/blob/main/lib/sqa/stream.rb#L199)
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 📝 Attributes
|
|
236
|
+
|
|
237
|
+
### 👁️ `ticker` <small>read-only</small>
|
|
238
|
+
|
|
239
|
+
Returns the value of attribute ticker.
|
|
240
|
+
|
|
241
|
+
### 👁️ `window_size` <small>read-only</small>
|
|
242
|
+
|
|
243
|
+
Returns the value of attribute window_size.
|
|
244
|
+
|
|
245
|
+
### 👁️ `strategies` <small>read-only</small>
|
|
246
|
+
|
|
247
|
+
Returns the value of attribute strategies.
|
|
248
|
+
|
|
249
|
+
### 👁️ `data_buffer` <small>read-only</small>
|
|
250
|
+
|
|
251
|
+
Returns the value of attribute data_buffer.
|
|
252
|
+
|
|
253
|
+
### 👁️ `indicator_cache` <small>read-only</small>
|
|
254
|
+
|
|
255
|
+
Returns the value of attribute indicator_cache.
|
|
256
|
+
|