dsh-stock-flick 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.en.md +46 -0
- package/README.md +127 -2
- package/client.js +3354 -0
- package/cordis.patch.yml +3 -0
- package/docs/icon-180.png +0 -0
- package/docs/screenshots/1-map.png +0 -0
- package/docs/screenshots/10-trade-3dec.png +0 -0
- package/docs/screenshots/2-hover.png +0 -0
- package/docs/screenshots/3-watch.png +0 -0
- package/docs/screenshots/4-analysis.png +0 -0
- package/docs/screenshots/5-hold.png +0 -0
- package/docs/screenshots/6-alerts.png +0 -0
- package/docs/screenshots/7-kline.png +0 -0
- package/docs/screenshots/8-minute-5d.png +0 -0
- package/docs/screenshots/9-map-1280.png +0 -0
- package/icon.svg +9 -0
- package/index.js +141 -0
- package/lib/app.css +494 -0
- package/lib/data.js +767 -0
- package/lib/state.js +200 -0
- package/package.json +68 -4
- package/seed/industry-map.json +1 -0
- package/seed/snapshot.json +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stock flick contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# stock flick — A-share industry heatmap for DeepSeek Harness
|
|
2
|
+
|
|
3
|
+
A DSH plugin that opens from the sidebar: **industry heatmap + watchlist + portfolio** for mainland China A-shares.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- **Heatmap** — 31 Shenwan level-1 sectors → 131 level-2 industries → 5,581 stocks in two nested treemap layers. Area by float cap / total cap / turnover, Finviz-style red-up/green-down coloring, gold outline and gold seams on hover, a cursor-following detail card with an intraday spark, and a 131-industry multi-select filter.
|
|
10
|
+
- **Watchlist** — up to 20 codes; cards with price, change, volume, PE and a 30-day spark; detail view with 1/3/5-day intraday charts (the 1-day axis scales to the elapsed session so early-morning data fills the width) and daily/weekly/monthly candles (prices to 3 decimals), crosshair readouts, and rule-based trend analysis (MA5/10/20/60, RSI14, MACD, ATR14, 20-day annualized volatility, 20/60-day returns, volume ratio, support/resistance, score and signals — ported from `dsh-dingpan`, MIT). No AI, no advice.
|
|
11
|
+
- **Portfolio** — inline shares/cost editing, 3-decimal prices (e.g. 36.208) and free-form decimal entry, weighted-average cost, realized P&L, editable trade ledger with replay, and a daily portfolio P&L curve.
|
|
12
|
+
- **Alerts** — price or percent thresholds, checked every 15 seconds while the plugin page is open, with a 30-minute cooldown.
|
|
13
|
+
- **Data** — export/import JSON from the `⋯` menu.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
Requires **DSH ≥ 0.2.2-rc.5**.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
dsh plugin --profile web add dsh-stock-flick
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Reload the profile, then click **stock flick** in the sidebar. For a local checkout:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
dsh plugin --profile lab add /path/to/dsh-stock-flick
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Data and privacy
|
|
30
|
+
|
|
31
|
+
The Host half fetches Sina's Shenwan industry tree and constituents, Tencent batch quotes, Sina 1-minute bars (5 trading days) and Tencent forward-adjusted candles. The browser never calls the quote sites directly. A bundled snapshot from the 2026-11-26 close keeps the map usable on first install or offline; it is replaced by live quotes within 15 seconds.
|
|
32
|
+
|
|
33
|
+
State lives in `~/.dsh/dsh-stock-flick/state.json`. No account or API key is needed. **The plugin's HTTP routes have no DSH access check**, so any other web page open in the same browser could call `/plugins/stock-flick/api/*`; do not expose the DSH web UI to the public internet without an authenticating proxy.
|
|
34
|
+
|
|
35
|
+
## Compatibility
|
|
36
|
+
|
|
37
|
+
Verified on 2026-11-27 with macOS, DSH 0.2.2-rc.5 and a `lab` profile created from the `web` template (Chrome, 1440 and 1280 widths). Intraday rolling refresh was not re-verified during trading hours; Windows and other DSH versions are untested. Not investment advice.
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm run build # src/*.js + lib/app.css -> client.js
|
|
43
|
+
npm run check
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
MIT.
|
package/README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
-
#
|
|
1
|
+
# stock flick · A 股行业云图(DSH 插件)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
安装到 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 后,从左侧栏打开的 A 股工作台:**行业云图 + 自选盯盘 + 持仓管理**。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
记一笔的价格支持 3 位小数(例:36.208):
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## 功能
|
|
12
|
+
|
|
13
|
+
**云图**(大盘云图 / Finviz 风格)
|
|
14
|
+
|
|
15
|
+
- 全市场 **31 个申万一级 → 131 个申万二级 → 5581 只个股**,两层嵌套。
|
|
16
|
+
- 面积可切 **流通市值 / 总市值 / 成交额**;红涨绿跌,0 附近灰、±2% 明显着色、±4% 到端色。
|
|
17
|
+
- 方块以中文名为主、代码和涨跌幅为小字;悬停个股 3px 黄框 + 跟随鼠标的详情卡(迷你分时、10 项数据、同行业前五、加自选/预警/K 线)。
|
|
18
|
+
- 悬停二级或一级标题:黄框、标题变黄、块内缝隙全黄(`2-hover.png`)。
|
|
19
|
+
- 131 个二级多选筛选,支持按二级/一级名搜索。
|
|
20
|
+
|
|
21
|
+
**自选**
|
|
22
|
+
|
|
23
|
+
- 6 位代码添加,逗号/空格分隔可批量;最多 20 只;可导入 `.md` 里表格中的代码。
|
|
24
|
+
- 左卡片(价格、涨跌幅、成交量、市盈率、30 日日线迷你图)+ 右详情。
|
|
25
|
+
- 走势图:**分时 1/3/5 日** 与 **日/周/月 K 线**;分时含价格线、面积、均价线、昨收虚线、成交量、双列价格轴、十字光标与读数。
|
|
26
|
+
- **1 日分时按当前已产生的时段缩放**:刚开盘时价格线和成交量也铺满宽度,不会挤在最左边;3/5 日保持完整交易日。
|
|
27
|
+
- **价格显示与录入支持 3 位小数**(如 `36.208`);价格输入框是文本框,可在数字中间插入小数点,不再被 `step=0.01` 拦住。
|
|
28
|
+
- **走势与后续研判**:移植 `dsh-dingpan` 的量化口径(MA5/10/20/60、RSI14、MACD、ATR14、20 日年化波动、20/60 日涨跌、量比、支撑/压力、评分/信号/趋势)。只做规则统计,不接 AI。
|
|
29
|
+
|
|
30
|
+
**持仓 / 流水**
|
|
31
|
+
|
|
32
|
+
- 股数、成本行内改;价格与成本最多 3 位小数;总市值、浮动盈亏、今日盈亏、已实现盈亏、仓位占比。
|
|
33
|
+
- 记一笔:买入按加权均价合并成本,卖出按当前成本结出已实现盈亏,卖光自动移除。
|
|
34
|
+
- 流水可编辑:按「该股当前持仓反推基准 + 全部流水按时间重放」重算股数和成本。
|
|
35
|
+
- 组合浮动盈亏按交易日记录,最多 180 天(至少两个交易日后才有曲线)。
|
|
36
|
+
|
|
37
|
+
**预警与数据**
|
|
38
|
+
|
|
39
|
+
- 价格 / 涨跌幅,`≥ / ≤`;页面打开时每 15 秒检查,同一条件 30 分钟冷却,触发记录 100 条。
|
|
40
|
+
- 右上 `⋯` 可导出 / 导入 JSON(自选、持仓、流水、预警、收益曲线)。
|
|
41
|
+
|
|
42
|
+
## 安装
|
|
43
|
+
|
|
44
|
+
要求 **DSH ≥ 0.2.2-rc.5**。发布到 npm 后:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
dsh plugin --profile web add dsh-stock-flick
|
|
48
|
+
# 或把 web 换成你在用的 profile 名
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
重启 / 重载 profile 后,左侧栏出现 **stock flick**,点开即是云图。也可在 DSH 的 **Plugins** 里搜索 `dsh-stock-flick`。
|
|
52
|
+
|
|
53
|
+
本地目录安装(开发时):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
dsh plugin --profile lab add /path/to/dsh-stock-flick
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 数据与网络
|
|
60
|
+
|
|
61
|
+
数据由插件 **Host 侧**统一请求,浏览器不直连行情站:
|
|
62
|
+
|
|
63
|
+
| 用途 | 接口 | 说明 |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| 行业树 | 新浪 `Market_Center.getHQNodes` | `sw1_hy`(31)/ `sw2_hy`(131) |
|
|
66
|
+
| 行业成分 | 新浪 `Market_Center.getHQNodeData` | 自动翻页;全市场 5581 只 |
|
|
67
|
+
| 批量报价 | 腾讯 `qt.gtimg.cn` | 600 只/批,共 10 批;GBK |
|
|
68
|
+
| 分时 | 新浪 1 分钟(`datalen=1200`) | 最近 5 个交易日;缓存 60 秒 |
|
|
69
|
+
| K 线 | 腾讯 `fqkline` | 前复权;日/周/月;缓存 60 秒 |
|
|
70
|
+
| 快照 | Host 汇总 | 每 15 秒刷新一次报价;请求合并 |
|
|
71
|
+
|
|
72
|
+
- 行业映射按 **20 小时** TTL 缓存;过期后在后台重建(约 3–4 分钟),期间继续用旧映射出图。
|
|
73
|
+
- 随包带一份 **2026-11-26 收盘** 的快照与映射种子:首次安装、断网或接口受限时,云图仍能先打开;联网后 15 秒内换成实时报价。
|
|
74
|
+
- 成交量:主板/创业板/北交所接口返回「手」,科创板 688/689 返回「股」,已统一换算为「手」。
|
|
75
|
+
|
|
76
|
+
## 状态与备份
|
|
77
|
+
|
|
78
|
+
状态保存在 **`~/.dsh/dsh-stock-flick/state.json`**(不是浏览器 localStorage):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
~/.dsh/dsh-stock-flick/
|
|
82
|
+
├── state.json 自选 / 持仓 / 流水 / 预警 / 收益曲线 / 面积口径
|
|
83
|
+
├── industry-map.json 行业映射缓存
|
|
84
|
+
└── state.json.tmp 写入时的临时文件
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
删掉整个目录即重置。换机器时用右上 `⋯` 的导出 / 导入 JSON。
|
|
88
|
+
|
|
89
|
+
## 隐私
|
|
90
|
+
|
|
91
|
+
- 不需要账号、令牌或 API key;只访问上述公开行情接口。
|
|
92
|
+
- 自选、持仓等只写本机 `~/.dsh/dsh-stock-flick/`,不上传。
|
|
93
|
+
- **插件的 HTTP 路由没有 DSH 访问校验**:和同类插件一样,同一浏览器里打开的其他网页理论上可以请求 `/plugins/stock-flick/api/*`。请勿把 DSH Web UI 暴露到公网;需要时在前面加反向代理和鉴权。
|
|
94
|
+
|
|
95
|
+
## 兼容与验证
|
|
96
|
+
|
|
97
|
+
- 2026-11-27 在 macOS 27.2.0、**DSH 0.2.2-rc.5**、从 `web` 模板新建的 `lab` profile 上验证:左侧栏入口、云图 31/131/5581、自选添加 600519 与分时/K 线/研判、持仓买入卖出、预警触发、JSON 持久化与重载、1280/1440 两种宽度。
|
|
98
|
+
- 验收时数据为 2026-11-26 收盘后;**盘中 15 秒滚动未在交易时段复验**。
|
|
99
|
+
- 未在 Windows、其他 DSH 版本上验证。
|
|
100
|
+
|
|
101
|
+
## 已知限制
|
|
102
|
+
|
|
103
|
+
1. 行情来自公开接口,可能延迟、限频或不可用;接口失败时保留上一次快照。
|
|
104
|
+
2. 云图「本周 / 本月」仍是占位(置灰),只有「今日」。
|
|
105
|
+
3. 分时最多 5 个交易日(新浪一次 1200 条 1 分钟线)。
|
|
106
|
+
4. 收益曲线从首个使用日开始记录,至少两个交易日才有线,不做历史回填。
|
|
107
|
+
5. 预警只在插件页面打开时检查,不是后台任务;同一条件 30 分钟只提醒一次。
|
|
108
|
+
6. 不计手续费、印花税;已实现盈亏是毛额。
|
|
109
|
+
7. 流水编辑对「已清仓且没有持仓、只留卖出流水」的股票无法反推成本,卖出盈亏按 0 成本重算。
|
|
110
|
+
8. 自选最多 20 只。
|
|
111
|
+
9. 行业映射重建依赖新浪接口;重建失败时继续用旧映射。
|
|
112
|
+
10. 量化研判是规则统计,不构成投资建议。
|
|
113
|
+
|
|
114
|
+
## 开发
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm run build # src/*.js + lib/app.css -> client.js(CSS 内嵌)
|
|
118
|
+
npm run check # node --check client.js
|
|
119
|
+
npm pack --dry-run
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`index.js` 是 Host 半边(路由、数据、状态),`client.js` 是构建产物,由 DSH Client 以 `window.__ModuleLoader__.load({ id: 'dsh-stock-flick' })` 加载。`lib/data.js`、`lib/state.js` 分别负责行情与持久化。
|
|
123
|
+
|
|
124
|
+
## 许可
|
|
125
|
+
|
|
126
|
+
MIT。界面与交互参考 Finviz Map、[大盘云图](https://www.dapanyuntu.com/);量化研判与自选页布局参考 [`dsh-dingpan`](https://github.com/mumu1001ai-jpg/dsh-dingpan)(MIT);持仓交互与插件工程做法参考 [`dsh-stock-bar`](https://github.com/NoCandles/dsh-stock-bar)(MIT)。
|
|
127
|
+
|
|
128
|
+
> 本项目只做行情展示与规则统计,**不构成投资建议**。市场有风险,决策需谨慎。
|