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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d6d22476a47a9bfc41607bfaf78edd211f3e8be7badaef817512b3b9c04cb04
4
- data.tar.gz: 97ae20203d7bca4bef0bb619e1ae4550071e6072ebe8d357ec99a5957df874a4
3
+ metadata.gz: 484455cc08530992abd5fc38f02ae973bf1fb243aced961bdf7a8961e3f1b161
4
+ data.tar.gz: dd3f4cfc5fc7112d6c6e84973f1f5c6376678e69d7713a653c9e04223df35cd1
5
5
  SHA512:
6
- metadata.gz: 3a51b38307d0c14f750dab7916a505dfd59e793a0d3bd1e1f19c45e5daab39d7e4b0913ace7661bfdb056017f9e5ac43164ea194c4f06d5dbb1423d3cdad6649
7
- data.tar.gz: cc4985173611bc3131cb017beb0e3812a3df593799ef1423b741aa7c9113f4ef308df1bba6f808990731bb9d101502dd641a44582dea7a1460d3d65a03bd152b
6
+ metadata.gz: bce9d957fb7014508833d97fc733eafb0b776fd824b9c2c5fd8417c94ce29f0ff3cbd6a164a19f82f8a5c25cff657ed200f89d223e6a246ddc19bb9857e4befb
7
+ data.tar.gz: 57477ab3cc699310ebd205588855252db79127dd160ca981ae2ab0b6ebebd39f3dd19b7b26829f130decaf1a38fe006c3c20857e6a739342b793390d5f3fecea
data/CHANGELOG.md CHANGED
@@ -1,6 +1,110 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.36] - 2025-11-24
4
+
5
+ ### Changed
6
+ - **Phase 3 Architecture & Design Improvements**:
7
+ - Added deprecation warning for auto-initialization at require time (will be removed in v1.0)
8
+ - Added `SQA::Config.initialized?` class method to track initialization state
9
+ - Warning only shows when `$VERBOSE` is set
10
+ - `concat_and_deduplicate!` now enforces ascending order for TA-Lib compatibility
11
+ - Warns and forces `descending: false` if `descending: true` is passed
12
+ - Prevents silent calculation errors from incorrect data ordering
13
+ - Extracted Faraday connection to configurable dependency in `SQA::Stock`
14
+ - Added `ALPHA_VANTAGE_URL` constant
15
+ - Added class methods: `connection`, `connection=`, `default_connection`, `reset_connection!`
16
+ - Allows injection of custom connections for testing/mocking
17
+ - Deprecated `CONNECTION` constant (will be removed in v1.0)
18
+
19
+ ### Added
20
+ - **Test Coverage for Phase 3**:
21
+ - Added 2 tests to `test/config_test.rb` for `initialized?` method
22
+ - Added 7 tests to `test/stock_test.rb` for configurable connection
23
+ - Updated `test/data_frame_test.rb` to verify ascending order enforcement
24
+
25
+ ## [0.0.35] - 2025-11-23
26
+
27
+ ### Changed
28
+ - **Phase 2 Code Quality & Best Practices**:
29
+ - Replaced class variables (`@@var`) with class instance variables (`@var`) for thread safety
30
+ - `SQA::init.rb`: `@@config`, `@@av_api_key` → `@config`, `@av_api_key`
31
+ - `SQA::Ticker`: Restructured with `class << self` block, added `reset!` method
32
+ - `SQA::Stock`: `@@top` → `@top`, added `reset_top!` method
33
+ - Replaced `puts` statements with `debug_me` in `SQA::SectorAnalyzer`
34
+ - Simplified `method_missing` in `SQA::DataFrame` (no longer dynamically defines methods)
35
+ - Fixed type checking pattern in `SQA::Strategy#add` to use `is_a?` instead of `.class ==`
36
+ - Fixed `SQA::Strategy#available` to use `.name` instead of `.to_s` (avoids pretty_please gem conflict)
37
+ - Removed magic placeholder "xyzzy" from `SQA::Stock#create_data`
38
+
39
+ ### Fixed
40
+ - **DataFrame.from_aofh**: Fixed Polars compatibility by converting to hash-of-arrays format
41
+ - **DataFrame.from_aofh**: Now properly passes `mapping:` and `transformers:` parameters
42
+ - **Ticker.valid?**: Now handles nil and empty string inputs gracefully
43
+ - **Ticker.lookup**: Now handles nil and empty string inputs gracefully
44
+
45
+ ### Added
46
+ - **Test Coverage for Phase 2**:
47
+ - New `test/ticker_test.rb` with 10 tests for Ticker class
48
+ - New `test/strategy_test.rb` with 10 tests for Strategy class
49
+ - Added 4 tests to `test/data_frame_test.rb` for `from_aofh` and `method_missing`
50
+ - Added 2 tests to `test/stock_test.rb` for `reset_top!` method
51
+
52
+ ## [0.0.34] - 2025-11-23
53
+
54
+ ### Fixed
55
+ - **Test Suite**: Fixed 15+ pre-existing test failures
56
+ - Fixed typo in RiskManagerTest (`var` → `cvar`)
57
+ - Fixed Portfolio test expectations (total_cost, P&L calculation, summary keys)
58
+ - Fixed URL trailing slash comparisons in AlphaVantage/YahooFinance tests
59
+ - Fixed FPOP test expectation (implementation returns partial windows)
60
+ - Fixed SectorAnalyzer symbol/string comparison
61
+ - Fixed AlphaVantage header mapping test (timestamp, no adjusted_close)
62
+ - **PatternMatcher**: Fixed integer division bug in `pattern_quality` method
63
+ - Added `.to_f` conversion to prevent truncation with integer inputs
64
+ - **Config Coercion**: Fixed string-to-symbol coercion for `log_level` and `plotting_library`
65
+ - Added explicit `coerce_key` handlers
66
+
67
+ ### Added
68
+ - **Portfolio**: Added `commission` to `attr_accessor` for public access
69
+ - **Error Namespacing**: Added `SQA::BadParameterError` namespace with backwards-compatible alias
70
+
71
+ ### Changed
72
+ - **Phase 1 Security & Correctness** (from improvement plan):
73
+ - Replaced shell injection vulnerability (`touch` backticks → `FileUtils.touch`)
74
+ - Replaced deprecated `has_key?` with `key?` across codebase
75
+ - Added `SQA::DataFetchError` and `SQA::ConfigurationError` exception classes
76
+ - Replaced bare `rescue` clauses with specific exception types
77
+
78
+ ## [0.0.33] - 2025-11-23
79
+
80
+ ### Removed
81
+ - **Sinatra Example App**: Removed `examples/sinatra_app/` directory
82
+ - Functionality moved to separate gem: [sqa_demo-sinatra](https://github.com/MadBomber/sqa_demo-sinatra)
83
+ - Cleaner separation between library and demo application
84
+
85
+ ### Added
86
+ - **Documentation**: Added links to sqa_demo-sinatra demo application
87
+ - Updated README.md with Web Demo Application section
88
+ - Updated docs/index.md with Demo Application section
89
+ - Updated examples/README.md with reference to web demo
90
+ - **LLM Documentation**: Added llms.txt for AI assistant compatibility
91
+ - **Improvement Plan**: Added docs/IMPROVEMENT_PLAN.md for upcoming code quality improvements
92
+
93
+ ## [0.0.32] - 2024-11-12
94
+
95
+ ### Added
96
+ - **CSV Updates**: Conditional CSV updates based on timestamp
97
+ - Only updates CSV files when new data is available
98
+ - Improves performance by avoiding unnecessary writes
99
+
100
+ ### Changed
101
+ - **DataFrame**: Removed debug_me calls from SQA::DataFrame
102
+ - Cleaned up debugging code for production use
103
+
3
104
  ### Fixed
105
+ - **CSV Data Quality**: Multiple improvements to CSV data handling
106
+ - Change CSV sort order to ascending (oldest-first) for TA-Lib compatibility
107
+ - Prevent duplicate timestamps in CSV data files
4
108
  - **DataFrame::Data**: Added missing `SQA::DataFrame::Data` class for stock metadata storage
5
109
  - Stores ticker, name, exchange, source, indicators, and overview data
6
110
  - Supports both hash initialization (JSON) and keyword arguments
data/CLAUDE.md CHANGED
@@ -212,6 +212,27 @@ sqa-console # Launch IRB with SQA library loaded
212
212
  - 150+ indicators available: SMA, EMA, RSI, MACD, Bollinger Bands, ADX, ATR, etc.
213
213
  - See: https://github.com/MadBomber/sqa-tai
214
214
 
215
+ ### Data Ordering (CRITICAL)
216
+ **TA-Lib Requirement**: Arrays MUST be in **OLDEST-FIRST** (ascending chronological) order
217
+ - Index [0] = oldest data point
218
+ - Index [last] = newest/most recent data point
219
+ - This applies to ALL TA-Lib indicators
220
+
221
+ **SQA Implementation**:
222
+ - ✅ CSV files stored in **ASCENDING order** (oldest-first) for TA-Lib compatibility
223
+ - ✅ DataFrames maintain ascending order after updates
224
+ - ✅ `.to_a` extracts arrays ready for TA-Lib (no reversal needed)
225
+ - ✅ `concat_and_deduplicate!` sorts ascending by default
226
+ - ⚠️ Alpha Vantage API returns data newest-first, but SQA automatically sorts to ascending
227
+
228
+ **Example**:
229
+ ```ruby
230
+ prices = stock.df["adj_close_price"].to_a
231
+ # => [100.0, 101.5, 103.2, ...] (oldest to newest - ready for TA-Lib)
232
+
233
+ rsi = SQAI.rsi(prices, period: 14) # Correct order, no reversal needed
234
+ ```
235
+
215
236
  ### Testing Approach
216
237
  - Minitest framework in `/test/` directory
217
238
  - SimpleCov for coverage reporting
data/README.md CHANGED
@@ -1,10 +1,53 @@
1
- # SQA - Simple Qualitative Analysis
1
+ <div align="center">
2
+ <h1>SQA - Simple Qualitative Analysis</h1>
3
+
4
+ <p>A Ruby library for technical analysis of stock market data, trading strategies, and portfolio optimization.<br/>
5
+ Core library of the <a href="https://github.com/MadBomber/sqa">SQA</a> (Simple Qualitative Analysis) ecosystem.</p>
6
+ </div>
7
+
8
+ <table>
9
+ <tr>
10
+ <td width="30%" valign="middle" align="center">
11
+ <img src="docs/assets/images/sqa.jpg" alt="Ruby Turns Information into Knowledge" width="80%">
12
+ <br/>
13
+ <a href="https://www.youtube.com/watch?v=VqomZQMZQCQ">
14
+ <img src="https://img.shields.io/badge/Badge-We%20don't%20need%20no%20stinkin'%20badges!-red" alt="Badges?">
15
+ </a>
16
+ </td>
17
+ <td width="70%" valign="top">
18
+
19
+ **⚠️ WARNING:** This is a learning tool, not production software. DO NOT use this library when real money is at stake. The BUY/SELL signals it generates should not be taken seriously. If you lose your shirt playing in the stock market, don't come crying to me. Playing in the market is like playing in the street - you're going to get run over.
2
20
 
3
- [![Badges?](https://img.shields.io/badge/Badge-We%20don't%20need%20no%20stinkin'%20badges!-red)](https://www.youtube.com/watch?v=VqomZQMZQCQ)
21
+ ## Features
22
+
23
+ ### Core Capabilities
24
+ - **High-Performance DataFrames** - Polars-based data structures for time series financial data
25
+ - **150+ Technical Indicators** - Via the separate [`sqa-tai`](https://github.com/MadBomber/sqa-tai) gem (TA-Lib wrapper)
26
+ - **Trading Strategies** - Framework for building and testing trading strategies
27
+ - **Multiple Data Sources** - Alpha Vantage and Yahoo Finance adapters
28
+ - **Stock Management** - Track stocks with historical prices and company metadata
29
+ - **Statistical Analysis** - Comprehensive statistics on price data
30
+ - **Ticker Validation** - Validate stock symbols against market exchanges
31
+ - **Interactive Console** - IRB console for experimentation (`sqa-console`)
32
+ - **CLI Tools** - Command-line interface via the separate [`sqa-cli`](https://github.com/MadBomber/sqa-cli) gem
4
33
 
5
- A Ruby library for technical analysis of stock market data. This is a simplistic set of tools for quantitative and qualitative stock analysis designed for **educational purposes only**.
34
+ ### Advanced Features
35
+ - **Portfolio Management** - Track positions, trades, P&L with commission support
36
+ - **Backtesting Framework** - Simulate trading strategies with comprehensive performance metrics
37
+ - **Strategy Generator** - Reverse-engineer profitable trades to discover indicator patterns
38
+ - **Genetic Programming** - Evolve optimal strategy parameters through natural selection
39
+ - **Knowledge-Based Strategy (KBS)** - RETE-based forward-chaining inference for complex trading rules
40
+ - **Real-Time Streaming** - Event-driven live price processing with on-the-fly signal generation
41
+ - **FPL Analysis** - Future Period Loss/Profit analysis with risk metrics and directional classification
42
+ - **Market Regime Detection** - Identify bull/bear/sideways markets with volatility and strength metrics
43
+ - **Seasonal Analysis** - Discover calendar-dependent patterns (monthly/quarterly performance)
44
+ - **Sector Analysis** - Multi-stock pattern discovery with KBS blackboards per sector
45
+ - **Walk-Forward Validation** - Time-series cross-validation to prevent pattern overfitting
46
+ - **Pattern Context System** - Context-aware patterns that know when/where they're valid
6
47
 
7
- **⚠️ WARNING:** This is a learning tool, not production software. Do NOT use this library when real money is at stake. The BUY/SELL signals it generates should not be taken seriously. If you lose your shirt playing in the stock market, don't come crying to me. Playing in the market is like playing in the street - you're going to get run over.
48
+ </td>
49
+ </tr>
50
+ </table>
8
51
 
9
52
  <!-- Tocer[start]: Auto-generated, don't remove. -->
10
53
 
@@ -30,33 +73,6 @@ A Ruby library for technical analysis of stock market data. This is a simplistic
30
73
  - [License](#license)
31
74
 
32
75
  <!-- Tocer[finish]: Auto-generated, don't remove. -->
33
-
34
- ## Features
35
-
36
- ### Core Capabilities
37
- - **High-Performance DataFrames** - Polars-based data structures for time series financial data
38
- - **150+ Technical Indicators** - Via the `sqa-tai` gem (TA-Lib wrapper)
39
- - **Trading Strategies** - Framework for building and testing trading strategies
40
- - **Multiple Data Sources** - Alpha Vantage and Yahoo Finance adapters
41
- - **Stock Management** - Track stocks with historical prices and company metadata
42
- - **Statistical Analysis** - Comprehensive statistics on price data
43
- - **Ticker Validation** - Validate stock symbols against market exchanges
44
- - **Interactive Console** - IRB console for experimentation (`sqa-console`)
45
-
46
- ### Advanced Features
47
- - **Portfolio Management** - Track positions, trades, P&L with commission support
48
- - **Backtesting Framework** - Simulate trading strategies with comprehensive performance metrics
49
- - **Strategy Generator** - Reverse-engineer profitable trades to discover indicator patterns
50
- - **Genetic Programming** - Evolve optimal strategy parameters through natural selection
51
- - **Knowledge-Based Strategy (KBS)** - RETE-based forward-chaining inference for complex trading rules
52
- - **Real-Time Streaming** - Event-driven live price processing with on-the-fly signal generation
53
- - **FPL Analysis** - Future Period Loss/Profit analysis with risk metrics and directional classification
54
- - **Market Regime Detection** - Identify bull/bear/sideways markets with volatility and strength metrics
55
- - **Seasonal Analysis** - Discover calendar-dependent patterns (monthly/quarterly performance)
56
- - **Sector Analysis** - Multi-stock pattern discovery with KBS blackboards per sector
57
- - **Walk-Forward Validation** - Time-series cross-validation to prevent pattern overfitting
58
- - **Pattern Context System** - Context-aware patterns that know when/where they're valid
59
-
60
76
  ## Installation
61
77
 
62
78
  Install the gem:
@@ -65,6 +81,8 @@ Install the gem:
65
81
  gem install sqa
66
82
  ```
67
83
 
84
+ This will automatically install the `sqa-tai` gem (technical indicators) as a dependency.
85
+
68
86
  Or add to your `Gemfile`:
69
87
 
70
88
  ```ruby
@@ -77,6 +95,12 @@ Then run:
77
95
  bundle install
78
96
  ```
79
97
 
98
+ For command-line tools, install the separate CLI gem:
99
+
100
+ ```bash
101
+ gem install sqa-cli
102
+ ```
103
+
80
104
  ## Configuration
81
105
 
82
106
  ### Data Directory
@@ -186,7 +210,7 @@ df.data # Polars::DataFrame
186
210
 
187
211
  ### Technical Indicators
188
212
 
189
- All technical indicators are provided by the [`sqa-tai`](https://github.com/MadBomber/sqa-tai) gem, which wraps the industry-standard TA-Lib library:
213
+ All technical indicators are provided by the separate [`sqa-tai`](https://github.com/MadBomber/sqa-tai) gem, which wraps the industry-standard TA-Lib library. The `sqa-tai` gem must be installed separately but is automatically included as a dependency of `sqa`.
190
214
 
191
215
  ```ruby
192
216
  require 'sqa'
@@ -889,6 +913,10 @@ ruby examples/strategy_generator_example.rb
889
913
 
890
914
  See `examples/README.md` for detailed documentation and integration patterns.
891
915
 
916
+ ### Web Demo Application
917
+
918
+ For a complete web-based demonstration of SQA's capabilities, see the **[sqa_demo-sinatra](https://github.com/MadBomber/sqa_demo-sinatra)** gem. This Sinatra application provides a visual interface for exploring stock analysis, technical indicators, and trading strategies.
919
+
892
920
  ## Architecture
893
921
 
894
922
  **Core Components:**
data/Rakefile CHANGED
@@ -1,25 +1,67 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
-
5
3
  begin
6
- require "tocer/rake/register"
7
- rescue LoadError => error
8
- puts error.message
4
+ require 'tocer/rake/register'
5
+ rescue LoadError => e
6
+ puts e.message
9
7
  end
10
8
 
11
9
  Tocer::Rake::Register.call
12
10
 
11
+ begin
12
+ require 'yard'
13
+
14
+ namespace :docs do
15
+ desc 'Build complete documentation site (API markdown + MkDocs)'
16
+ task :build do
17
+ puts 'Step 1: Generating API documentation from YARD comments...'
18
+ sh 'ruby bin/generate_api_docs.rb'
19
+
20
+ puts "\nStep 2: Building MkDocs site with Material theme..."
21
+ sh 'mkdocs build'
13
22
 
23
+ puts "\nDocumentation complete!"
24
+ puts ' Site: site/index.html'
25
+ puts ' API Reference: site/api-reference/index.html'
26
+ puts "\nTo preview: rake docs:serve"
27
+ end
28
+
29
+ desc 'Serve documentation locally with live reload'
30
+ task :serve do
31
+ puts 'Starting MkDocs development server...'
32
+ puts 'View at: http://127.0.0.1:8000'
33
+ puts 'Press Ctrl+C to stop'
34
+ sh 'mkdocs serve'
35
+ end
36
+
37
+ desc 'Clean generated documentation files'
38
+ task :clean do
39
+ puts 'Cleaning generated documentation...'
40
+ sh 'rm -rf docs/api-reference site .yardoc'
41
+ puts 'Done!'
42
+ end
43
+
44
+ desc 'Deploy documentation to GitHub Pages'
45
+ task deploy: :build do
46
+ puts "\nDeploying to GitHub Pages..."
47
+ sh 'mkdocs gh-deploy --force'
48
+
49
+ puts "\nDeployment complete!"
50
+ puts 'Documentation is live at: https://madbomber.github.io/sqa/'
51
+ end
52
+ end
53
+ rescue LoadError
54
+ # YARD not available
55
+ end
14
56
 
15
- require "bundler/gem_tasks"
16
- require "minitest/test_task"
57
+ require 'bundler/gem_tasks'
58
+ require 'minitest/test_task'
17
59
 
18
60
  Minitest::TestTask.create(:test) do |t|
19
- t.libs << "test"
20
- t.libs << "lib"
61
+ t.libs << 'test'
62
+ t.libs << 'lib'
21
63
  t.warning = false
22
- t.test_globs = ["test/**/*_test.rb"]
64
+ t.test_globs = ['test/**/*_test.rb']
23
65
  end
24
66
 
25
67
  task default: %i[]