Bundle
dsh-stock-watch
DeepSeek Harness Web 股票实时行情悬浮插件:实时报价、K线、7日/30日走势、技术面看多看空预测。
- Source
- zhubidatou
- License
- Apache-2.0
- Updated
- Updated 2 days ago
Readme
# dsh-stock-watch
一个 **DeepSeek Harness Web 股票实时行情悬浮插件**:页面右上角渲染一个「📈 股票」悬浮胶囊,点开即得可拖动的行情面板,支持:
- **实时报价**:当前价、涨跌额/涨跌幅、今开/昨收/最高/最低、成交量/成交额(20s 自动刷新 + 手动刷新)
- **K 线**:近 40 个交易日日 K(前复权,红涨绿跌 K 线图)
- **7 日 / 30 日走势**:内联 SVG 折线迷你图 + 区间涨跌幅
- **看多 / 看空预测**:host 端技术面引擎(MA / MACD / RSI / 动量)给出 -100~+100 的信号分、看多/偏多/中性/偏空/看空结论、置信度、驱动因子列表与关键指标
数据来源(host 端 Node 直连,无需第三方 SDK):
| 数据 | 来源 | 说明 |
|------|------|------|
| 实时报价 | 新浪 `hq.sinajs.cn` | GBK 解码成结构化报价 |
| 日 K 线 | 腾讯 `web.ifzq.gtimg.cn` fqkline | 前复权,JSON |
> 说明:技术面信号为**确定性启发式计算**(非投资建议),本机、即时、无模型依赖。
## 结构
```
dsh-stock-watch/
├── package.json # 声明 dsh.bundle(补丁层) + dsh.client(浏览器端入口)
├── cordis.patch.yml # 把本插件作为一条 loader 配置项插入
├── index.js # host 端(Node):抓取行情/K线 + 技术面预测 + REST 接口
├── client.js # 浏览器端:在 shell.overlay 槽位渲染悬浮行情面板
└── README.md # 本说明
```
- **host 端** `index.js`:一个 Cordis 插件,`inject: ['webServer']`,通过
`ctx.webServer.register({ kind: 'prefix', path, handler })` 注册 `/dsh-stock-watch` 前缀路由:
- `GET /dsh-stock-watch/quote?code=sh600000` —— 实时行情
- `GET /dsh-stock-watch/kline?code=sh600000&days=90` —— 日 K 线(进程内 30s 缓存)
- `GET /dsh-stock-watch/predict?code=sh600000` —— 技术面看多/看空预测
- **client 端** `client.js`:浏览器插件,`window.__ModuleLoader__.load({ id, factory })`
打包;`apply(ctx)` 用 `ctx.slots.inject('shell.overlay', ...)` 把 React 面板挂进页面
浮图层。代码输入支持 `600000` / `600000.SH` 简写或 `sh600000` 完整前缀(自动推断沪深)。
## 安装 / 注入
```sh
# 运行时注入(免重启,开发态;需 dsh-super-injector)
dev_inject_plugin /path/to/dsh-stock-watch
# 或官方装配(生产态,重启后由 bundles 接管)
dsh plugin --profile web add /path/to/dsh-stock-watch
```
打开 http://127.0.0.1:3080,右上角出现「📈 股票」胶囊。
## 验证
```sh
curl -H 'x-dsw-token: dsh-stock-watch-' http://127.0.0.1:3080/dsh-stock-watch/quote?code=sh600000
curl -H 'x-dsw-token: dsh-stock-watch-' -H 'x-dsw-token: x' \
'http://127.0.0.1:3080/dsh-stock-watch/predict?code=600000'
```
Install
dsh plugin --profile web add github:zhubidatou/dsh-stock-watcher
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-stock-watch from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.