sqa 0.0.32 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -1
  3. data/README.md +4 -0
  4. data/Rakefile +52 -10
  5. data/docs/IMPROVEMENT_PLAN.md +531 -0
  6. data/docs/advanced/index.md +1 -13
  7. data/docs/api/index.md +547 -61
  8. data/docs/api-reference/alphavantageapi.md +1057 -0
  9. data/docs/api-reference/apierror.md +31 -0
  10. data/docs/api-reference/index.md +221 -0
  11. data/docs/api-reference/notimplemented.md +27 -0
  12. data/docs/api-reference/sqa.md +267 -0
  13. data/docs/api-reference/sqa_backtest.md +137 -0
  14. data/docs/api-reference/sqa_backtest_results.md +530 -0
  15. data/docs/api-reference/sqa_badparametererror.md +13 -0
  16. data/docs/api-reference/sqa_config.md +538 -0
  17. data/docs/api-reference/sqa_configurationerror.md +13 -0
  18. data/docs/api-reference/sqa_datafetcherror.md +56 -0
  19. data/docs/api-reference/sqa_dataframe.md +752 -0
  20. data/docs/api-reference/sqa_dataframe_alphavantage.md +30 -0
  21. data/docs/api-reference/sqa_dataframe_data.md +325 -0
  22. data/docs/api-reference/sqa_dataframe_yahoofinance.md +25 -0
  23. data/docs/api-reference/sqa_ensemble.md +413 -0
  24. data/docs/api-reference/sqa_fpop.md +211 -0
  25. data/docs/api-reference/sqa_geneticprogram.md +325 -0
  26. data/docs/api-reference/sqa_geneticprogram_individual.md +114 -0
  27. data/docs/api-reference/sqa_marketregime.md +212 -0
  28. data/docs/api-reference/sqa_multitimeframe.md +227 -0
  29. data/docs/api-reference/sqa_patternmatcher.md +195 -0
  30. data/docs/api-reference/sqa_pluginmanager.md +55 -0
  31. data/docs/api-reference/sqa_portfolio.md +455 -0
  32. data/docs/api-reference/sqa_portfolio_position.md +220 -0
  33. data/docs/api-reference/sqa_portfolio_trade.md +332 -0
  34. data/docs/api-reference/sqa_portfoliooptimizer.md +248 -0
  35. data/docs/api-reference/sqa_riskmanager.md +388 -0
  36. data/docs/api-reference/sqa_seasonalanalyzer.md +121 -0
  37. data/docs/api-reference/sqa_sectoranalyzer.md +163 -0
  38. data/docs/api-reference/sqa_stock.md +649 -0
  39. data/docs/api-reference/sqa_strategy.md +178 -0
  40. data/docs/api-reference/sqa_strategy_bollingerbands.md +26 -0
  41. data/docs/api-reference/sqa_strategy_common.md +29 -0
  42. data/docs/api-reference/sqa_strategy_consensus.md +129 -0
  43. data/docs/api-reference/sqa_strategy_ema.md +41 -0
  44. data/docs/api-reference/sqa_strategy_kbs.md +154 -0
  45. data/docs/api-reference/sqa_strategy_macd.md +26 -0
  46. data/docs/api-reference/sqa_strategy_mp.md +41 -0
  47. data/docs/api-reference/sqa_strategy_mr.md +41 -0
  48. data/docs/api-reference/sqa_strategy_random.md +41 -0
  49. data/docs/api-reference/sqa_strategy_rsi.md +41 -0
  50. data/docs/api-reference/sqa_strategy_sma.md +41 -0
  51. data/docs/api-reference/sqa_strategy_stochastic.md +26 -0
  52. data/docs/api-reference/sqa_strategy_volumebreakout.md +26 -0
  53. data/docs/api-reference/sqa_strategygenerator.md +298 -0
  54. data/docs/api-reference/sqa_strategygenerator_pattern.md +264 -0
  55. data/docs/api-reference/sqa_strategygenerator_patterncontext.md +326 -0
  56. data/docs/api-reference/sqa_strategygenerator_profitablepoint.md +424 -0
  57. data/docs/api-reference/sqa_stream.md +256 -0
  58. data/docs/api-reference/sqa_ticker.md +175 -0
  59. data/docs/api-reference/string.md +135 -0
  60. data/docs/assets/images/advanced-workflow.svg +89 -0
  61. data/docs/assets/images/architecture.svg +107 -0
  62. data/docs/assets/images/data-flow.svg +138 -0
  63. data/docs/assets/images/getting-started-workflow.svg +88 -0
  64. data/docs/assets/images/strategy-flow.svg +78 -0
  65. data/docs/assets/images/system-architecture.svg +150 -0
  66. data/docs/concepts/index.md +292 -19
  67. data/docs/getting-started/index.md +1 -14
  68. data/docs/index.md +26 -23
  69. data/docs/llms.txt +109 -0
  70. data/docs/strategies/kbs.md +15 -14
  71. data/docs/strategy.md +381 -3
  72. data/docs/terms_of_use.md +1 -1
  73. data/examples/README.md +10 -0
  74. data/lib/api/alpha_vantage_api.rb +3 -7
  75. data/lib/sqa/config.rb +109 -28
  76. data/lib/sqa/data_frame/data.rb +13 -1
  77. data/lib/sqa/data_frame.rb +168 -26
  78. data/lib/sqa/errors.rb +79 -17
  79. data/lib/sqa/init.rb +70 -15
  80. data/lib/sqa/pattern_matcher.rb +4 -4
  81. data/lib/sqa/portfolio.rb +1 -1
  82. data/lib/sqa/sector_analyzer.rb +3 -11
  83. data/lib/sqa/stock.rb +169 -15
  84. data/lib/sqa/strategy.rb +62 -4
  85. data/lib/sqa/ticker.rb +106 -48
  86. data/lib/sqa/version.rb +1 -1
  87. data/lib/sqa.rb +4 -4
  88. data/mkdocs.yml +68 -81
  89. metadata +89 -21
  90. data/docs/README.md +0 -43
  91. data/examples/sinatra_app/Gemfile +0 -42
  92. data/examples/sinatra_app/Gemfile.lock +0 -268
  93. data/examples/sinatra_app/QUICKSTART.md +0 -169
  94. data/examples/sinatra_app/README.md +0 -471
  95. data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +0 -90
  96. data/examples/sinatra_app/TROUBLESHOOTING.md +0 -95
  97. data/examples/sinatra_app/app.rb +0 -404
  98. data/examples/sinatra_app/config.ru +0 -5
  99. data/examples/sinatra_app/public/css/style.css +0 -723
  100. data/examples/sinatra_app/public/debug_macd.html +0 -82
  101. data/examples/sinatra_app/public/js/app.js +0 -107
  102. data/examples/sinatra_app/start.sh +0 -53
  103. data/examples/sinatra_app/views/analyze.erb +0 -306
  104. data/examples/sinatra_app/views/backtest.erb +0 -325
  105. data/examples/sinatra_app/views/dashboard.erb +0 -831
  106. data/examples/sinatra_app/views/error.erb +0 -58
  107. data/examples/sinatra_app/views/index.erb +0 -118
  108. data/examples/sinatra_app/views/layout.erb +0 -61
  109. data/examples/sinatra_app/views/portfolio.erb +0 -43
@@ -1,268 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- addressable (2.8.7)
5
- public_suffix (>= 2.0.2, < 7.0)
6
- alphavantage (1.2.0)
7
- faraday (~> 1.4)
8
- hashie (~> 4.1)
9
- base64 (0.3.0)
10
- bigdecimal (3.3.1)
11
- citrus (3.0.2)
12
- concurrent-ruby (1.3.5)
13
- connection_pool (2.5.4)
14
- csv (3.3.5)
15
- dentaku (3.5.6)
16
- bigdecimal
17
- concurrent-ruby
18
- eps (0.6.0)
19
- lightgbm (>= 0.1.7)
20
- matrix
21
- nokogiri
22
- event_stream_parser (1.0.0)
23
- faraday (1.10.4)
24
- faraday-em_http (~> 1.0)
25
- faraday-em_synchrony (~> 1.0)
26
- faraday-excon (~> 1.1)
27
- faraday-httpclient (~> 1.0)
28
- faraday-multipart (~> 1.0)
29
- faraday-net_http (~> 1.0)
30
- faraday-net_http_persistent (~> 1.0)
31
- faraday-patron (~> 1.0)
32
- faraday-rack (~> 1.0)
33
- faraday-retry (~> 1.0)
34
- ruby2_keywords (>= 0.0.4)
35
- faraday-em_http (1.0.0)
36
- faraday-em_synchrony (1.0.1)
37
- faraday-excon (1.1.0)
38
- faraday-httpclient (1.0.1)
39
- faraday-multipart (1.1.1)
40
- multipart-post (~> 2.0)
41
- faraday-net_http (1.0.2)
42
- faraday-net_http_persistent (1.2.0)
43
- faraday-patron (1.0.0)
44
- faraday-rack (1.0.0)
45
- faraday-retry (1.0.3)
46
- ffi (1.17.2)
47
- ffi (1.17.2-aarch64-linux-gnu)
48
- ffi (1.17.2-aarch64-linux-musl)
49
- ffi (1.17.2-arm-linux-gnu)
50
- ffi (1.17.2-arm-linux-musl)
51
- ffi (1.17.2-arm64-darwin)
52
- ffi (1.17.2-x86-linux-gnu)
53
- ffi (1.17.2-x86-linux-musl)
54
- ffi (1.17.2-x86_64-darwin)
55
- ffi (1.17.2-x86_64-linux-gnu)
56
- ffi (1.17.2-x86_64-linux-musl)
57
- fiddle (1.1.8)
58
- hashie (4.1.0)
59
- http-2 (1.1.1)
60
- httpx (1.6.3)
61
- http-2 (>= 1.0.0)
62
- json (2.16.0)
63
- json-schema (5.2.2)
64
- addressable (~> 2.8)
65
- bigdecimal (~> 3.1)
66
- kbs (0.1.0)
67
- sqlite3 (~> 1.6)
68
- lightgbm (0.4.3)
69
- ffi
70
- listen (3.9.0)
71
- rb-fsevent (~> 0.10, >= 0.10.3)
72
- rb-inotify (~> 0.9, >= 0.9.10)
73
- lite-memoize (1.1.1)
74
- lite-statistics (2.0.0)
75
- lite-memoize
76
- logger (1.7.0)
77
- marcel (1.1.0)
78
- matrix (0.4.3)
79
- mini_portile2 (2.8.9)
80
- multi_json (1.17.0)
81
- multipart-post (2.4.1)
82
- mustermann (3.0.4)
83
- ruby2_keywords (~> 0.0.1)
84
- nenv (0.3.0)
85
- nio4r (2.7.5)
86
- nokogiri (1.18.10)
87
- mini_portile2 (~> 2.8.2)
88
- racc (~> 1.4)
89
- nokogiri (1.18.10-aarch64-linux-gnu)
90
- racc (~> 1.4)
91
- nokogiri (1.18.10-aarch64-linux-musl)
92
- racc (~> 1.4)
93
- nokogiri (1.18.10-arm-linux-gnu)
94
- racc (~> 1.4)
95
- nokogiri (1.18.10-arm-linux-musl)
96
- racc (~> 1.4)
97
- nokogiri (1.18.10-arm64-darwin)
98
- racc (~> 1.4)
99
- nokogiri (1.18.10-x86_64-darwin)
100
- racc (~> 1.4)
101
- nokogiri (1.18.10-x86_64-linux-gnu)
102
- racc (~> 1.4)
103
- nokogiri (1.18.10-x86_64-linux-musl)
104
- racc (~> 1.4)
105
- openweathermap (0.2.3)
106
- pastel (0.8.0)
107
- tty-color (~> 0.5)
108
- polars-df (0.23.0)
109
- bigdecimal
110
- rb_sys
111
- polars-df (0.23.0-aarch64-linux)
112
- bigdecimal
113
- polars-df (0.23.0-aarch64-linux-musl)
114
- bigdecimal
115
- polars-df (0.23.0-arm64-darwin)
116
- bigdecimal
117
- polars-df (0.23.0-x86_64-darwin)
118
- bigdecimal
119
- polars-df (0.23.0-x86_64-linux)
120
- bigdecimal
121
- polars-df (0.23.0-x86_64-linux-musl)
122
- bigdecimal
123
- public_suffix (6.0.2)
124
- puma (6.6.1)
125
- nio4r (~> 2.0)
126
- racc (1.8.1)
127
- rack (3.2.4)
128
- rack-protection (4.2.1)
129
- base64 (>= 0.1.0)
130
- logger (>= 1.6.0)
131
- rack (>= 3.0.0, < 4)
132
- rack-session (2.1.1)
133
- base64 (>= 0.1.0)
134
- rack (>= 3.0.0)
135
- rackup (2.2.1)
136
- rack (>= 3)
137
- rake-compiler-dock (1.9.1)
138
- rb-fsevent (0.11.2)
139
- rb-inotify (0.11.1)
140
- ffi (~> 1.0)
141
- rb_sys (0.9.117)
142
- rake-compiler-dock (= 1.9.1)
143
- redis (5.4.1)
144
- redis-client (>= 0.22.0)
145
- redis-client (0.26.1)
146
- connection_pool
147
- regent (0.3.3)
148
- pastel (~> 0.8.0)
149
- tty-spinner (~> 0.9.3)
150
- zeitwerk (~> 2.7)
151
- rerun (0.14.0)
152
- listen (~> 3.0)
153
- ruby2_keywords (0.0.5)
154
- ruby_llm (1.9.1)
155
- base64
156
- event_stream_parser (~> 1)
157
- faraday (>= 1.10.0)
158
- faraday-multipart (>= 1)
159
- faraday-net_http (>= 1)
160
- faraday-retry (>= 1)
161
- marcel (~> 1.0)
162
- ruby_llm-schema (~> 0.2.1)
163
- zeitwerk (~> 2)
164
- ruby_llm-mcp (0.8.0)
165
- httpx (~> 1.4)
166
- json-schema (~> 5.0)
167
- ruby_llm (~> 1.9)
168
- zeitwerk (~> 2)
169
- ruby_llm-schema (0.2.4)
170
- sequel (5.98.0)
171
- bigdecimal
172
- shared_tools (0.3.0)
173
- dentaku
174
- nokogiri
175
- openweathermap
176
- ruby_llm
177
- ruby_llm-mcp
178
- sequel
179
- zeitwerk
180
- sinatra (4.2.1)
181
- logger (>= 1.6.0)
182
- mustermann (~> 3.0)
183
- rack (>= 3.0.0, < 4)
184
- rack-protection (= 4.2.1)
185
- rack-session (>= 2.0.0, < 3)
186
- tilt (~> 2.0)
187
- sinatra-contrib (4.2.1)
188
- multi_json (>= 0.0.2)
189
- mustermann (~> 3.0)
190
- rack-protection (= 4.2.1)
191
- sinatra (= 4.2.1)
192
- tilt (~> 2.0)
193
- sqa-tai (0.1.0)
194
- ta_lib_ffi (~> 0.3)
195
- sqlite3 (1.7.3)
196
- mini_portile2 (~> 2.8.0)
197
- sqlite3 (1.7.3-aarch64-linux)
198
- sqlite3 (1.7.3-arm-linux)
199
- sqlite3 (1.7.3-arm64-darwin)
200
- sqlite3 (1.7.3-x86-linux)
201
- sqlite3 (1.7.3-x86_64-darwin)
202
- sqlite3 (1.7.3-x86_64-linux)
203
- strings (0.2.1)
204
- strings-ansi (~> 0.2)
205
- unicode-display_width (>= 1.5, < 3.0)
206
- unicode_utils (~> 1.4)
207
- strings-ansi (0.2.0)
208
- ta_lib_ffi (0.3.0)
209
- fiddle (~> 1.1)
210
- tilt (2.6.1)
211
- toml-rb (4.1.0)
212
- citrus (~> 3.0, > 3.0)
213
- racc (~> 1.7)
214
- tty-color (0.6.0)
215
- tty-cursor (0.7.1)
216
- tty-screen (0.8.2)
217
- tty-spinner (0.9.3)
218
- tty-cursor (~> 0.7)
219
- tty-table (0.12.0)
220
- pastel (~> 0.8)
221
- strings (~> 0.2.0)
222
- tty-screen (~> 0.8)
223
- unicode-display_width (2.6.0)
224
- unicode_utils (1.4.0)
225
- zeitwerk (2.7.3)
226
-
227
- PLATFORMS
228
- aarch64-linux-gnu
229
- aarch64-linux-musl
230
- arm-linux-gnu
231
- arm-linux-musl
232
- arm64-darwin
233
- x86-linux-gnu
234
- x86-linux-musl
235
- x86_64-darwin
236
- x86_64-linux-gnu
237
- x86_64-linux-musl
238
-
239
- DEPENDENCIES
240
- alphavantage
241
- csv
242
- eps
243
- faraday
244
- hashie
245
- json (~> 2.7)
246
- kbs
247
- lite-statistics
248
- nenv
249
- polars-df
250
- puma (~> 6.0)
251
- rackup
252
- redis
253
- regent
254
- rerun
255
- ruby_llm
256
- ruby_llm-mcp
257
- shared_tools
258
- sinatra (~> 4.0)
259
- sinatra-contrib (~> 4.0)
260
- sqa-tai
261
- toml-rb
262
- tty-table
263
-
264
- RUBY VERSION
265
- ruby 3.3.6p108
266
-
267
- BUNDLED WITH
268
- 2.7.2
@@ -1,169 +0,0 @@
1
- # SQA Web App - Quick Start Guide
2
-
3
- Get the SQA web application running in 5 minutes.
4
-
5
- ## 1. Prerequisites
6
-
7
- ```bash
8
- # Install TA-Lib (macOS)
9
- brew install ta-lib
10
-
11
- # Start Redis
12
- redis-server
13
-
14
- # Set API key (optional, uses Yahoo Finance as fallback)
15
- export AV_API_KEY="your_key_here"
16
- ```
17
-
18
- ## 2. Install Dependencies
19
-
20
- ```bash
21
- cd examples/sinatra_app
22
- bundle install
23
- ```
24
-
25
- ## 3. Start the Application
26
-
27
- **IMPORTANT:** Always use `bundle exec` to ensure all gems are loaded correctly:
28
-
29
- ```bash
30
- bundle exec ruby app.rb
31
- ```
32
-
33
- Or use the provided startup script:
34
-
35
- ```bash
36
- ./start.sh
37
- ```
38
-
39
- The app will start on http://localhost:4567
40
-
41
- **Common mistake:** Running `ruby app.rb` without `bundle exec` will cause the app to fail or behave incorrectly.
42
-
43
- ## 4. Quick Tour
44
-
45
- ### Home Page
46
- - Click on any quick link ticker (AAPL, MSFT, etc.)
47
- - Or enter a custom ticker in the search box
48
-
49
- ### Dashboard
50
- - View interactive price charts (candlestick or line)
51
- - See volume chart
52
- - Check RSI and MACD indicators
53
- - View key metrics (52-week high/low, current RSI, market regime)
54
- - Compare all strategies at once
55
-
56
- ### Analysis Page
57
- - Market regime detection (bull/bear/sideways)
58
- - Seasonal patterns (best months and quarters)
59
- - FPOP (Future Period) analysis
60
- - Risk metrics (VaR, Sharpe ratio, max drawdown)
61
-
62
- ### Backtest Page
63
- - Select a strategy (RSI, MACD, SMA, EMA, Bollinger Bands, KBS)
64
- - View detailed backtest results
65
- - Compare all strategies side-by-side
66
-
67
- ## 5. Keyboard Shortcuts
68
-
69
- - `Ctrl/Cmd + K` - Open ticker search
70
- - `Escape` - Close modal
71
-
72
- ## 6. API Examples
73
-
74
- ### Get Stock Data
75
- ```bash
76
- curl http://localhost:4567/api/stock/AAPL
77
- ```
78
-
79
- ### Get Technical Indicators
80
- ```bash
81
- curl http://localhost:4567/api/indicators/AAPL
82
- ```
83
-
84
- ### Run Backtest
85
- ```bash
86
- curl -X POST http://localhost:4567/api/backtest/AAPL \
87
- -d "strategy=RSI"
88
- ```
89
-
90
- ### Get Market Analysis
91
- ```bash
92
- curl http://localhost:4567/api/analyze/AAPL
93
- ```
94
-
95
- ### Compare Strategies
96
- ```bash
97
- curl -X POST http://localhost:4567/api/compare/AAPL
98
- ```
99
-
100
- ## 7. Development Mode
101
-
102
- Auto-reload on file changes:
103
-
104
- ```bash
105
- bundle install # rerun is in the development group
106
- bundle exec rerun 'ruby app.rb'
107
- ```
108
-
109
- ## 8. Troubleshooting
110
-
111
- **Port already in use:**
112
- ```bash
113
- # Kill process on port 4567
114
- lsof -ti:4567 | xargs kill -9
115
- ```
116
-
117
- **TA-Lib not found:**
118
- ```bash
119
- # Reinstall TA-Lib
120
- brew reinstall ta-lib
121
- ```
122
-
123
- **Redis connection error:**
124
- ```bash
125
- # Start Redis
126
- redis-server &
127
- ```
128
-
129
- **Stock data not loading:**
130
- - Check internet connection
131
- - Verify ticker symbol is valid
132
- - Try a different ticker (e.g., AAPL, MSFT, GOOGL)
133
-
134
- ## 9. Popular Tickers
135
-
136
- Try these popular stocks:
137
-
138
- **Tech:**
139
- - AAPL (Apple)
140
- - MSFT (Microsoft)
141
- - GOOGL (Google)
142
- - AMZN (Amazon)
143
- - NVDA (NVIDIA)
144
- - TSLA (Tesla)
145
-
146
- **Finance:**
147
- - JPM (JP Morgan)
148
- - BAC (Bank of America)
149
- - GS (Goldman Sachs)
150
-
151
- **ETFs:**
152
- - SPY (S&P 500)
153
- - QQQ (NASDAQ 100)
154
- - DIA (Dow Jones)
155
-
156
- ## 10. Next Steps
157
-
158
- - Explore different strategies on the Backtest page
159
- - Compare seasonal patterns across multiple stocks
160
- - Check market regime before making trade decisions
161
- - Use FPOP analysis to identify high-probability setups
162
-
163
- ## Support
164
-
165
- See README.md for full documentation and API reference.
166
-
167
- ---
168
-
169
- Happy analyzing! 📊