sqa_demo-sinatra 0.1.0

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.
@@ -0,0 +1,58 @@
1
+ <div class="error-page">
2
+ <div class="error-container">
3
+ <div class="error-icon">
4
+ <i class="fas fa-exclamation-triangle"></i>
5
+ </div>
6
+ <h1>Oops! Something went wrong</h1>
7
+ <p class="error-message"><%= @error %></p>
8
+ <div class="error-actions">
9
+ <a href="/" class="btn btn-primary">
10
+ <i class="fas fa-home"></i> Back to Home
11
+ </a>
12
+ <button onclick="history.back()" class="btn btn-secondary">
13
+ <i class="fas fa-arrow-left"></i> Go Back
14
+ </button>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <style>
20
+ .error-page {
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ min-height: 70vh;
25
+ padding: 2rem;
26
+ }
27
+
28
+ .error-container {
29
+ text-align: center;
30
+ max-width: 600px;
31
+ }
32
+
33
+ .error-icon {
34
+ font-size: 6rem;
35
+ color: var(--danger-color);
36
+ margin-bottom: 2rem;
37
+ }
38
+
39
+ .error-page h1 {
40
+ font-size: 2.5rem;
41
+ color: var(--text-primary);
42
+ margin-bottom: 1rem;
43
+ }
44
+
45
+ .error-message {
46
+ font-size: 1.25rem;
47
+ color: var(--text-secondary);
48
+ margin-bottom: 2rem;
49
+ line-height: 1.6;
50
+ }
51
+
52
+ .error-actions {
53
+ display: flex;
54
+ gap: 1rem;
55
+ justify-content: center;
56
+ flex-wrap: wrap;
57
+ }
58
+ </style>
@@ -0,0 +1,118 @@
1
+ <div class="hero">
2
+ <div class="hero-content">
3
+ <h1>
4
+ <i class="fas fa-chart-line"></i>
5
+ Stock Analysis Platform
6
+ </h1>
7
+ <p class="hero-subtitle">
8
+ Advanced technical analysis powered by SQA library
9
+ </p>
10
+
11
+ <div class="ticker-search">
12
+ <form onsubmit="return searchTicker(event)" class="search-form">
13
+ <input
14
+ type="text"
15
+ id="mainTickerInput"
16
+ placeholder="Enter stock ticker (e.g., AAPL, MSFT, GOOGL)"
17
+ autocomplete="off"
18
+ >
19
+ <button type="submit" class="btn btn-primary btn-large">
20
+ <i class="fas fa-search"></i> Analyze
21
+ </button>
22
+ </form>
23
+ </div>
24
+
25
+ <div class="quick-links">
26
+ <h3>Quick Analysis</h3>
27
+ <div class="ticker-buttons">
28
+ <a href="/dashboard/AAPL" class="ticker-btn">AAPL</a>
29
+ <a href="/dashboard/MSFT" class="ticker-btn">MSFT</a>
30
+ <a href="/dashboard/GOOGL" class="ticker-btn">GOOGL</a>
31
+ <a href="/dashboard/AMZN" class="ticker-btn">AMZN</a>
32
+ <a href="/dashboard/TSLA" class="ticker-btn">TSLA</a>
33
+ <a href="/dashboard/NVDA" class="ticker-btn">NVDA</a>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="features">
40
+ <div class="container">
41
+ <h2>Features</h2>
42
+ <div class="feature-grid">
43
+ <div class="feature-card">
44
+ <div class="feature-icon">
45
+ <i class="fas fa-chart-candlestick"></i>
46
+ </div>
47
+ <h3>Interactive Charts</h3>
48
+ <p>Candlestick charts with technical indicators including RSI, MACD, Bollinger Bands, and moving averages.</p>
49
+ </div>
50
+
51
+ <div class="feature-card">
52
+ <div class="feature-icon">
53
+ <i class="fas fa-robot"></i>
54
+ </div>
55
+ <h3>Strategy Backtesting</h3>
56
+ <p>Test trading strategies on historical data with detailed performance metrics and comparison tools.</p>
57
+ </div>
58
+
59
+ <div class="feature-card">
60
+ <div class="feature-icon">
61
+ <i class="fas fa-brain"></i>
62
+ </div>
63
+ <h3>Market Analysis</h3>
64
+ <p>Detect market regimes, seasonal patterns, and future price projections with FPOP analysis.</p>
65
+ </div>
66
+
67
+ <div class="feature-card">
68
+ <div class="feature-icon">
69
+ <i class="fas fa-shield-alt"></i>
70
+ </div>
71
+ <h3>Risk Management</h3>
72
+ <p>Value at Risk (VaR), Sharpe ratio, maximum drawdown, and other risk metrics for informed decisions.</p>
73
+ </div>
74
+
75
+ <div class="feature-card">
76
+ <div class="feature-icon">
77
+ <i class="fas fa-layer-group"></i>
78
+ </div>
79
+ <h3>Portfolio Optimization</h3>
80
+ <p>Optimize allocation across multiple stocks using maximum Sharpe, minimum variance, or risk parity.</p>
81
+ </div>
82
+
83
+ <div class="feature-card">
84
+ <div class="feature-icon">
85
+ <i class="fas fa-search-dollar"></i>
86
+ </div>
87
+ <h3>Pattern Discovery</h3>
88
+ <p>Discover profitable trading patterns by reverse-engineering historical data and indicator combinations.</p>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ <div class="info-section">
95
+ <div class="container">
96
+ <div class="info-content">
97
+ <h2>About SQA</h2>
98
+ <p>
99
+ SQA (Simple Qualitative Analysis) is a comprehensive Ruby library for stock market
100
+ technical analysis. This web interface provides an intuitive way to visualize and
101
+ analyze stock data using advanced algorithms and machine learning techniques.
102
+ </p>
103
+ <ul class="info-list">
104
+ <li><i class="fas fa-check-circle"></i> 150+ technical indicators via TA-Lib</li>
105
+ <li><i class="fas fa-check-circle"></i> 12+ built-in trading strategies</li>
106
+ <li><i class="fas fa-check-circle"></i> High-performance Polars DataFrame backend</li>
107
+ <li><i class="fas fa-check-circle"></i> Real-time streaming support</li>
108
+ <li><i class="fas fa-check-circle"></i> Genetic programming for parameter optimization</li>
109
+ <li><i class="fas fa-check-circle"></i> Knowledge-based trading with RETE engine</li>
110
+ </ul>
111
+ </div>
112
+ </div>
113
+ </div>
114
+
115
+ <script>
116
+ // Focus on ticker input when page loads
117
+ document.getElementById('mainTickerInput').focus();
118
+ </script>
@@ -0,0 +1,61 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>SQA - Stock Analysis Platform</title>
7
+
8
+ <!-- ApexCharts for charts -->
9
+ <script src="https://cdn.jsdelivr.net/npm/apexcharts@3.45.1/dist/apexcharts.min.js"></script>
10
+
11
+ <!-- Custom CSS -->
12
+ <link rel="stylesheet" href="/css/style.css">
13
+
14
+ <!-- Font Awesome for icons -->
15
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
16
+ </head>
17
+ <body>
18
+ <!-- Navigation -->
19
+ <nav class="navbar">
20
+ <div class="nav-container">
21
+ <div class="nav-brand">
22
+ <i class="fas fa-chart-line"></i>
23
+ <span>SQA Analytics</span>
24
+ </div>
25
+ <ul class="nav-menu">
26
+ <li><a href="/" class="nav-link"><i class="fas fa-home"></i> Home</a></li>
27
+ <li><a href="#" class="nav-link" onclick="showTickerModal()"><i class="fas fa-search"></i> Analyze Stock</a></li>
28
+ <li><a href="/portfolio" class="nav-link"><i class="fas fa-briefcase"></i> Portfolio</a></li>
29
+ </ul>
30
+ </div>
31
+ </nav>
32
+
33
+ <!-- Main Content -->
34
+ <main class="main-content">
35
+ <%= yield %>
36
+ </main>
37
+
38
+ <!-- Footer -->
39
+ <footer class="footer">
40
+ <div class="footer-content">
41
+ <p>&copy; 2025 SQA - Simple Qualitative Analysis. Educational purposes only.</p>
42
+ <p class="disclaimer">Warning: Not financial advice. For educational use only.</p>
43
+ </div>
44
+ </footer>
45
+
46
+ <!-- Ticker Search Modal -->
47
+ <div id="tickerModal" class="modal">
48
+ <div class="modal-content">
49
+ <span class="close" onclick="closeTickerModal()">&times;</span>
50
+ <h2>Enter Stock Ticker</h2>
51
+ <form onsubmit="return searchTicker(event)">
52
+ <input type="text" id="tickerInput" placeholder="e.g., AAPL" autocomplete="off" autofocus>
53
+ <button type="submit" class="btn btn-primary">Analyze</button>
54
+ </form>
55
+ </div>
56
+ </div>
57
+
58
+ <!-- Custom JavaScript -->
59
+ <script src="/js/app.js"></script>
60
+ </body>
61
+ </html>
@@ -0,0 +1,43 @@
1
+ <div class="dashboard">
2
+ <div class="dashboard-header">
3
+ <div class="ticker-info">
4
+ <h1><i class="fas fa-briefcase"></i> Portfolio Optimization</h1>
5
+ <p style="color: var(--text-secondary); margin-top: 0.5rem;">
6
+ Optimize allocation across multiple stocks for maximum risk-adjusted returns
7
+ </p>
8
+ </div>
9
+ </div>
10
+
11
+ <div class="chart-container">
12
+ <div class="chart-header">
13
+ <h2><i class="fas fa-layer-group"></i> Coming Soon</h2>
14
+ </div>
15
+ <div style="padding: 3rem 2rem; text-align: center;">
16
+ <div style="font-size: 5rem; color: var(--primary-color); margin-bottom: 2rem;">
17
+ <i class="fas fa-tools"></i>
18
+ </div>
19
+ <h3 style="font-size: 2rem; margin-bottom: 1rem; color: var(--text-primary);">
20
+ Portfolio Optimization Feature
21
+ </h3>
22
+ <p style="font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 2rem; line-height: 1.8;">
23
+ This feature will allow you to optimize portfolio allocation across multiple stocks
24
+ using various methods including Maximum Sharpe ratio, Minimum Variance, and Risk Parity.
25
+ </p>
26
+ <div style="background: var(--light-bg); padding: 2rem; border-radius: 12px; max-width: 800px; margin: 0 auto;">
27
+ <h4 style="margin-bottom: 1rem; color: var(--text-primary);">Planned Features:</h4>
28
+ <ul style="text-align: left; max-width: 500px; margin: 0 auto; line-height: 2;">
29
+ <li><i class="fas fa-check-circle" style="color: var(--success-color);"></i> Maximum Sharpe Ratio Optimization</li>
30
+ <li><i class="fas fa-check-circle" style="color: var(--success-color);"></i> Minimum Variance Portfolio</li>
31
+ <li><i class="fas fa-check-circle" style="color: var(--success-color);"></i> Risk Parity Allocation</li>
32
+ <li><i class="fas fa-check-circle" style="color: var(--success-color);"></i> Efficient Frontier Visualization</li>
33
+ <li><i class="fas fa-check-circle" style="color: var(--success-color);"></i> Multi-stock Correlation Analysis</li>
34
+ </ul>
35
+ </div>
36
+ <div style="margin-top: 2rem;">
37
+ <a href="/" class="btn btn-primary">
38
+ <i class="fas fa-home"></i> Back to Home
39
+ </a>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'sinatra/version'
4
+ require_relative 'sinatra/app'
5
+
6
+ module SqaDemo
7
+ module Sinatra
8
+ class Error < StandardError; end
9
+ end
10
+ end
data/start.sh ADDED
@@ -0,0 +1,47 @@
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 Gemfile exists
13
+ if [ ! -f "Gemfile" ]; then
14
+ echo "Error: Gemfile not found"
15
+ exit 1
16
+ fi
17
+
18
+ # Check if bundler is installed
19
+ if ! command -v bundle &> /dev/null; then
20
+ echo "Error: bundler is not installed"
21
+ echo " Install with: gem install bundler"
22
+ exit 1
23
+ fi
24
+
25
+ echo "Found Gemfile"
26
+
27
+ # Check if bundle is satisfied
28
+ echo ""
29
+ echo "Checking dependencies..."
30
+ if ! bundle check &> /dev/null; then
31
+ echo "Dependencies not installed. Running bundle install..."
32
+ bundle install
33
+ echo "Dependencies installed"
34
+ else
35
+ echo "All dependencies satisfied"
36
+ fi
37
+
38
+ echo ""
39
+ echo "Starting server..."
40
+ echo "============================================================"
41
+ echo "Server will be available at: http://localhost:9292"
42
+ echo "Press Ctrl+C to stop"
43
+ echo "============================================================"
44
+ echo ""
45
+
46
+ # Start the server with bundle exec
47
+ exec bundle exec rackup
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sqa_demo-sinatra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dewayne VanHoozer
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: puma
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rackup
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: sinatra
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '4.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: sinatra-contrib
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '4.0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: json
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.7'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.7'
82
+ - !ruby/object:Gem::Dependency
83
+ name: sqa
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: debug_me
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: minitest
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ - !ruby/object:Gem::Dependency
125
+ name: rack-test
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rake
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ - !ruby/object:Gem::Dependency
153
+ name: rerun
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ description: A Sinatra-based web application for stock market analysis using the SQA
167
+ library
168
+ email:
169
+ - dvanhoozer@gmail.com
170
+ executables:
171
+ - sqa_sinatra
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - COMMITS.md
176
+ - LICENSE
177
+ - README.md
178
+ - Rakefile
179
+ - bin/sqa_sinatra
180
+ - config.ru
181
+ - lib/sqa_demo/sinatra.rb
182
+ - lib/sqa_demo/sinatra/app.rb
183
+ - lib/sqa_demo/sinatra/public/css/style.css
184
+ - lib/sqa_demo/sinatra/public/debug_macd.html
185
+ - lib/sqa_demo/sinatra/public/js/app.js
186
+ - lib/sqa_demo/sinatra/version.rb
187
+ - lib/sqa_demo/sinatra/views/analyze.erb
188
+ - lib/sqa_demo/sinatra/views/backtest.erb
189
+ - lib/sqa_demo/sinatra/views/dashboard.erb
190
+ - lib/sqa_demo/sinatra/views/error.erb
191
+ - lib/sqa_demo/sinatra/views/index.erb
192
+ - lib/sqa_demo/sinatra/views/layout.erb
193
+ - lib/sqa_demo/sinatra/views/portfolio.erb
194
+ - start.sh
195
+ homepage: https://github.com/madbomber/sqa_demo-sinatra
196
+ licenses:
197
+ - MIT
198
+ metadata:
199
+ homepage_uri: https://github.com/madbomber/sqa_demo-sinatra
200
+ source_code_uri: https://github.com/madbomber/sqa_demo-sinatra
201
+ changelog_uri: https://github.com/madbomber/sqa_demo-sinatra/blob/main/CHANGELOG.md
202
+ rdoc_options: []
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: 3.2.0
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ requirements: []
216
+ rubygems_version: 3.7.2
217
+ specification_version: 4
218
+ summary: SQA Demo Sinatra Application
219
+ test_files: []