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
data/lib/sqa.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # lib/sqa.rb
2
2
  # frozen_string_literal: true
3
3
 
4
- # TODO: Create a new gem for the dumbstockapi website
4
+ # NOTE: The dumbstockapi integration is handled by SQA::Ticker class.
5
+ # A separate gem could be created if more extensive API coverage is needed.
5
6
 
6
7
  #############################################
7
8
  ## Standard Libraries
@@ -13,20 +14,27 @@ unless defined?(HOME)
13
14
  HOME = Pathname.new(ENV['HOME'])
14
15
  end
15
16
 
16
- # TODO: do we want to move the debug_me gem out of the
17
- # development dependencies into the required?
18
- #
17
+ # NOTE: debug_me is optional - loaded if available, otherwise a no-op is defined.
18
+ # This keeps it as a development dependency while allowing production use if installed.
19
19
  if defined?(DebugMe)
20
20
  unless respond_to?(:debug_me)
21
21
  include DebugMe
22
22
  end
23
+ $DEBUG_ME = true
23
24
  else
24
- require 'debug_me'
25
- include DebugMe
25
+ begin
26
+ require 'debug_me'
27
+ include DebugMe
28
+ $DEBUG_ME = true
29
+ rescue LoadError
30
+ # debug_me is optional - define a no-op if not available
31
+ def debug_me(tag = nil, &block)
32
+ # No-op when debug_me gem is not available
33
+ end
34
+ $DEBUG_ME = false
35
+ end
26
36
  end
27
37
 
28
- $DEBUG_ME = true
29
-
30
38
  #############################################
31
39
  ## Additional Libraries
32
40
 
data/mkdocs.yml CHANGED
@@ -3,7 +3,7 @@ site_name: SQA - Simple Qualitative Analysis
3
3
  site_description: A powerful Ruby library for stock market technical analysis and trading strategy development
4
4
  site_author: Dewayne VanHoozer
5
5
  site_url: https://madbomber.github.io/sqa
6
- copyright: Copyright © 2024 Dewayne VanHoozer
6
+ copyright: Copyright © 2025 Dewayne VanHoozer (CAUTION! This documentation was mostly written by a robot so it might be wrong.)
7
7
 
8
8
  # Repository information
9
9
  repo_name: madbomber/sqa
@@ -56,7 +56,6 @@ theme:
56
56
 
57
57
  # Table of contents
58
58
  - toc.follow
59
- - toc.integrate
60
59
 
61
60
  # Search
62
61
  - search.suggest
@@ -74,15 +73,11 @@ theme:
74
73
  - content.action.edit
75
74
  - content.action.view
76
75
 
77
- # Announce
78
- - announce.dismiss
79
-
80
76
  # Plugins
81
77
  plugins:
82
78
  - search:
83
79
  separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
84
- - tags:
85
- tags_file: tags.md
80
+ - tags
86
81
 
87
82
  # Extensions
88
83
  markdown_extensions:
@@ -97,7 +92,6 @@ markdown_extensions:
97
92
  - toc:
98
93
  permalink: true
99
94
  title: On this page
100
- toc_depth: 3
101
95
 
102
96
  # Python Markdown Extensions
103
97
  - pymdownx.arithmatex:
@@ -154,9 +148,6 @@ extra:
154
148
  link: https://rubygems.org/gems/sqa
155
149
  name: SQA on RubyGems
156
150
 
157
- version:
158
- provider: mike
159
-
160
151
  analytics:
161
152
  feedback:
162
153
  title: Was this page helpful?
@@ -175,114 +166,74 @@ extra:
175
166
  # Navigation
176
167
  nav:
177
168
  - Home: index.md
178
- - Getting Started:
179
- - getting-started/index.md
180
- - Installation: getting-started/installation.md
181
- - Quick Start: getting-started/quick-start.md
182
- - Configuration: getting-started/configuration.md
183
- - Console Usage: getting-started/console-usage.md
184
-
185
- - Core Concepts:
186
- - concepts/index.md
187
- - Stock Objects: concepts/stock.md
188
- - DataFrames: data_frame.md
189
- - Technical Indicators: concepts/indicators.md
190
- - Trading Strategies: strategy.md
191
-
192
- - Technical Indicators:
193
- - indicators/index.md
194
- - Overview: indicators.md
195
- - Moving Averages:
196
- - Simple Moving Average: simple_moving_average.md
197
- - Exponential Moving Average: exponential_moving_average.md
198
- - Weighted Moving Average: weighted_moving_average.md
199
- - Momentum Indicators:
200
- - RSI (Relative Strength Index): relative_strength_index.md
201
- - Momentum: momentum.md
202
- - Stochastic Oscillator: stochastic_oscillator.md
203
- - True Strength Index: true_strength_index.md
204
- - Volatility Indicators:
205
- - Bollinger Bands: bollinger_bands.md
206
- - Average True Range: average_true_range.md
207
- - True Range: true_range.md
208
- - Donchian Channel: donchian_channel.md
209
- - Trend Indicators:
210
- - MACD: moving_average_convergence_divergence.md
211
- - Market Profile: market_profile.md
212
- - Pattern Recognition:
213
- - Fibonacci Retracement: fibonacci_retracement.md
214
- - Peaks and Valleys: peaks_and_valleys.md
215
- - Candlestick Patterns: candlestick_pattern_recognizer.md
216
- - Double Top/Bottom: double_top_bottom_pattern.md
217
- - Head and Shoulders: head_and_shoulders_pattern.md
218
169
 
219
- - Trading Strategies:
220
- - strategies/index.md
221
- - Built-in Strategies:
222
- - Bollinger Bands Strategy: strategies/bollinger-bands.md
223
- - RSI Strategy: strategies/rsi.md
224
- - MACD Strategy: strategies/macd.md
225
- - SMA Strategy: strategies/sma.md
226
- - EMA Strategy: strategies/ema.md
227
- - Stochastic Strategy: strategies/stochastic.md
228
- - Volume Breakout: strategies/volume-breakout.md
229
- - Mean Reversion: strategies/mean-reversion.md
230
- - Market Profile: strategies/market-profile.md
231
- - Consensus Strategy: strategies/consensus.md
232
- - Advanced Strategies:
233
- - Knowledge-Based Strategy (KBS): strategies/kbs.md
234
- - Custom Strategies: strategies/custom.md
235
-
236
- - Advanced Features:
237
- - advanced/index.md
238
- - Portfolio Management: advanced/portfolio.md
239
- - Backtesting: advanced/backtesting.md
240
- - Strategy Generator: advanced/strategy-generator.md
241
- - Genetic Programming: genetic_programming.md
242
- - Real-Time Streaming: advanced/streaming.md
243
- - FPOP Analysis: advanced/fpop.md
244
- - Risk Management: advanced/risk-management.md
245
- - Portfolio Optimizer: advanced/portfolio-optimizer.md
246
- - Ensemble Strategies: advanced/ensemble.md
247
- - Multi-Timeframe Analysis: advanced/multi-timeframe.md
248
- - Pattern Matcher: advanced/pattern-matcher.md
249
-
250
- - AI & Machine Learning:
251
- - ai_and_ml.md
252
- - Predict Next Value: predict_next_value.md
253
- - Identify Wave Condition: identify_wave_condition.md
254
- - LIBSVM Format: libsvm_file_format.md
170
+ - Getting Started:
171
+ - Overview: getting-started/index.md
172
+ - Installation: getting-started/installation.md
173
+ - Quick Start: getting-started/quick-start.md
174
+
175
+ - User Guide:
176
+ - Core Concepts:
177
+ - Overview: concepts/index.md
178
+ - DataFrames: data_frame.md
179
+ - Trading Strategies: strategy.md
180
+ - Technical Indicators:
181
+ - Overview: indicators/index.md
182
+ - Indicator Details: indicators.md
183
+ - sqa-tai Gem: https://github.com/MadBomber/sqa-tai
184
+ - TA-Lib Documentation: https://ta-lib.org/
185
+ - Trading Strategies:
186
+ - Overview: strategies/index.md
187
+ - Built-in Strategies:
188
+ - Bollinger Bands: strategies/bollinger-bands.md
189
+ - RSI Strategy: strategies/rsi.md
190
+ - MACD Strategy: strategies/macd.md
191
+ - SMA Strategy: strategies/sma.md
192
+ - EMA Strategy: strategies/ema.md
193
+ - Stochastic: strategies/stochastic.md
194
+ - Volume Breakout: strategies/volume-breakout.md
195
+ - Mean Reversion: strategies/mean-reversion.md
196
+ - Market Profile: strategies/market-profile.md
197
+ - Consensus: strategies/consensus.md
198
+ - Advanced Strategies:
199
+ - KBS Strategy: strategies/kbs.md
200
+ - Custom Strategies: strategies/custom.md
201
+ - Data Sources:
202
+ - Overview: data-sources/index.md
203
+
204
+ - Advanced:
205
+ - Overview: advanced/index.md
206
+ - Portfolio Management: advanced/portfolio.md
207
+ - Backtesting: advanced/backtesting.md
208
+ - Strategy Generator: advanced/strategy-generator.md
209
+ - Genetic Programming: genetic_programming.md
210
+ - Real-Time Streaming: advanced/streaming.md
211
+ - FPOP Analysis: advanced/fpop.md
212
+ - Risk Management: advanced/risk-management.md
213
+ - Portfolio Optimizer: advanced/portfolio-optimizer.md
214
+ - Ensemble Strategies: advanced/ensemble.md
215
+ - Multi-Timeframe: advanced/multi-timeframe.md
216
+ - Pattern Matcher: advanced/pattern-matcher.md
217
+ - AI & Machine Learning:
218
+ - Overview: ai_and_ml.md
219
+ - Mean Reversion: mean_reversion.md
220
+ - Predict Next Value: predict_next_value.md
221
+ - Wave Condition: identify_wave_condition.md
222
+ - LIBSVM Format: libsvm_file_format.md
255
223
 
256
224
  - API Reference:
257
- - api/index.md
258
- - SQA Module: api/sqa.md
259
- - Stock Class: api/stock.md
260
- - DataFrame Class: api/dataframe.md
261
- - Strategy Framework: api/strategy.md
262
- - Portfolio Class: api/portfolio.md
263
- - Backtest Class: api/backtest.md
264
- - Stream Class: api/stream.md
265
-
266
- - Data Sources:
267
- - data-sources/index.md
268
- - Alpha Vantage: alpha_vantage_technical_indicators.md
269
- - Data Format: data-sources/format.md
270
- - Custom Data: data-sources/custom.md
225
+ - Overview: api/index.md
226
+ - DataFrame Class: api/dataframe.md
227
+ - Complete API Reference: api-reference/index.md
271
228
 
272
229
  - Resources:
273
- - Tags: tags.md
274
- - Requirements: requirements.md
275
- - Terms of Use: terms_of_use.md
276
- - Trading Ideas: i_gotta_an_idea.md
277
- - Factor Analysis: factors_that_impact_price.md
278
- - External Tools:
279
- - TA-Lib: ta_lib.md
280
- - FinViz: finviz.md
281
- - FX Pro Bit: fx_pro_bit.md
282
- - Options Trading: options.md
283
-
284
- - Contributing:
285
- - contributing/index.md
286
- - Development Setup: contributing/setup.md
287
- - Testing: contributing/testing.md
288
- - Code Style: contributing/style.md
230
+ - Tags: tags.md
231
+ - Requirements: requirements.md
232
+ - Terms of Use: terms_of_use.md
233
+ - Trading Ideas: i_gotta_an_idea.md
234
+ - Factor Analysis: factors_that_impact_price.md
235
+ - External Tools:
236
+ - FinViz: finviz.md
237
+ - FX Pro Bit: fx_pro_bit.md
238
+ - Options Trading: options.md
239
+ - Contributing: contributing/index.md
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
@@ -345,6 +345,34 @@ dependencies:
345
345
  - - ">="
346
346
  - !ruby/object:Gem::Version
347
347
  version: '0'
348
+ - !ruby/object:Gem::Dependency
349
+ name: yard
350
+ requirement: !ruby/object:Gem::Requirement
351
+ requirements:
352
+ - - ">="
353
+ - !ruby/object:Gem::Version
354
+ version: '0'
355
+ type: :development
356
+ prerelease: false
357
+ version_requirements: !ruby/object:Gem::Requirement
358
+ requirements:
359
+ - - ">="
360
+ - !ruby/object:Gem::Version
361
+ version: '0'
362
+ - !ruby/object:Gem::Dependency
363
+ name: yard-markdown
364
+ requirement: !ruby/object:Gem::Requirement
365
+ requirements:
366
+ - - ">="
367
+ - !ruby/object:Gem::Version
368
+ version: '0'
369
+ type: :development
370
+ prerelease: false
371
+ version_requirements: !ruby/object:Gem::Requirement
372
+ requirements:
373
+ - - ">="
374
+ - !ruby/object:Gem::Version
375
+ version: '0'
348
376
  description: |
349
377
  Simplistic playpen (e.g. not for serious use) for doing
350
378
  technical analysis of stock prices. Under Construction.
@@ -398,7 +426,7 @@ files:
398
426
  - data/talk_talk.json
399
427
  - develop_summary.md
400
428
  - docs/.gitignore
401
- - docs/README.md
429
+ - docs/IMPROVEMENT_PLAN.md
402
430
  - docs/advanced/backtesting.md
403
431
  - docs/advanced/ensemble.md
404
432
  - docs/advanced/fpop.md
@@ -411,47 +439,91 @@ files:
411
439
  - docs/advanced/strategy-generator.md
412
440
  - docs/advanced/streaming.md
413
441
  - docs/ai_and_ml.md
414
- - docs/alpha_vantage_technical_indicators.md
442
+ - docs/api-reference/alphavantageapi.md
443
+ - docs/api-reference/apierror.md
444
+ - docs/api-reference/index.md
445
+ - docs/api-reference/notimplemented.md
446
+ - docs/api-reference/sqa.md
447
+ - docs/api-reference/sqa_backtest.md
448
+ - docs/api-reference/sqa_backtest_results.md
449
+ - docs/api-reference/sqa_badparametererror.md
450
+ - docs/api-reference/sqa_config.md
451
+ - docs/api-reference/sqa_configurationerror.md
452
+ - docs/api-reference/sqa_datafetcherror.md
453
+ - docs/api-reference/sqa_dataframe.md
454
+ - docs/api-reference/sqa_dataframe_alphavantage.md
455
+ - docs/api-reference/sqa_dataframe_data.md
456
+ - docs/api-reference/sqa_dataframe_yahoofinance.md
457
+ - docs/api-reference/sqa_ensemble.md
458
+ - docs/api-reference/sqa_fpop.md
459
+ - docs/api-reference/sqa_geneticprogram.md
460
+ - docs/api-reference/sqa_geneticprogram_individual.md
461
+ - docs/api-reference/sqa_marketregime.md
462
+ - docs/api-reference/sqa_multitimeframe.md
463
+ - docs/api-reference/sqa_patternmatcher.md
464
+ - docs/api-reference/sqa_pluginmanager.md
465
+ - docs/api-reference/sqa_portfolio.md
466
+ - docs/api-reference/sqa_portfolio_position.md
467
+ - docs/api-reference/sqa_portfolio_trade.md
468
+ - docs/api-reference/sqa_portfoliooptimizer.md
469
+ - docs/api-reference/sqa_riskmanager.md
470
+ - docs/api-reference/sqa_seasonalanalyzer.md
471
+ - docs/api-reference/sqa_sectoranalyzer.md
472
+ - docs/api-reference/sqa_stock.md
473
+ - docs/api-reference/sqa_strategy.md
474
+ - docs/api-reference/sqa_strategy_bollingerbands.md
475
+ - docs/api-reference/sqa_strategy_common.md
476
+ - docs/api-reference/sqa_strategy_consensus.md
477
+ - docs/api-reference/sqa_strategy_ema.md
478
+ - docs/api-reference/sqa_strategy_kbs.md
479
+ - docs/api-reference/sqa_strategy_macd.md
480
+ - docs/api-reference/sqa_strategy_mp.md
481
+ - docs/api-reference/sqa_strategy_mr.md
482
+ - docs/api-reference/sqa_strategy_random.md
483
+ - docs/api-reference/sqa_strategy_rsi.md
484
+ - docs/api-reference/sqa_strategy_sma.md
485
+ - docs/api-reference/sqa_strategy_stochastic.md
486
+ - docs/api-reference/sqa_strategy_volumebreakout.md
487
+ - docs/api-reference/sqa_strategygenerator.md
488
+ - docs/api-reference/sqa_strategygenerator_pattern.md
489
+ - docs/api-reference/sqa_strategygenerator_patterncontext.md
490
+ - docs/api-reference/sqa_strategygenerator_profitablepoint.md
491
+ - docs/api-reference/sqa_stream.md
492
+ - docs/api-reference/sqa_ticker.md
493
+ - docs/api-reference/string.md
415
494
  - docs/api/dataframe.md
416
495
  - docs/api/index.md
417
496
  - docs/assets/css/custom.css
497
+ - docs/assets/images/advanced-workflow.svg
498
+ - docs/assets/images/architecture.svg
499
+ - docs/assets/images/data-flow.svg
500
+ - docs/assets/images/getting-started-workflow.svg
501
+ - docs/assets/images/sqa.jpg
502
+ - docs/assets/images/strategy-flow.svg
503
+ - docs/assets/images/system-architecture.svg
418
504
  - docs/assets/js/mathjax.js
419
- - docs/average_true_range.md
420
- - docs/bollinger_bands.md
421
- - docs/candlestick_pattern_recognizer.md
422
505
  - docs/concepts/index.md
423
506
  - docs/contributing/index.md
424
507
  - docs/data-sources/index.md
425
508
  - docs/data_frame.md
426
- - docs/donchian_channel.md
427
- - docs/double_top_bottom_pattern.md
428
- - docs/exponential_moving_average.md
429
509
  - docs/factors_that_impact_price.md
430
- - docs/fibonacci_retracement.md
431
510
  - docs/finviz.md
432
511
  - docs/fx_pro_bit.md
433
512
  - docs/genetic_programming.md
434
513
  - docs/getting-started/index.md
435
514
  - docs/getting-started/installation.md
436
515
  - docs/getting-started/quick-start.md
437
- - docs/head_and_shoulders_pattern.md
438
516
  - docs/i_gotta_an_idea.md
439
517
  - docs/identify_wave_condition.md
440
518
  - docs/index.md
441
519
  - docs/indicators.md
442
520
  - docs/indicators/index.md
443
521
  - docs/libsvm_file_format.md
444
- - docs/market_profile.md
522
+ - docs/llms.txt
445
523
  - docs/mean_reversion.md
446
- - docs/momentum.md
447
- - docs/moving_average_convergence_divergence.md
448
524
  - docs/options.md
449
- - docs/peaks_and_valleys.md
450
525
  - docs/predict_next_value.md
451
- - docs/relative_strength_index.md
452
526
  - docs/requirements.md
453
- - docs/simple_moving_average.md
454
- - docs/stochastic_oscillator.md
455
527
  - docs/strategies/bollinger-bands.md
456
528
  - docs/strategies/consensus.md
457
529
  - docs/strategies/custom.md
@@ -466,12 +538,8 @@ files:
466
538
  - docs/strategies/stochastic.md
467
539
  - docs/strategies/volume-breakout.md
468
540
  - docs/strategy.md
469
- - docs/ta_lib.md
470
541
  - docs/tags.md
471
542
  - docs/terms_of_use.md
472
- - docs/true_range.md
473
- - docs/true_strength_index.md
474
- - docs/weighted_moving_average.md
475
543
  - examples/README.md
476
544
  - examples/advanced_features_example.rb
477
545
  - examples/fpop_analysis_example.rb
@@ -503,20 +571,6 @@ files:
503
571
  - examples/rails_app/config/environment.rb
504
572
  - examples/rails_app/config/routes.rb
505
573
  - examples/realtime_stream_example.rb
506
- - examples/sinatra_app/Gemfile
507
- - examples/sinatra_app/QUICKSTART.md
508
- - examples/sinatra_app/README.md
509
- - examples/sinatra_app/app.rb
510
- - examples/sinatra_app/config.ru
511
- - examples/sinatra_app/public/css/style.css
512
- - examples/sinatra_app/public/js/app.js
513
- - examples/sinatra_app/views/analyze.erb
514
- - examples/sinatra_app/views/backtest.erb
515
- - examples/sinatra_app/views/dashboard.erb
516
- - examples/sinatra_app/views/error.erb
517
- - examples/sinatra_app/views/index.erb
518
- - examples/sinatra_app/views/layout.erb
519
- - examples/sinatra_app/views/portfolio.erb
520
574
  - examples/strategy_generator_example.rb
521
575
  - hsa_portfolio.csv
522
576
  - justfile
data/docs/README.md DELETED
@@ -1,43 +0,0 @@
1
- # README.md
2
-
3
- "Playing the market" has always felt like "playing roulette" at the casino - "you pays your money and you takes your chances". Some players are winners. Some are losers. But **the House Always Wins.**
4
-
5
- Before computers, swings in the market were caused by people. These days I believe that computers have more to do with it than public trader sentiment. One computer program can start a cascade of other computer programs selling or buying in a digital frenzy of trading chaos.
6
-
7
- There are supposed to be tripwires in the system that protect against such things.
8
-
9
- ## Recent Computer-caused Chaos
10
-
11
- I asked my AI assistant "do you know of any times when computer programs caused trading chaos in the stock market?"
12
-
13
- Yes, there have been several instances in history when computer programs have contributed to chaos in the stock market. Here are a few notable examples:
14
-
15
- 1. **Flash Crash, 2010:** On May 6, 2010, U.S. financial markets experienced a brief, severe, and rapidly-reversed drop in stock prices. The Dow Jones Industrial Average plunged by over 1,000 points in a matter of minutes, only to recover just as quickly. This event is known as the "Flash Crash". The crash was primarily blamed on high-frequency trading algorithms - computer programs that execute trades at incredibly high speeds.
16
-
17
- 2. **Knight Capital Group Incident, 2012:** On August 1, 2012, the company Knight Capital Group experienced a major malfunction in its automated trading software. The software executed trades worth $7 billion in about half an hour, causing Knight Capital's stock price to collapse and leading to a $440 million loss for the company.
18
-
19
- 3. **Facebook's IPO, 2012:** During the initial public offering of Facebook on May 18, 2012, the stock exchange NASDAQ experienced significant technical problems. The defective technology running NASDAQ’s trading software resulted in a delay of the start of trading and confusion over individual share orders, leading to a chaotic and disorderly start to Facebook's life as a public company.
20
-
21
- 4. **Swiss Franc Surge, 2015:** On January 15, 2015, the Swiss franc surged nearly 30% in a matter of minutes after the Swiss National Bank unexpectedly abolished a cap on the franc's value against the euro. Many automated trading systems were not equipped to handle this abrupt change, resulting in massive losses for many traders and companies.
22
-
23
- These events highlight the importance of careful design and rigorous testing for trading algorithms and software systems. They also demonstrate the potential for extreme market volatility in the face of unforeseen software failures or unexpected economic events.
24
-
25
- ## How to be a Winner
26
-
27
- **Knowledge is King** at the casino when playing blackjack, if you can count the cards without getting caught and killed, you can gain a very small advantage over the house. I was once given the advice to never trade a company that I did not know inside and out or in an industry in which I had no expertise. Basically the more you know about a company the better your chances of making a beneficial trade. I guess the extreme of that is being an insider; but there are laws against that right? Or is it like blackjack and you should just not get caught?
28
-
29
- Is it possible to "beat the system?" Lots of people have become wealthy selling books or services that purport to teach you how. They all contain the same or similar disclaimers:
30
-
31
- > Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Any trading in securities or other investments involves a risk of substantial losses.
32
- >
33
- > Before undertaking any trading program, you should consult a qualified financial professional. Please consider carefully whether such trading is suitable for you in light of your financial condition and ability to bear financial risks. **Under no circumstances shall we be liable** for any loss or damage you or anyone else incurs as a result of any trading or investment activity that you or anyone else engages in based on any information or material you receive through us or our services.
34
-
35
- Here's my favorite:
36
-
37
- > Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. In fact, there are frequently sharp differences between hypothetical performance results and actual results subsequently achieved by any particular trading program.
38
- >
39
- > One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk and no hypothetical trading record can completely account for the impact of financial risk in actual trading. For example the ability to withstand losses or to adhere to a particular trading program in spite of the trading losses are material points, which can also adversely affect trading results. There are numerous other factors related to the market in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all of which can adversely affect actual trading results.
40
-
41
- So it other words "you pays your money and you takes your chances."
42
-
43
- **The House Always Wins**
@@ -1,62 +0,0 @@
1
- # Alpha Vantage
2
- ## Technical Indicators
3
-
4
- The following technical indicators are available from Alpha Vantage
5
- using a free API key.
6
-
7
- | Acronym | Indicator Description |
8
- |-----------|----------------------------------------------------------|
9
- | AD | Accumulation/Distribution |
10
- | ADOSC | Accumulation/Distribution Oscillator |
11
- | ADX | Average Directional Index |
12
- | ADXR | Average Directional Movement Rating |
13
- | APO | Absolute Price Oscillator |
14
- | AROON | Aroon Indicator |
15
- | AROONOSC | Aroon Oscillator |
16
- | ATR | Average True Range |
17
- | BBANDS | Bollinger Bands |
18
- | BOP | Balance of Power |
19
- | CCI | Commodity Channel Index |
20
- | CMO | Chande Momentum Oscillator |
21
- | DEMA | Double Exponential Moving Average |
22
- | DX | Directional Movement Index |
23
- | EMA | Exponential Moving Average |
24
- | HT_DCPERIOD | Hilbert Transform - Dominant Cycle Period |
25
- | HT_DCPHASE | Hilbert Transform - Dominant Cycle Phase |
26
- | HT_PHASOR | Hilbert Transform - Phasor Components |
27
- | HT_SINE | Hilbert Transform - SineWave |
28
- | HT_TRENDLINE | Hilbert Transform - Instantaneous Trendline |
29
- | HT_TRENDMODE | Hilbert Transform - Trend vs Cycle Mode |
30
- | KAMA | Kaufman Adaptive Moving Average |
31
- | MACD | Moving Average Convergence Divergence |
32
- | MACDEXT | MACD with controllable MA type |
33
- | MAMA | MESA Adaptive Moving Average |
34
- | MFI | Money Flow Index |
35
- | MIDPOINT | MidPoint over period |
36
- | MIDPRICE | Midpoint Price over period |
37
- | MINUS_DI | Minus Directional Indicator |
38
- | MINUS_DM | Minus Directional Movement |
39
- | MOM | Momentum |
40
- | NATR | Normalized Average True Range |
41
- | OBV | On Balance Volume |
42
- | PLUS_DI | Plus Directional Indicator |
43
- | PLUS_DM | Plus Directional Movement |
44
- | PPO | Percentage Price Oscillator |
45
- | ROC | Rate of Change |
46
- | ROCR | Rate of Change Ratio |
47
- | RSI | Relative Strength Index |
48
- | SAR | Parabolic SAR |
49
- | SMA | Simple Moving Average |
50
- | STOCH | Stochastic Oscillator |
51
- | STOCHF | Stochastic Fast |
52
- | STOCHRSI | Stochastic Relative Strength Index |
53
- | T3 | Triple Exponential Moving Average (T3) |
54
- | TEMA | Triple Exponential Moving Average |
55
- | TRANGE | True Range |
56
- | TRIMA | Triangular Moving Average |
57
- | TRIX | 1-day Rate of Change of a Triple Smooth EMA |
58
- | ULTOSC | Ultimate Oscillator |
59
- | VWAP | Volume Weighted Average Price |
60
- | WILLR | Williams' %R |
61
- | WMA | Weighted Moving Average |
62
-
@@ -1,9 +0,0 @@
1
- # Average True Range (ATR)
2
-
3
- See: https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/atr
4
-
5
- The ATR is an indicator that calculates the average of the True Range values over a specified period. It provides a measure of the average volatility of a security over that period.
6
-
7
- The ATR is commonly used to assess the volatility of a security, identify potential trend reversals, and determine appropriate stop-loss levels. Higher ATR values indicate higher volatility, while lower ATR values indicate lower volatility.
8
-
9
- For example, a 14-day ATR would calculate the average of the True Range values over the past 14 trading days. Traders and analysts may use this indicator to set stop-loss levels based on the average volatility of the security.
@@ -1,15 +0,0 @@
1
-
2
-
3
- # Bollinger Bands
4
-
5
- This method takes in an array of historical prices for a stock, a period (the number of days to calculate the moving average and standard deviation over), and the number of standard deviations to use for the upper and lower Bollinger Bands. It uses the `moving_averages` method to calculate the moving average for the given period, and then calculates the standard deviation of the closing prices for each window of the given period. Finally, it calculates the upper and lower Bollinger Bands based on the moving average and standard deviation, and returns an array containing the upper and lower bands.
6
-
7
- The `num_std_dev` parameter in the Bollinger Bands method specifies the number of standard deviations to use for the upper and lower bands. The default value for this parameter can depend on the specific security being analyzed and the time period being used.
8
-
9
- A common default value for `num_std_dev` is 2, which corresponds to the standard deviation of the price data over the given time period. Using a value of 2 for `num_std_dev` will result in the upper and lower bands being placed at a distance of two standard deviations from the moving average.
10
-
11
- However, the optimal value for `num_std_dev` can vary depending on the volatility of the security being analyzed. For highly volatile securities, a larger value for `num_std_dev` may be more appropriate, while for less volatile securities, a smaller value may be more appropriate.
12
-
13
- Ultimately, the best default value for `num_std_dev` will depend on the specific use case and should be chosen based on the characteristics of the security being analyzed and the preferences of the analyst.
14
-
15
- The difference between the upper and lower bands can be an indicator of how volatile the stock is.
@@ -1,4 +0,0 @@
1
- # Candlestick Chart Pattern
2
-
3
- Recognizes common candlestick chart patterns in the given price data.
4
-
@@ -1,5 +0,0 @@
1
- # Donchian Channel
2
-
3
- In the domain of computer programming, a Donchian Channel is a technical analysis indicator used to identify potential breakouts and trend reversals in financial markets. It consists of three lines: the upper channel line, the lower channel line, and the middle line.
4
-
5
- The upper channel line is calculated by finding the highest high over a specified period of time, while the lower channel line is calculated by finding the lowest low over the same period. The middle line is simply the average of the upper and lower channel lines.
@@ -1,3 +0,0 @@
1
- # Double Top Double Bottom Pattern
2
-
3
- Checks if a "double top" or "double bottom" pattern is present in the given price data.
@@ -1,19 +0,0 @@
1
- # Exponential Moving Average (EMA)
2
-
3
- In financial analysis, the Exponential Moving Average (EMA) is a commonly used technical indicator that helps identify trends and smooth out price data. It is a type of moving average that gives more weight to recent prices, making it more responsive to recent price changes compared to other moving averages.
4
-
5
- The EMA is calculated by applying a smoothing factor (often represented as a percentage) to the previous EMA value and adding a weighted average of the current price. The smoothing factor determines the weight given to the most recent price data, with higher values giving more weight to recent prices.
6
-
7
- The EMA is used for various purposes in financial analysis, including:
8
-
9
- 1. Trend Identification: The EMA is often used to identify the direction and strength of a trend. When the current price is above the EMA, it suggests an uptrend, while a price below the EMA suggests a downtrend. Traders and investors may use the EMA crossover (when the price crosses above or below the EMA) as a signal to enter or exit positions.
10
-
11
- 2. Support and Resistance Levels: The EMA can act as dynamic support or resistance levels. In an uptrend, the EMA may provide support, and in a downtrend, it may act as resistance. Traders may use the EMA as a reference point for setting stop-loss orders or profit targets.
12
-
13
- 3. Price Reversals: The EMA can help identify potential price reversals. When the price deviates significantly from the EMA, it may indicate an overbought or oversold condition, suggesting a potential reversal in the near future. Traders may use this information to anticipate price reversals and adjust their trading strategies accordingly.
14
-
15
- 4. Volatility Assessment: The EMA can be used to assess market volatility. When the EMA is relatively flat, it suggests low volatility, while a steeply sloping EMA indicates higher volatility. Traders may adjust their trading strategies based on the level of volatility indicated by the EMA.
16
-
17
- It's important to note that the EMA is just one of many technical indicators used in financial analysis. It is often used in combination with other indicators, such as the Simple Moving Average (SMA), to gain a more comprehensive understanding of market trends and price movements.
18
-
19
- Traders and investors should consider their own trading strategies, risk tolerance, and timeframes when using the EMA or any other technical indicator for financial analysis. It's also recommended to backtest and validate any trading strategies before applying them in real-time trading.