-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
342 lines (307 loc) · 17.4 KB
/
Copy pathindex.html
File metadata and controls
342 lines (307 loc) · 17.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="dark" />
<title>SentimentTradingView — Terminal</title>
<meta name="description" content="Terminal-style Monte Carlo dashboard for TradingView-starred stocks, with strategy signals and X sentiment." />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<a href="#main" class="skip-link">Skip to main content</a>
<!-- ===== Boot overlay ===== -->
<div id="boot-overlay" class="boot-overlay" role="dialog" aria-modal="true" aria-labelledby="boot-title" hidden>
<div class="boot-inner">
<button type="button" id="boot-skip" class="boot-skip">Skip intro</button>
<h2 id="boot-title" class="sr-only">Terminal boot sequence</h2>
<pre id="boot-log" class="boot-log" aria-live="polite" aria-atomic="false"></pre>
<p class="boot-hint sr-only">Press Escape to skip the boot animation.</p>
</div>
</div>
<div class="app">
<!-- ===== Live ticker tape ===== -->
<div class="ticker-tape-wrap" role="region" aria-label="Live price ticker tape">
<button type="button" id="tape-toggle" class="tape-toggle" aria-pressed="false" aria-label="Pause ticker tape"><span aria-hidden="true" class="tape-icon">❚❚</span><span class="tape-toggle-lbl">Pause</span></button>
<div class="ticker-tape-viewport">
<div class="ticker-tape" id="ticker-tape" aria-hidden="true"></div>
</div>
<div id="ticker-tape-sr" class="sr-only" aria-live="off"></div>
</div>
<!-- ===== Terminal top strip ===== -->
<div class="term-strip" role="status" aria-label="Session status">
<span class="kv"><span class="brand-dot" aria-hidden="true"></span><span>STV</span></span>
<span class="kv"><span>WATCH</span> <span class="v" id="term-watch">10</span></span>
<span class="kv term-conn initializing" id="term-conn" aria-label="Data feed connection status">
<span class="conn-shape" aria-hidden="true"></span>
<span id="term-conn-label">INIT</span>
<span class="v" id="term-conn-src">—</span>
</span>
<span class="kv" id="term-mkt-wrap"><span>MKT</span> <span class="v" id="term-market" title="US equity market session">—</span></span>
<span class="kv"><span>HORIZON</span> <span class="v" id="term-horizon">30D</span></span>
<span class="kv"><span>PATHS</span> <span class="v" id="term-paths">1K</span></span>
<span class="kv"><span>SEED</span> <span class="v" id="term-seed">42</span></span>
<span class="kv"><span>LATENCY</span> <span class="v" id="term-latency">—</span></span>
<span class="kv ok"><span>UPTIME</span> <span class="v" id="term-uptime">00:00:00</span></span>
</div>
<!-- ===== Feed banner (only visible when real feed falls back) ===== -->
<div id="feed-banner" class="feed-banner" role="status" hidden>
<span class="feed-banner-icon" aria-hidden="true">!</span>
<span class="feed-banner-text" id="feed-banner-text">Live feed unavailable — showing simulated data.</span>
<button type="button" id="feed-retry" class="feed-btn">Retry</button>
<button type="button" id="feed-dismiss" class="feed-btn feed-btn-icon" aria-label="Dismiss feed notice">×</button>
</div>
<!-- Session-status live region for connection/market transitions only -->
<span id="session-status" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></span>
<!-- ===== Header ===== -->
<header class="app-header" role="banner">
<div>
<h1>SentimentTradingView // Terminal</h1>
<p class="subtitle">Monte Carlo dashboard for your TradingView-starred watchlist. Pick strategies, act on individual stocks, drill into any ticker.</p>
</div>
<div class="header-meta" aria-label="Data status">
<span><span class="live-dot" aria-hidden="true"></span>Live ticks</span>
<span>Last update: <time id="last-update" datetime="">—</time></span>
</div>
</header>
<main id="main" role="main" aria-labelledby="dashboard-title">
<h2 id="dashboard-title" class="sr-only">Portfolio dashboard</h2>
<!-- ===== Strategy + controls ===== -->
<section class="controls-block" aria-labelledby="controls-heading">
<h2 id="controls-heading" class="sr-only">Strategy and simulation controls</h2>
<div class="strategy-bar">
<fieldset class="strategy-fieldset">
<legend>Trading strategies <span class="legend-hint">pick one or more — signals combine</span></legend>
<div class="strategy-options" id="strategy-options"></div>
</fieldset>
</div>
<div class="controls-row">
<div class="field">
<label for="ticker-select">Focus ticker</label>
<select id="ticker-select" aria-describedby="ticker-help"></select>
<span id="ticker-help" class="sr-only">Select a starred TradingView ticker to drill into.</span>
</div>
<div class="field">
<label for="sims-range">Simulations <span id="sims-value" class="range-value" aria-hidden="true">1000</span></label>
<div class="range-row">
<input type="range" id="sims-range" min="100" max="10000" step="100" value="1000" aria-valuetext="1000 simulation paths" />
</div>
</div>
<div class="field">
<label for="horizon-select">Horizon</label>
<select id="horizon-select">
<option value="5">5 trading days</option>
<option value="30" selected>30 trading days</option>
<option value="90">90 trading days</option>
<option value="252">252 trading days</option>
</select>
</div>
<div class="field">
<label for="seed-input">Random seed</label>
<select id="seed-input">
<option value="42" selected>42 (deterministic)</option>
<option value="1337">1337</option>
<option value="2025">2025</option>
<option value="random">random</option>
</select>
</div>
<button type="button" id="run-btn" class="btn">Run Sim</button>
</div>
<span id="live-status" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></span>
<p id="status-line" class="status-line" aria-hidden="true">Ready. Select strategies and a ticker, then run a simulation.</p>
</section>
<!-- ===== Main grid: content + right rail ===== -->
<div class="main-grid">
<div class="main-col">
<!-- ===== Portfolio KPIs ===== -->
<section aria-labelledby="perf-heading">
<div class="section-header tight">
<h2 id="perf-heading">Portfolio performance</h2>
<span class="subtext">Equal-weight — all starred stocks</span>
</div>
<div class="kpi-strip" id="kpi-strip"></div>
</section>
<!-- ===== Sector heatmap ===== -->
<section aria-labelledby="heatmap-heading" class="heatmap-section">
<div class="section-header tight">
<h2 id="heatmap-heading">Watchlist heatmap</h2>
<span class="subtext">Tile color = today change · size = portfolio weight</span>
</div>
<div class="heatmap" id="heatmap" role="list" aria-label="Watchlist heatmap by today's change"></div>
</section>
<!-- ===== Individual stocks ===== -->
<section class="section" aria-labelledby="stocks-heading">
<div class="section-header">
<div>
<h2 id="stocks-heading">Individual stocks // starred</h2>
<p class="subtext">Every ticker pulled from your TradingView starred watchlist. Action column = combined signal from your selected strategies. Click a row to drill down.</p>
</div>
<span id="aggregate-signal" aria-live="polite"></span>
</div>
<div class="table-wrap">
<table class="stocks" id="stocks-table">
<caption class="sr-only">Starred TradingView stocks with live price, change, expected Monte Carlo return, strategy action and sentiment.</caption>
<thead>
<tr>
<th scope="col" aria-sort="none"><button type="button" data-sort="ticker">Ticker <span class="sort-ind" aria-hidden="true">⇅</span></button></th>
<th scope="col">Name</th>
<th scope="col" class="spark-col">60D</th>
<th scope="col" class="num" aria-sort="none"><button type="button" data-sort="price">Price <span class="sort-ind" aria-hidden="true">⇅</span></button></th>
<th scope="col" class="num" aria-sort="none"><button type="button" data-sort="change">Chg% <span class="sort-ind" aria-hidden="true">⇅</span></button></th>
<th scope="col" class="num" aria-sort="none"><button type="button" data-sort="expRet">MC E[R] <span class="sort-ind" aria-hidden="true">⇅</span></button></th>
<th scope="col" class="num">95% CI</th>
<th scope="col" class="num" aria-sort="none"><button type="button" data-sort="sentiment">Sent</button></th>
<th scope="col">Pressure</th>
<th scope="col">Conviction</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody id="stocks-body"></tbody>
</table>
</div>
<p class="table-help subtext" id="table-help">Tip: click any row or press Enter on a focused row to select that ticker.</p>
</section>
<!-- ===== Detail for selected ticker ===== -->
<section class="section" aria-labelledby="detail-heading" id="detail-section">
<div class="section-header">
<div>
<h2 id="detail-heading">Detail // <span id="detail-ticker">—</span> <span id="detail-name" class="subtext"></span></h2>
<p class="subtext" id="detail-subtitle">Click a row in the table above to drill into a specific stock.</p>
</div>
<span id="detail-signal" aria-live="polite"></span>
</div>
<div class="grid-2">
<figure class="chart-wrap" aria-labelledby="mc-heading">
<span class="chart-crt-layer" aria-hidden="true"></span>
<h3 id="mc-heading">Monte Carlo price paths</h3>
<div id="mc-chart" role="img" aria-label="Loading chart" tabindex="0" aria-describedby="mc-crosshair-help"></div>
<p id="mc-crosshair-help" class="sr-only">Use left and right arrow keys to move the crosshair across trading days; press Home or End to jump to first or last day.</p>
<div id="mc-crosshair-sr" class="sr-only" aria-live="polite" aria-atomic="true"></div>
<figcaption id="mc-caption">Run a simulation to see projected price paths.</figcaption>
<table class="sr-only" id="mc-data-table" aria-label="Monte Carlo summary statistics">
<caption>Simulation summary</caption>
<thead><tr><th scope="col">Statistic</th><th scope="col">Value</th></tr></thead>
<tbody id="mc-data-body"></tbody>
</table>
</figure>
<div class="sentiment-wrap" aria-labelledby="sentiment-heading">
<h3 id="sentiment-heading">X sentiment</h3>
<div class="sentiment-bars" role="img" aria-label="Sentiment distribution" id="sentiment-bars-wrap">
<div class="sentiment-bar-pos" id="sent-bar-pos" style="width: 0%"></div>
<div class="sentiment-bar-neu" id="sent-bar-neu" style="width: 0%"></div>
<div class="sentiment-bar-neg" id="sent-bar-neg" style="width: 0%"></div>
</div>
<div class="sentiment-stats" aria-label="Sentiment breakdown">
<div class="sentiment-stat">
<div class="sentiment-stat-label" id="sent-pos-lbl">Positive</div>
<div class="sentiment-stat-value delta-up" id="sent-pos-val" aria-labelledby="sent-pos-lbl">—</div>
</div>
<div class="sentiment-stat">
<div class="sentiment-stat-label" id="sent-neu-lbl">Neutral</div>
<div class="sentiment-stat-value" id="sent-neu-val" aria-labelledby="sent-neu-lbl">—</div>
</div>
<div class="sentiment-stat">
<div class="sentiment-stat-label" id="sent-neg-lbl">Negative</div>
<div class="sentiment-stat-value delta-down" id="sent-neg-val" aria-labelledby="sent-neg-lbl">—</div>
</div>
</div>
<h4 id="recent-posts">Recent posts</h4>
<ul class="posts" id="post-list" aria-labelledby="recent-posts"></ul>
</div>
</div>
<div>
<h3 id="strategy-breakdown-heading">Per-strategy signals // <span id="detail-ticker-2">—</span></h3>
<div class="strategy-grid" id="strategy-grid" aria-labelledby="strategy-breakdown-heading"></div>
</div>
</section>
<!-- ===== Summary ===== -->
<section class="section" aria-labelledby="summary-heading">
<div class="section-header">
<div>
<h2 id="summary-heading">Starred watchlist // summary</h2>
<p class="subtext" id="summary-subtitle">Narrative overview of every starred stock with combined signal and sentiment.</p>
</div>
<span id="summary-signal"></span>
</div>
<div class="summary-grid" id="summary-grid"></div>
</section>
</div>
<!-- ===== Right rail ===== -->
<aside class="side-rail" aria-label="Key session metrics">
<div class="rail-box" id="rail-winrate">
<p class="rail-box-label">Win rate</p>
<p class="rail-box-value up" id="rail-winrate-val">—</p>
<p class="rail-box-sub" id="rail-winrate-sub">Pr(MC final > entry)</p>
</div>
<div class="rail-box gauge-box" id="rail-sharpe">
<p class="rail-box-label">Sharpe</p>
<div class="gauge-wrap" id="gauge-sharpe" role="img" aria-label="Sharpe gauge">
<svg class="gauge" viewBox="0 0 120 68" aria-hidden="true">
<path class="gauge-track" d="M10,60 A50,50 0 0,1 110,60"/>
<path class="gauge-fill" id="gauge-sharpe-arc" d="M10,60 A50,50 0 0,1 110,60"/>
<line class="gauge-needle" id="gauge-sharpe-needle" x1="60" y1="60" x2="60" y2="16"/>
<circle class="gauge-hub" cx="60" cy="60" r="4"/>
<line class="gauge-tick" x1="60" y1="14" x2="60" y2="10" stroke-width="2"/>
</svg>
</div>
<p class="rail-box-value" id="rail-sharpe-val">—</p>
<p class="rail-box-sub" id="rail-sharpe-sub">Ex-ante · rf 4.5%</p>
</div>
<div class="rail-box" id="rail-er">
<p class="rail-box-label">E[R]</p>
<p class="rail-box-value" id="rail-er-val">—</p>
<p class="rail-box-sub" id="rail-er-sub">Portfolio, 30d</p>
</div>
<div class="rail-box down gauge-box" id="rail-var">
<p class="rail-box-label">VaR 95%</p>
<div class="gauge-wrap" id="gauge-var" role="img" aria-label="VaR gauge">
<svg class="gauge" viewBox="0 0 120 68" aria-hidden="true">
<path class="gauge-track" d="M10,60 A50,50 0 0,1 110,60"/>
<path class="gauge-fill danger" id="gauge-var-arc" d="M10,60 A50,50 0 0,1 110,60"/>
<line class="gauge-needle danger" id="gauge-var-needle" x1="60" y1="60" x2="60" y2="16"/>
<circle class="gauge-hub" cx="60" cy="60" r="4"/>
<line class="gauge-tick" x1="60" y1="14" x2="60" y2="10" stroke-width="2"/>
</svg>
</div>
<p class="rail-box-value down" id="rail-var-val">—</p>
<p class="rail-box-sub" id="rail-var-sub">5th-percentile outcome</p>
</div>
<div class="rail-box" id="rail-sent">
<p class="rail-box-label">Crowd score</p>
<p class="rail-box-value" id="rail-sent-val">—</p>
<p class="rail-box-sub">X net pos − neg</p>
</div>
<div class="rail-box" id="rail-buys">
<p class="rail-box-label">Buys/Sells</p>
<p class="rail-box-value" id="rail-buys-val">—</p>
<p class="rail-box-sub" id="rail-buys-sub">Starred stocks</p>
</div>
</aside>
</div>
</main>
<!-- Particle effects layer -->
<div id="fx-layer" class="fx-layer" aria-hidden="true"></div>
<!-- SVG gradient defs for sparklines -->
<svg aria-hidden="true" focusable="false" width="0" height="0" style="position:absolute">
<defs>
<linearGradient id="spark-grad-up" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#00ff88" stop-opacity="0.55"/>
<stop offset="100%" stop-color="#00ff88" stop-opacity="0"/>
</linearGradient>
<linearGradient id="spark-grad-down" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#ff3366" stop-opacity="0.55"/>
<stop offset="100%" stop-color="#ff3366" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>
<footer class="app-footer" role="contentinfo">
<span>MC engine: Geometric Brownian Motion // Sentiment: X API v2 (simulated) // WCAG 2.2 AA</span>
<span class="brand-mark">STV<span class="dot">.</span></span>
</footer>
</div>
<script src="app.js"></script>
</body>
</html>