sqa 0.0.31 → 0.0.32

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/CLAUDE.md +21 -0
  4. data/README.md +56 -32
  5. data/docs/api/dataframe.md +0 -1
  6. data/docs/assets/images/sqa.jpg +0 -0
  7. data/docs/concepts/index.md +2 -10
  8. data/docs/data_frame.md +0 -1
  9. data/docs/getting-started/index.md +0 -16
  10. data/docs/getting-started/installation.md +2 -2
  11. data/docs/getting-started/quick-start.md +4 -4
  12. data/docs/index.md +0 -2
  13. data/docs/strategies/bollinger-bands.md +1 -1
  14. data/docs/strategies/rsi.md +1 -1
  15. data/examples/sinatra_app/Gemfile +20 -0
  16. data/examples/sinatra_app/Gemfile.lock +268 -0
  17. data/examples/sinatra_app/QUICKSTART.md +13 -3
  18. data/examples/sinatra_app/README.md +12 -2
  19. data/examples/sinatra_app/RUNNING_WITHOUT_TALIB.md +90 -0
  20. data/examples/sinatra_app/TROUBLESHOOTING.md +95 -0
  21. data/examples/sinatra_app/app.rb +85 -25
  22. data/examples/sinatra_app/public/css/style.css +101 -37
  23. data/examples/sinatra_app/public/debug_macd.html +82 -0
  24. data/examples/sinatra_app/start.sh +53 -0
  25. data/examples/sinatra_app/views/dashboard.erb +558 -146
  26. data/examples/sinatra_app/views/layout.erb +2 -2
  27. data/lib/sqa/data_frame/alpha_vantage.rb +13 -3
  28. data/lib/sqa/data_frame.rb +21 -15
  29. data/lib/sqa/indicator.rb +17 -4
  30. data/lib/sqa/stock.rb +73 -11
  31. data/lib/sqa/ticker.rb +9 -2
  32. data/lib/sqa/version.rb +1 -1
  33. data/lib/sqa.rb +12 -4
  34. data/mkdocs.yml +4 -40
  35. metadata +7 -21
  36. data/docs/alpha_vantage_technical_indicators.md +0 -62
  37. data/docs/average_true_range.md +0 -9
  38. data/docs/bollinger_bands.md +0 -15
  39. data/docs/candlestick_pattern_recognizer.md +0 -4
  40. data/docs/donchian_channel.md +0 -5
  41. data/docs/double_top_bottom_pattern.md +0 -3
  42. data/docs/exponential_moving_average.md +0 -19
  43. data/docs/fibonacci_retracement.md +0 -30
  44. data/docs/head_and_shoulders_pattern.md +0 -3
  45. data/docs/market_profile.md +0 -4
  46. data/docs/momentum.md +0 -19
  47. data/docs/moving_average_convergence_divergence.md +0 -23
  48. data/docs/peaks_and_valleys.md +0 -11
  49. data/docs/relative_strength_index.md +0 -6
  50. data/docs/simple_moving_average.md +0 -8
  51. data/docs/stochastic_oscillator.md +0 -4
  52. data/docs/ta_lib.md +0 -160
  53. data/docs/true_range.md +0 -12
  54. data/docs/true_strength_index.md +0 -46
  55. data/docs/weighted_moving_average.md +0 -48
@@ -0,0 +1,82 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>MACD Debug Test</title>
5
+ </head>
6
+ <body>
7
+ <h1>MACD API Debug Test</h1>
8
+ <p>Testing indicators API response...</p>
9
+ <pre id="output"></pre>
10
+
11
+ <script>
12
+ async function testMACDData() {
13
+ const output = document.getElementById('output');
14
+
15
+ try {
16
+ const response = await fetch('/api/indicators/AAPL?period=90d');
17
+ const data = await response.json();
18
+
19
+ if (data.error) {
20
+ output.textContent = 'ERROR: ' + data.error;
21
+ return;
22
+ }
23
+
24
+ let debug = '';
25
+ debug += 'Total dates: ' + data.dates.length + '\n';
26
+ debug += 'Total MACD values: ' + data.macd.length + '\n\n';
27
+
28
+ // Check for null/NaN values
29
+ let nullCount = 0;
30
+ let validCount = 0;
31
+ let firstValidIndex = -1;
32
+
33
+ for (let i = 0; i < data.macd.length; i++) {
34
+ if (data.macd[i] === null || isNaN(data.macd[i]) ||
35
+ data.macd_signal[i] === null || isNaN(data.macd_signal[i]) ||
36
+ data.macd_hist[i] === null || isNaN(data.macd_hist[i])) {
37
+ nullCount++;
38
+ } else {
39
+ validCount++;
40
+ if (firstValidIndex === -1) firstValidIndex = i;
41
+ }
42
+ }
43
+
44
+ debug += 'Null/NaN values: ' + nullCount + '\n';
45
+ debug += 'Valid values: ' + validCount + '\n';
46
+ debug += 'First valid index: ' + firstValidIndex + '\n\n';
47
+
48
+ if (validCount > 0) {
49
+ debug += 'First 5 valid MACD values:\n';
50
+ let count = 0;
51
+ for (let i = firstValidIndex; i < data.macd.length && count < 5; i++) {
52
+ if (data.macd[i] !== null && !isNaN(data.macd[i])) {
53
+ debug += ` [${i}] Date: ${data.dates[i]}, MACD: ${data.macd[i]}, Signal: ${data.macd_signal[i]}, Hist: ${data.macd_hist[i]}\n`;
54
+ count++;
55
+ }
56
+ }
57
+
58
+ debug += '\nLast 5 MACD values:\n';
59
+ for (let i = Math.max(0, data.macd.length - 5); i < data.macd.length; i++) {
60
+ debug += ` [${i}] Date: ${data.dates[i]}, MACD: ${data.macd[i]}, Signal: ${data.macd_signal[i]}, Hist: ${data.macd_hist[i]}\n`;
61
+ }
62
+ } else {
63
+ debug += '\nNO VALID MACD DATA FOUND!\n';
64
+ debug += '\nSample of raw data:\n';
65
+ for (let i = 0; i < Math.min(10, data.macd.length); i++) {
66
+ debug += ` [${i}] MACD: ${data.macd[i]} (type: ${typeof data.macd[i]}), `;
67
+ debug += `Signal: ${data.macd_signal[i]} (type: ${typeof data.macd_signal[i]}), `;
68
+ debug += `Hist: ${data.macd_hist[i]} (type: ${typeof data.macd_hist[i]})\n`;
69
+ }
70
+ }
71
+
72
+ output.textContent = debug;
73
+
74
+ } catch (error) {
75
+ output.textContent = 'ERROR: ' + error.message + '\n' + error.stack;
76
+ }
77
+ }
78
+
79
+ testMACDData();
80
+ </script>
81
+ </body>
82
+ </html>
@@ -0,0 +1,53 @@
1
+ #!/bin/bash
2
+ # Startup script for SQA Sinatra App
3
+ # This script checks dependencies and starts the server properly
4
+
5
+ set -e
6
+
7
+ echo "============================================================"
8
+ echo "SQA Sinatra App - Startup Script"
9
+ echo "============================================================"
10
+ echo ""
11
+
12
+ # Check if we're in the right directory
13
+ if [ ! -f "app.rb" ]; then
14
+ echo "❌ Error: app.rb not found. Please run this script from examples/sinatra_app/"
15
+ exit 1
16
+ fi
17
+
18
+ # Check if Gemfile exists
19
+ if [ ! -f "Gemfile" ]; then
20
+ echo "❌ Error: Gemfile not found"
21
+ exit 1
22
+ fi
23
+
24
+ # Check if bundler is installed
25
+ if ! command -v bundle &> /dev/null; then
26
+ echo "❌ Error: bundler is not installed"
27
+ echo " Install with: gem install bundler"
28
+ exit 1
29
+ fi
30
+
31
+ echo "✓ Found app.rb and Gemfile"
32
+
33
+ # Check if bundle is satisfied
34
+ echo ""
35
+ echo "Checking dependencies..."
36
+ if ! bundle check &> /dev/null; then
37
+ echo "⚠️ Dependencies not installed. Running bundle install..."
38
+ bundle install
39
+ echo "✓ Dependencies installed"
40
+ else
41
+ echo "✓ All dependencies satisfied"
42
+ fi
43
+
44
+ echo ""
45
+ echo "Starting server..."
46
+ echo "============================================================"
47
+ echo "Server will be available at: http://localhost:4567"
48
+ echo "Press Ctrl+C to stop"
49
+ echo "============================================================"
50
+ echo ""
51
+
52
+ # Start the server with bundle exec
53
+ exec bundle exec ruby app.rb