dsh-stock-analysis 0.2.10 → 0.2.12
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.
- package/README.md +39 -76
- package/dist/client.js +88 -0
- package/dist/index.js +3710 -2106
- package/dist/web/app.js +903 -0
- package/dist/web/index.html +87 -0
- package/dist/web/style.css +293 -0
- package/package.json +13 -3
- package/scripts/cli-json.mjs +23 -0
- package/scripts/exec-process.mjs +89 -0
- package/scripts/setup-python.mjs +37 -4
- package/scripts/tool-calls.mjs +489 -0
- package/skills/event-driven/SKILL.md +2 -2
- package/skills/growth-quality/SKILL.md +1 -1
- package/skills/stock-analysis/SKILL.md +12 -7
- package/skills/stock-analysis/references/stateless-analysis.md +9 -1
- package/tools/_cache.py +13 -0
- package/tools/_subproc.py +46 -0
- package/tools/alert_rules.py +65 -16
- package/tools/backtest.py +3 -3
- package/tools/capabilities.py +32 -9
- package/tools/cli_budgets.json +2 -0
- package/tools/diagnostics.py +3 -4
- package/tools/gather.py +2 -6
- package/tools/import_parser.py +3 -4
- package/tools/lixinger.py +119 -27
- package/tools/market_regime.py +5 -2
- package/tools/market_review.py +5 -6
- package/tools/name_resolver.py +82 -21
- package/tools/report_renderer.py +3 -3
- package/tools/requirements.txt +6 -5
- package/tools/risk_screening.py +3 -2
- package/tools/screener.py +6 -4
- package/tools/search_intel.py +81 -12
- package/tools/sec_edgar.py +266 -0
- package/tools/sec_holders.py +6 -0
- package/tools/signal_tracker.py +11 -10
- package/tools/stateless_analysis.py +115 -0
- package/tools/stock_data.py +707 -222
- package/tools/tiaa_disclosures.py +267 -0
- package/tools/tool_schemas.json +2704 -0
- package/tools/trading_calendar.py +65 -30
- package/tools/value_data.py +366 -134
- package/tools/watchlist.py +43 -5
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<meta name="description" content="在 DeepSeek Harness 中查看自选股与六市场指数。">
|
|
8
|
+
<title>股票仪表盘</title>
|
|
9
|
+
<link rel="stylesheet" href="./style.css">
|
|
10
|
+
<script src="./app.js" defer></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="app">
|
|
14
|
+
<header class="bar">
|
|
15
|
+
<div class="bar-title">
|
|
16
|
+
<h1>自选</h1>
|
|
17
|
+
<span id="watch-count" class="count">0</span>
|
|
18
|
+
</div>
|
|
19
|
+
<p id="status" class="status" role="status" aria-live="polite">正在连接行情服务…</p>
|
|
20
|
+
<div class="bar-actions">
|
|
21
|
+
<button id="refresh" class="btn ghost" type="button" title="立即刷新全部行情">
|
|
22
|
+
<svg class="refresh-icon" viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6v5h-5"/><path d="M18.4 15a7 7 0 1 1-.8-7.8L20 9"/></svg>
|
|
23
|
+
<span>刷新</span>
|
|
24
|
+
</button>
|
|
25
|
+
<button id="add-toggle" class="btn primary" type="button" aria-expanded="false" aria-controls="add-form">
|
|
26
|
+
<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M10 4v12M4 10h12"/></svg>
|
|
27
|
+
<span>添加</span>
|
|
28
|
+
</button>
|
|
29
|
+
</div>
|
|
30
|
+
</header>
|
|
31
|
+
|
|
32
|
+
<form id="add-form" class="add" hidden>
|
|
33
|
+
<label class="sr-only" for="symbol-input">股票代码,多个用逗号分隔</label>
|
|
34
|
+
<input id="symbol-input" type="text" placeholder="600519, 00700.HK, AAPL, 7203.T" autocomplete="off" spellcheck="false" maxlength="512" required>
|
|
35
|
+
<button class="btn primary" type="submit">加入自选</button>
|
|
36
|
+
<button id="add-cancel" class="btn ghost" type="button">取消</button>
|
|
37
|
+
<p class="add-hint">A 股填 6 位代码;港股 .HK、日股 .T、韩股 .KS/.KQ、台股 .TW,美股直接填代码。最多 30 只。</p>
|
|
38
|
+
<p id="add-message" class="add-message" role="status" aria-live="polite"></p>
|
|
39
|
+
</form>
|
|
40
|
+
|
|
41
|
+
<section id="ribbon-wrap" class="ribbon" aria-label="主要指数">
|
|
42
|
+
<div id="ribbon" class="ribbon-track"></div>
|
|
43
|
+
<button class="ribbon-nav prev" type="button" data-step="-1" aria-label="查看前面的指数" hidden>
|
|
44
|
+
<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.5 4.5L7 10l5.5 5.5"/></svg>
|
|
45
|
+
</button>
|
|
46
|
+
<button class="ribbon-nav next" type="button" data-step="1" aria-label="查看更多市场指数" hidden>
|
|
47
|
+
<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.5 4.5L13 10l-5.5 5.5"/></svg>
|
|
48
|
+
</button>
|
|
49
|
+
</section>
|
|
50
|
+
<div id="pulse" class="pulse" aria-label="A 股市场宽度"></div>
|
|
51
|
+
|
|
52
|
+
<section class="watch" aria-labelledby="watch-heading">
|
|
53
|
+
<h2 id="watch-heading" class="sr-only">自选股行情</h2>
|
|
54
|
+
<div id="filters" class="filters" role="toolbar" aria-label="按市场筛选" hidden></div>
|
|
55
|
+
<div id="watch-error" class="notice" role="alert" hidden></div>
|
|
56
|
+
<div class="table-wrap">
|
|
57
|
+
<table class="quotes">
|
|
58
|
+
<thead>
|
|
59
|
+
<tr>
|
|
60
|
+
<th scope="col" class="c-name"><button type="button" data-sort="order">名称</button></th>
|
|
61
|
+
<th scope="col" class="c-num"><button type="button" data-sort="price">最新</button></th>
|
|
62
|
+
<th scope="col" class="c-num"><button type="button" data-sort="change_pct">涨跌幅</button></th>
|
|
63
|
+
<th scope="col" class="c-num c-change"><button type="button" data-sort="change">涨跌额</button></th>
|
|
64
|
+
<th scope="col" class="c-range">今日区间</th>
|
|
65
|
+
<th scope="col" class="c-num c-amount"><button type="button" data-sort="turnover">成交额</button></th>
|
|
66
|
+
<th scope="col" class="c-trend"><button type="button" data-sort="trend">30 日</button></th>
|
|
67
|
+
<th scope="col" class="c-act"><span class="sr-only">操作</span></th>
|
|
68
|
+
</tr>
|
|
69
|
+
</thead>
|
|
70
|
+
<tbody id="rows"></tbody>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<section class="market" aria-labelledby="market-heading">
|
|
76
|
+
<div class="market-head">
|
|
77
|
+
<h2 id="market-heading">市场</h2>
|
|
78
|
+
<div id="market-tabs" class="tabs" role="tablist" aria-label="切换市场"></div>
|
|
79
|
+
</div>
|
|
80
|
+
<div id="market-body" class="market-body" role="tabpanel" aria-labelledby="market-heading"></div>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
<footer class="foot">报价可能延迟,悬停名称可查看来源与报价时间。交易时段内有页面打开时约每 30 秒更新一次,后台每 5 分钟预热;30 日走势为最近 30 个有效交易日收盘价。</footer>
|
|
84
|
+
</div>
|
|
85
|
+
<div id="tip" class="tip" role="tooltip" hidden></div>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: light;
|
|
3
|
+
--bg: #f6f7f9;
|
|
4
|
+
--surface: #ffffff;
|
|
5
|
+
--surface-subtle: #f1f3f6;
|
|
6
|
+
--text: #1d2129;
|
|
7
|
+
--muted: #646c78;
|
|
8
|
+
--border: #e3e6eb;
|
|
9
|
+
--accent: #3159d9;
|
|
10
|
+
--on-accent: #ffffff;
|
|
11
|
+
--up: #d63340;
|
|
12
|
+
--down: #0a7f4b;
|
|
13
|
+
--up-fill: #d63340;
|
|
14
|
+
--down-fill: #0a7f4b;
|
|
15
|
+
--up-tint: rgba(214, 51, 64, .14);
|
|
16
|
+
--down-tint: rgba(10, 127, 75, .14);
|
|
17
|
+
--warn: #8a5a00;
|
|
18
|
+
--shadow: 0 6px 20px -8px rgba(20, 24, 32, .28);
|
|
19
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
|
|
20
|
+
font-synthesis: none;
|
|
21
|
+
-webkit-font-smoothing: antialiased;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:root[data-theme="dark"] {
|
|
25
|
+
color-scheme: dark;
|
|
26
|
+
--bg: #111317;
|
|
27
|
+
--surface: #181b20;
|
|
28
|
+
--surface-subtle: #20242a;
|
|
29
|
+
--text: #e9edf2;
|
|
30
|
+
--muted: #9aa3ae;
|
|
31
|
+
--border: #2c3138;
|
|
32
|
+
--accent: #8ea6ff;
|
|
33
|
+
--on-accent: #10173a;
|
|
34
|
+
--up: #ff6b72;
|
|
35
|
+
--down: #3ccf8e;
|
|
36
|
+
--up-fill: #c8323b;
|
|
37
|
+
--down-fill: #0d7a48;
|
|
38
|
+
--up-tint: rgba(255, 107, 114, .16);
|
|
39
|
+
--down-tint: rgba(60, 207, 142, .16);
|
|
40
|
+
--warn: #e8bd6a;
|
|
41
|
+
--shadow: 0 8px 24px -8px rgba(0, 0, 0, .6);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media (prefers-color-scheme: dark) {
|
|
45
|
+
:root:not([data-theme="light"]) {
|
|
46
|
+
color-scheme: dark;
|
|
47
|
+
--bg: #111317;
|
|
48
|
+
--surface: #181b20;
|
|
49
|
+
--surface-subtle: #20242a;
|
|
50
|
+
--text: #e9edf2;
|
|
51
|
+
--muted: #9aa3ae;
|
|
52
|
+
--border: #2c3138;
|
|
53
|
+
--accent: #8ea6ff;
|
|
54
|
+
--on-accent: #10173a;
|
|
55
|
+
--up: #ff6b72;
|
|
56
|
+
--down: #3ccf8e;
|
|
57
|
+
--up-fill: #c8323b;
|
|
58
|
+
--down-fill: #0d7a48;
|
|
59
|
+
--up-tint: rgba(255, 107, 114, .16);
|
|
60
|
+
--down-tint: rgba(60, 207, 142, .16);
|
|
61
|
+
--warn: #e8bd6a;
|
|
62
|
+
--shadow: 0 8px 24px -8px rgba(0, 0, 0, .6);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
* { box-sizing: border-box; }
|
|
67
|
+
html { background: var(--bg); scrollbar-color: var(--border) transparent; scrollbar-width: thin; }
|
|
68
|
+
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.45; }
|
|
69
|
+
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); }
|
|
70
|
+
::-webkit-scrollbar { width: 8px; height: 8px; }
|
|
71
|
+
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
|
|
72
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
73
|
+
button, input { font: inherit; color: inherit; }
|
|
74
|
+
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
|
|
75
|
+
button:disabled { cursor: default; opacity: .55; }
|
|
76
|
+
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
|
77
|
+
[hidden] { display: none !important; }
|
|
78
|
+
h1, h2, p { margin: 0; }
|
|
79
|
+
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
|
80
|
+
.num { font-variant-numeric: tabular-nums; }
|
|
81
|
+
.up { color: var(--up); }
|
|
82
|
+
.down { color: var(--down); }
|
|
83
|
+
.flat { color: var(--muted); }
|
|
84
|
+
|
|
85
|
+
.app { width: min(100%, 1280px); margin: 0 auto; padding: 16px 20px 20px; }
|
|
86
|
+
|
|
87
|
+
/* ---------- top bar ---------- */
|
|
88
|
+
.bar { display: flex; align-items: center; gap: 14px; min-height: 34px; }
|
|
89
|
+
.bar-title { display: flex; align-items: baseline; gap: 8px; }
|
|
90
|
+
h1 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
|
|
91
|
+
.count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
92
|
+
.status { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
93
|
+
.status .live { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: live 2.4s cubic-bezier(.16, 1, .3, 1) infinite; }
|
|
94
|
+
.status .warn { color: var(--warn); }
|
|
95
|
+
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
|
|
96
|
+
.bar-actions { display: flex; gap: 8px; }
|
|
97
|
+
.btn { height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 7px; border: 1px solid transparent; font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, opacity .16s ease; }
|
|
98
|
+
.btn.primary { background: var(--accent); color: var(--on-accent); }
|
|
99
|
+
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
|
|
100
|
+
.btn.ghost { background: var(--surface); border-color: var(--border); }
|
|
101
|
+
.btn.ghost:hover:not(:disabled) { background: var(--surface-subtle); }
|
|
102
|
+
.btn:active:not(:disabled) { transform: translateY(1px); }
|
|
103
|
+
.busy .refresh-icon { animation: spin .9s linear infinite; }
|
|
104
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
105
|
+
|
|
106
|
+
.add { display: grid; grid-template-columns: minmax(0, 420px) auto auto 1fr; align-items: center; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
|
|
107
|
+
.add input { height: 32px; min-width: 0; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-subtle); caret-color: var(--accent); }
|
|
108
|
+
.add input::placeholder { color: var(--muted); opacity: 1; }
|
|
109
|
+
.add input:focus { border-color: var(--accent); outline: none; }
|
|
110
|
+
.add-hint, .add-message { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
|
|
111
|
+
.add-message:empty { display: none; }
|
|
112
|
+
.add-message.error { color: var(--up); }
|
|
113
|
+
|
|
114
|
+
/* ---------- index ribbon ---------- */
|
|
115
|
+
.ribbon { position: relative; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
|
|
116
|
+
.ribbon.more-right .ribbon-track { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent); }
|
|
117
|
+
.ribbon.more-left .ribbon-track { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 72px), transparent); }
|
|
118
|
+
.ribbon.more-left.more-right .ribbon-track { -webkit-mask-image: linear-gradient(to right, transparent, #000 72px, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(to right, transparent, #000 72px, #000 calc(100% - 72px), transparent); }
|
|
119
|
+
.ribbon-nav { position: absolute; top: 50%; width: 28px; height: 28px; margin-top: -14px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow); transition: background-color .16s ease; }
|
|
120
|
+
.ribbon-nav:hover { background: var(--surface-subtle); }
|
|
121
|
+
.ribbon-nav.prev { left: 8px; }
|
|
122
|
+
.ribbon-nav.next { right: 8px; }
|
|
123
|
+
.ribbon-track { display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
|
|
124
|
+
.ribbon-track::-webkit-scrollbar { display: none; }
|
|
125
|
+
.rgroup { flex: 0 0 auto; display: flex; flex-direction: column; scroll-snap-align: start; }
|
|
126
|
+
.rgroup + .rgroup { border-left: 1px solid var(--border); }
|
|
127
|
+
.rgroup-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px 0; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
|
|
128
|
+
.rgroup-head .phase { font-weight: 500; }
|
|
129
|
+
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); flex: none; }
|
|
130
|
+
.dot.on { background: var(--accent); }
|
|
131
|
+
.rgroup-tiles { display: flex; }
|
|
132
|
+
.tile { width: 140px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 1px 6px; padding: 4px 12px 9px; border: 0; border-radius: 0; background: transparent; text-align: left; transition: background-color .16s ease; }
|
|
133
|
+
.tile:hover { background: var(--surface-subtle); }
|
|
134
|
+
.tile-name { grid-column: 1 / -1; color: var(--text); font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
135
|
+
.tile-price { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
|
|
136
|
+
.tile-pct { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
137
|
+
.tile .spark { grid-column: 1 / -1; margin-top: 3px; }
|
|
138
|
+
|
|
139
|
+
.pulse { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-height: 36px; padding: 8px 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
140
|
+
.pulse strong { color: var(--text); font-weight: 600; }
|
|
141
|
+
.pulse .label { color: var(--text); font-weight: 600; }
|
|
142
|
+
.breadth { display: inline-flex; align-items: center; gap: 8px; }
|
|
143
|
+
.breadth-bar { display: flex; width: 180px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-subtle); }
|
|
144
|
+
.breadth-bar span { display: block; height: 100%; }
|
|
145
|
+
.breadth-bar .u { background: var(--up); }
|
|
146
|
+
.breadth-bar .f { background: var(--border); }
|
|
147
|
+
.breadth-bar .d { background: var(--down); }
|
|
148
|
+
|
|
149
|
+
/* ---------- watchlist table ---------- */
|
|
150
|
+
.watch { margin-top: 2px; }
|
|
151
|
+
.filters { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
|
|
152
|
+
.chip { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
153
|
+
.chip:hover { color: var(--text); }
|
|
154
|
+
.chip[aria-pressed="true"] { border-color: transparent; background: var(--text); color: var(--bg); }
|
|
155
|
+
.notice { margin-bottom: 8px; padding: 8px 12px; border-radius: 8px; background: var(--up-tint); color: var(--up); font-size: 12px; }
|
|
156
|
+
.table-wrap { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow-x: auto; }
|
|
157
|
+
table { width: 100%; border-collapse: collapse; }
|
|
158
|
+
.quotes th { padding: 0 12px; height: 34px; color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
|
|
159
|
+
.quotes th button { padding: 0; border: 0; background: none; color: inherit; font-weight: inherit; }
|
|
160
|
+
.quotes th button:hover { color: var(--text); }
|
|
161
|
+
.quotes th[aria-sort] button { color: var(--text); font-weight: 600; }
|
|
162
|
+
.quotes th[aria-sort="descending"] button::after { content: " ↓"; }
|
|
163
|
+
.quotes th[aria-sort="ascending"] button::after { content: " ↑"; }
|
|
164
|
+
.quotes td { height: 56px; padding: 6px 12px; border-top: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
|
|
165
|
+
.quotes tbody tr:first-child td { border-top: 0; }
|
|
166
|
+
.quotes tbody tr { transition: background-color .16s ease; }
|
|
167
|
+
.quotes tbody tr:hover { background: color-mix(in srgb, var(--surface-subtle) 70%, transparent); }
|
|
168
|
+
.c-num { text-align: right !important; }
|
|
169
|
+
.c-name { width: 230px; min-width: 180px; }
|
|
170
|
+
.quotes th.c-num { width: 100px; }
|
|
171
|
+
.quotes th.c-change { width: 84px; }
|
|
172
|
+
.quotes th.c-amount { width: 96px; }
|
|
173
|
+
.quotes th.c-range { width: 136px; }
|
|
174
|
+
.name { display: block; max-width: 22em; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
|
|
175
|
+
.meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--muted); font-size: 11px; }
|
|
176
|
+
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11px; }
|
|
177
|
+
.tag { padding: 0 4px; border-radius: 3px; background: var(--surface-subtle); font-size: 10.5px; line-height: 16px; }
|
|
178
|
+
.stale { color: var(--warn); }
|
|
179
|
+
.is-stale .tile-price, .is-stale .tile-pct, .is-stale .iprice, .is-stale .ipct { opacity: .55; }
|
|
180
|
+
.price { font-size: 15px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; border-radius: 5px; }
|
|
181
|
+
.price.flash-up { animation: flash-up 1.4s cubic-bezier(.16, 1, .3, 1); }
|
|
182
|
+
.price.flash-down { animation: flash-down 1.4s cubic-bezier(.16, 1, .3, 1); }
|
|
183
|
+
@keyframes flash-up { from { background: var(--up-tint); box-shadow: 0 0 0 4px var(--up-tint); } to { background: transparent; box-shadow: 0 0 0 4px transparent; } }
|
|
184
|
+
@keyframes flash-down { from { background: var(--down-tint); box-shadow: 0 0 0 4px var(--down-tint); } to { background: transparent; box-shadow: 0 0 0 4px transparent; } }
|
|
185
|
+
.pill { display: inline-block; min-width: 70px; padding: 4px 8px; border-radius: 6px; font-size: 13px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
|
|
186
|
+
.pill.up { background: var(--up-fill); color: #fff; }
|
|
187
|
+
.pill.down { background: var(--down-fill); color: #fff; }
|
|
188
|
+
.pill.flat { background: var(--surface-subtle); color: var(--muted); }
|
|
189
|
+
.change, .amount { font-size: 13px; font-variant-numeric: tabular-nums; }
|
|
190
|
+
.amount { color: var(--muted); }
|
|
191
|
+
.range { width: 112px; }
|
|
192
|
+
.range-track { position: relative; height: 4px; border-radius: 2px; background: var(--surface-subtle); }
|
|
193
|
+
.range-prev { position: absolute; top: -3px; width: 1px; height: 10px; background: var(--muted); opacity: .6; }
|
|
194
|
+
.range-mark { position: absolute; top: -4px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: currentColor; }
|
|
195
|
+
.range-label { margin-top: 5px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
196
|
+
.c-trend { padding-left: 20px !important; }
|
|
197
|
+
.trend-cell { display: flex; align-items: center; gap: 8px; }
|
|
198
|
+
.trend-pct { min-width: 52px; font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
|
|
199
|
+
.c-act { width: 40px; padding-left: 0 !important; }
|
|
200
|
+
.remove { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); opacity: 0; transition: opacity .16s ease, background-color .16s ease, color .16s ease; }
|
|
201
|
+
tr:hover .remove, .remove:focus-visible { opacity: 1; }
|
|
202
|
+
.remove:hover { background: var(--up-tint); color: var(--up); }
|
|
203
|
+
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
|
|
204
|
+
.empty strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 14px; }
|
|
205
|
+
.empty .btn { margin-top: 12px; }
|
|
206
|
+
|
|
207
|
+
/* ---------- sparkline ---------- */
|
|
208
|
+
.spark { display: block; overflow: visible; touch-action: none; }
|
|
209
|
+
.spark .line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
|
|
210
|
+
.spark .area { fill: currentColor; opacity: .09; }
|
|
211
|
+
.spark .base { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
|
|
212
|
+
.spark .end { fill: currentColor; }
|
|
213
|
+
.spark .guide { stroke: var(--muted); stroke-width: 1; opacity: .7; }
|
|
214
|
+
.spark .hover-dot { fill: var(--surface); stroke: currentColor; stroke-width: 1.5; }
|
|
215
|
+
.sk { display: inline-block; height: 10px; border-radius: 4px; background: var(--surface-subtle); animation: pulse 1.6s ease-in-out infinite; vertical-align: middle; }
|
|
216
|
+
@keyframes pulse { 50% { opacity: .45; } }
|
|
217
|
+
|
|
218
|
+
/* ---------- market detail ---------- */
|
|
219
|
+
.market { margin-top: 22px; }
|
|
220
|
+
.market-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
|
|
221
|
+
.market-head h2 { font-size: 14px; font-weight: 650; white-space: nowrap; }
|
|
222
|
+
.tabs { display: flex; min-width: 0; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-subtle); overflow-x: auto; }
|
|
223
|
+
.tab { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; }
|
|
224
|
+
.tab:hover { color: var(--text); }
|
|
225
|
+
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
|
|
226
|
+
.market-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
|
|
227
|
+
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
|
|
228
|
+
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
|
|
229
|
+
.panel-head h3 { margin: 0; font-size: 13px; font-weight: 650; }
|
|
230
|
+
.panel-head span { color: var(--muted); font-size: 11.5px; }
|
|
231
|
+
.idx td { height: 44px; padding: 4px 14px; border-top: 1px solid var(--border); white-space: nowrap; }
|
|
232
|
+
.idx tr:first-child td { border-top: 0; }
|
|
233
|
+
.idx .iname { font-weight: 600; }
|
|
234
|
+
.idx .icode { display: block; color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 10.5px; }
|
|
235
|
+
.idx .iprice { text-align: right; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
|
|
236
|
+
.idx .ipct { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
237
|
+
.idx .ispark { width: 110px; }
|
|
238
|
+
.side { display: grid; gap: 14px; }
|
|
239
|
+
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 8px 14px 14px; border-radius: 8px; overflow: hidden; background: var(--border); }
|
|
240
|
+
.stats div { padding: 8px 10px; background: var(--surface); }
|
|
241
|
+
.stats dt { color: var(--muted); font-size: 11px; }
|
|
242
|
+
.stats dd { margin: 2px 0 0; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
|
|
243
|
+
.breadth-wide { padding: 6px 14px 0; }
|
|
244
|
+
.breadth-wide .breadth-bar { width: 100%; height: 8px; border-radius: 4px; }
|
|
245
|
+
.breadth-legend { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
246
|
+
.sectors { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 4px 14px 12px; }
|
|
247
|
+
.sectors h4 { margin: 6px 0 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
|
|
248
|
+
.sector { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; padding: 5px 0; }
|
|
249
|
+
.sector-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
250
|
+
.sector-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
251
|
+
.sector-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--surface-subtle); overflow: hidden; }
|
|
252
|
+
.sector-bar span { display: block; height: 100%; background: currentColor; opacity: .75; }
|
|
253
|
+
.sector-lead { grid-column: 1 / -1; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
254
|
+
.session { padding: 6px 14px 14px; color: var(--muted); font-size: 12px; }
|
|
255
|
+
.session dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 6px 0 10px; }
|
|
256
|
+
.session dt { color: var(--muted); }
|
|
257
|
+
.session dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
|
|
258
|
+
.panel-note { padding: 14px; color: var(--muted); font-size: 12px; }
|
|
259
|
+
.foot { margin-top: 16px; color: var(--muted); font-size: 11px; max-width: 110ch; }
|
|
260
|
+
|
|
261
|
+
.tip { position: fixed; z-index: 10; padding: 6px 9px; border-radius: 7px; background: var(--text); color: var(--bg); font-size: 11.5px; line-height: 1.45; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
|
|
262
|
+
.tip b { font-weight: 650; }
|
|
263
|
+
|
|
264
|
+
@media (max-width: 980px) {
|
|
265
|
+
.c-change, .c-amount { display: none; }
|
|
266
|
+
.market-body { grid-template-columns: minmax(0, 1fr); }
|
|
267
|
+
}
|
|
268
|
+
@media (max-width: 720px) {
|
|
269
|
+
.app { padding: 12px; }
|
|
270
|
+
.bar { flex-wrap: wrap; }
|
|
271
|
+
.status { order: 3; flex-basis: 100%; }
|
|
272
|
+
.bar-actions { margin-left: auto; }
|
|
273
|
+
.bar-actions .btn span { display: none; }
|
|
274
|
+
.c-range { display: none; }
|
|
275
|
+
.c-trend { width: 120px; }
|
|
276
|
+
.trend-pct { display: none; }
|
|
277
|
+
.c-name { width: auto; }
|
|
278
|
+
.name { max-width: 9em; }
|
|
279
|
+
.pill { min-width: 62px; }
|
|
280
|
+
.remove { opacity: 1; }
|
|
281
|
+
.add { grid-template-columns: 1fr auto; }
|
|
282
|
+
.add #add-cancel { display: none; }
|
|
283
|
+
.breadth-bar { width: 120px; }
|
|
284
|
+
.sectors { grid-template-columns: 1fr; }
|
|
285
|
+
}
|
|
286
|
+
@media (max-width: 520px) {
|
|
287
|
+
.c-trend, .idx .ispark { display: none; }
|
|
288
|
+
.idx td { padding: 4px 10px; }
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@media (prefers-reduced-motion: reduce) {
|
|
292
|
+
*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
|
|
293
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-stock-analysis",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "DeepSeek Harness (dsh) plugin for stock analysis, screening, and strategy backtesting across A/HK/US/JP/KR/TW markets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
9
|
+
"./client": "./dist/client.js",
|
|
9
10
|
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
10
11
|
"./research-role": "./dist/research-role.js",
|
|
11
12
|
"./research.patch.yml": "./research.patch.yml",
|
|
@@ -14,6 +15,15 @@
|
|
|
14
15
|
"dsh": {
|
|
15
16
|
"bundle": {
|
|
16
17
|
"patch": "./cordis.patch.yml"
|
|
18
|
+
},
|
|
19
|
+
"client": {
|
|
20
|
+
"platform": "web",
|
|
21
|
+
"immediately": true,
|
|
22
|
+
"inject": [
|
|
23
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
24
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
25
|
+
"@deepseek-ai/dsh-client-ui-theme"
|
|
26
|
+
]
|
|
17
27
|
}
|
|
18
28
|
},
|
|
19
29
|
"scripts": {
|
|
@@ -51,7 +61,7 @@
|
|
|
51
61
|
"license": "MIT",
|
|
52
62
|
"peerDependencies": {
|
|
53
63
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
54
|
-
"@deepseek-ai/dsh-skill": "^0.0.1-rc.1 || ^0.1.7-rc.1 || ^0.2.0-rc.2 || ^0.2.1-rc.2",
|
|
55
|
-
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1 || ^0.1.7-rc.1 || ^0.2.0-rc.2 || ^0.2.1-rc.2"
|
|
64
|
+
"@deepseek-ai/dsh-skill": "^0.0.1-rc.1 || ^0.1.7-rc.1 || ^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-rc.1",
|
|
65
|
+
"@deepseek-ai/dsh-tools": "^0.0.1-rc.1 || ^0.1.7-rc.1 || ^0.2.0-rc.2 || ^0.2.1-rc.2 || ^0.2.2-rc.1"
|
|
56
66
|
}
|
|
57
67
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Shared host-side CLI result rules; every adapter must surface failures the same way.
|
|
2
|
+
export const failureMessage = (error) =>
|
|
3
|
+
error.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER" ? "Python command output exceeded buffer limit"
|
|
4
|
+
: error.killed ? "Python command timed out"
|
|
5
|
+
: typeof error.code === "number" ? `Python command failed (exit ${error.code}); check interpreter/dependencies`
|
|
6
|
+
: "Python command failed; check interpreter/dependencies";
|
|
7
|
+
|
|
8
|
+
// Failed, empty, or non-JSON CLI output becomes a JSON error; a CLI-provided JSON error is kept.
|
|
9
|
+
export function cliJson(stdout, failure) {
|
|
10
|
+
try {
|
|
11
|
+
const data = JSON.parse(stdout);
|
|
12
|
+
if (!failure || (data && typeof data.error === "string")) return stdout;
|
|
13
|
+
} catch {
|
|
14
|
+
failure ??= stdout.trim() ? "Python command returned non-JSON output" : "Python command returned no JSON";
|
|
15
|
+
}
|
|
16
|
+
return JSON.stringify({ error: failure });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Explicit null optional args would otherwise reach argv as "null"; dropping them applies defaults.
|
|
20
|
+
export const withoutNulls = (params) =>
|
|
21
|
+
params && typeof params === "object" && !Array.isArray(params)
|
|
22
|
+
? Object.fromEntries(Object.entries(params).filter(([, value]) => value !== null))
|
|
23
|
+
: params;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as cp from "node:child_process";
|
|
2
|
+
|
|
3
|
+
function terminateTree(child) {
|
|
4
|
+
if (!child.pid) return;
|
|
5
|
+
if (process.platform === "win32") {
|
|
6
|
+
cp.execFile("taskkill", ["/F", "/T", "/PID", String(child.pid)], { timeout: 10_000 }, () => {});
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
process.kill(-child.pid, "SIGKILL");
|
|
11
|
+
} catch {
|
|
12
|
+
try { child.kill("SIGKILL"); } catch { /* already exited */ }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function failure(stdout, code, extra = {}) {
|
|
17
|
+
return Object.assign(new Error("Python command failed"), { stdout, code, ...extra });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// POSIX children run in their own session, so the host's terminal hangup no longer reaches them.
|
|
21
|
+
const live = new Set();
|
|
22
|
+
process.on("exit", () => { for (const child of live) terminateTree(child); });
|
|
23
|
+
|
|
24
|
+
/** execFile-compatible stdout collection that also terminates nested CLI children.
|
|
25
|
+
* @param {string} bin
|
|
26
|
+
* @param {string[]} argv
|
|
27
|
+
* @param {{timeoutMs?: number, maxBuffer?: number, signal?: AbortSignal}} [options]
|
|
28
|
+
*/
|
|
29
|
+
export function execFileTree(bin, argv, { timeoutMs, maxBuffer = 32 * 1024 * 1024, signal } = {}) {
|
|
30
|
+
if (signal?.aborted) {
|
|
31
|
+
return Promise.reject(Object.assign(new Error("The operation was aborted"), { name: "AbortError", stdout: "" }));
|
|
32
|
+
}
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const child = cp.spawn(bin, argv, {
|
|
35
|
+
detached: process.platform !== "win32",
|
|
36
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
37
|
+
windowsHide: true,
|
|
38
|
+
});
|
|
39
|
+
live.add(child);
|
|
40
|
+
const chunks = [];
|
|
41
|
+
const stdout = () => Buffer.concat(chunks).toString("utf8");
|
|
42
|
+
let bytes = 0;
|
|
43
|
+
let settled = false;
|
|
44
|
+
let timedOut = false;
|
|
45
|
+
let aborted = false;
|
|
46
|
+
let overflow = false;
|
|
47
|
+
|
|
48
|
+
const finish = (error) => {
|
|
49
|
+
if (settled) return;
|
|
50
|
+
settled = true;
|
|
51
|
+
if (timer) clearTimeout(timer);
|
|
52
|
+
signal?.removeEventListener("abort", onAbort);
|
|
53
|
+
if (error) reject(error);
|
|
54
|
+
else resolve(stdout());
|
|
55
|
+
};
|
|
56
|
+
const onAbort = () => {
|
|
57
|
+
aborted = true;
|
|
58
|
+
terminateTree(child);
|
|
59
|
+
};
|
|
60
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
61
|
+
const timer = timeoutMs > 0 ? setTimeout(() => {
|
|
62
|
+
timedOut = true;
|
|
63
|
+
terminateTree(child);
|
|
64
|
+
}, timeoutMs) : null;
|
|
65
|
+
timer?.unref();
|
|
66
|
+
|
|
67
|
+
child.stdout.on("data", chunk => {
|
|
68
|
+
if (bytes + chunk.length > maxBuffer) {
|
|
69
|
+
overflow = true;
|
|
70
|
+
terminateTree(child);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
bytes += chunk.length;
|
|
74
|
+
chunks.push(chunk);
|
|
75
|
+
});
|
|
76
|
+
child.on("error", error => {
|
|
77
|
+
error.stdout = stdout();
|
|
78
|
+
finish(error);
|
|
79
|
+
});
|
|
80
|
+
child.on("close", code => {
|
|
81
|
+
live.delete(child);
|
|
82
|
+
if (overflow) finish(failure(stdout(), "ERR_CHILD_PROCESS_STDIO_MAXBUFFER", { killed: true }));
|
|
83
|
+
else if (timedOut) finish(failure(stdout(), null, { killed: true }));
|
|
84
|
+
else if (aborted) finish(Object.assign(failure(stdout(), null), { name: "AbortError" }));
|
|
85
|
+
else if (code !== 0) finish(failure(stdout(), code));
|
|
86
|
+
else finish();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
package/scripts/setup-python.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { existsSync, mkdirSync, renameSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { pythonEnvironmentRoot, venvPythonPath } from "./venv-python.mjs";
|
|
@@ -19,6 +19,15 @@ function run(bin, args) {
|
|
|
19
19
|
execFileSync(bin, args, { stdio: "inherit", timeout: 1_800_000 });
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
function pipWorks() {
|
|
23
|
+
try {
|
|
24
|
+
execFileSync(venvPython, ["-m", "pip", "--version"], { stdio: "pipe" });
|
|
25
|
+
return true;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
function findPython() {
|
|
23
32
|
for (const name of ["python3", "python"]) {
|
|
24
33
|
try {
|
|
@@ -48,11 +57,35 @@ try {
|
|
|
48
57
|
mkdirSync(envRoot, { recursive: true });
|
|
49
58
|
renameSync(join(pkgDir, ".venv"), venvDir);
|
|
50
59
|
}
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
// A half-built venv (e.g. Debian without python3-venv) leaves python but no pip; rebuild it.
|
|
61
|
+
if (!existsSync(venvDir) || !pipWorks()) {
|
|
62
|
+
try {
|
|
63
|
+
run(python, ["-m", "venv", "--clear", venvDir]);
|
|
64
|
+
} catch (err) {
|
|
65
|
+
rmSync(venvDir, { recursive: true, force: true });
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
53
68
|
}
|
|
54
69
|
|
|
55
|
-
|
|
70
|
+
try {
|
|
71
|
+
run(venvPython, ["-m", "pip", "install", "-q", "-r", requirements]);
|
|
72
|
+
} catch {
|
|
73
|
+
// A failover provider without a wheel for this platform must not block the core tools.
|
|
74
|
+
const lines = readFileSync(requirements, "utf8").split(/\r?\n/).map(line => line.trim());
|
|
75
|
+
const marker = lines.findIndex(line => line.startsWith("# optional providers"));
|
|
76
|
+
const specs = list => list.filter(line => line && !line.startsWith("#"));
|
|
77
|
+
const core = specs(marker < 0 ? lines : lines.slice(0, marker));
|
|
78
|
+
if (core.length) run(venvPython, ["-m", "pip", "install", "-q", ...core]);
|
|
79
|
+
const skipped = specs(marker < 0 ? [] : lines.slice(marker + 1)).filter(spec => {
|
|
80
|
+
try {
|
|
81
|
+
run(venvPython, ["-m", "pip", "install", "-q", spec]);
|
|
82
|
+
return false;
|
|
83
|
+
} catch {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if (skipped.length) console.warn(`[stock-analysis-plugin] optional providers skipped: ${skipped.join(", ")}`);
|
|
88
|
+
}
|
|
56
89
|
} catch (err) {
|
|
57
90
|
console.warn(
|
|
58
91
|
`\n[pi-stock-analysis] Python setup failed: ${err.message}\n` +
|