Back to home@ikomom

dsh-trade-chart

DeepSeek Harness 交易图表插件:对话内直接渲染 K线/折线/柱状/面积图、技术指标(EMA/BOLL/MACD/RSI/KDJ/MAVOL)、热点轮动矩阵与连板晋级图。纯自绘 SVG,零外部依赖,附在线示例页。

Stars
0
Language
JavaScript
Created
Aug 14, 2026
Updated
Aug 31, 2026
GitHub repo

Introduction

dsh-trade-chart

中文 | English

Release v0.3.0 License: MIT DeepSeek Harness

DeepSeek Harness 交易图表插件:模型调用 trade_chart 工具后,K线/折线/柱状/面积图直接渲染在对话流中。纯自绘 SVG,零外部依赖。

📊 示例预览

在线示例页:K线(EMA/BOLL/MAVOL/MACD/RSI/KDJ 全指标)、折线/柱状/面积、热点轮动矩阵、连板晋级天梯,全部示例由真实渲染器生成为静态 SVG,浏览器直接打开即可查看(图中数据为演示数据;缩放/平移/十字光标等交互需在 DSH 对话内体验)。

功能

能力说明
K线图蜡烛图(红涨绿跌)+ 成交量副图 + MA 均线(可自定义周期)
主图指标EMA(自定义周期)+ BOLL 布林带(带状填充)
副图指标MACD(DIF/DEA/柱)+ RSI(30/70 超买超卖区)+ KDJ,可组合开启
成交量量柱 + MAVOL 均量线
折线/柱状/面积多序列对比、图例、悬浮提示
热点轮动矩阵type=heatmap:板块×日期矩阵,红涨绿跌着色,悬浮看明细
连板晋级图type=ladder:板数×日期天梯,格内显示家数与晋级率(自动计算)
波段标注pivots: true 自动标注局部高低点(红三角/绿三角 + 价格)
自由标注annotations:pivot / hline / trendline / arrow / rect / note
交互滚轮缩放(y 轴锁定)、拖动平移、双击/⟲ 复位、十字光标(按面板适配:价格/成交量/指标数值)
大数据量>800 根自动聚合;>5000 根拒绝

安装

# 方式一:本地克隆(link 路径换成你的真实路径)
git clone https://github.com/ikomom/dsh-trade-chart.git
dsh plugin --profile web add link:D:\你的真实路径\dsh-trade-chart   # Windows
dsh plugin --profile web add link:/你的/真实/路径/dsh-trade-chart    # macOS / Linux / WSL

# 方式二:直接从 git 安装(推荐)
dsh plugin --profile web add git+https://github.com/ikomom/dsh-trade-chart.git

# 方式三:npm 安装(发布后可用)
dsh plugin --profile web add @ikonon/dsh-trade-chart

更新与卸载

# 更新到最新版本(git 方式安装自动拉取 master 最新提交;npm 方式按 semver 范围更新,加 --latest 可跨范围升到最新)
dsh plugin --profile web update @ikonon/dsh-trade-chart

# git 方式若更新后仍停在旧提交(pnpm 偶发不重解析 git 依赖),重新 add 一次强制刷新:
dsh plugin --profile web add github:ikomom/dsh-trade-chart

# 卸载
dsh plugin --profile web remove @ikonon/dsh-trade-chart

更新或卸载后,重启 dsh 的 web 进程(dsh web)并刷新页面生效。

使用

对话中直接说:「画一下贵州茅台的日K,标出波段高低点」「对比 XX 和 YY 的收盘价走势」「把最近 3 年的周线画出来」「画 XX 的日K,加 MACD 和 RSI 副图、布林带」「画一下最近 10 个交易日热点板块轮动」「把这几天的连板晋级画出来」。

trade_chart 工具参数

{
  "chart": {
    "type": "kline",                 // kline | line | bar | area | heatmap | ladder
    "title": "贵州茅台 日K",
    "symbol": "600519.SH",
    "period": "日K",
    "unit": "元",
    "ma": [5, 10, 20],               // K线均线周期;传 [] 不画均线
    "kline": [                       // type=kline 必填(OHLCV,按时间升序)
      { "time": "2026-07-19T16:00:00Z", "open": 1270, "high": 1329, "low": 1266, "close": 1327.5, "volume": 106151 }
    ],
    "indicators": {                  // K线专用:技术指标(客户端基于全量数据计算)
      "ema": [12, 26],               //   主图 EMA 均线
      "boll": true,                  //   布林带:true=默认(20,2),或 { "period": 20, "std": 2 }
      "mavol": [5, 10],              //   成交量均线:true=默认[5,10],或周期数组
      "macd": true,                  //   副图 MACD:true=默认(12,26,9),或 { "fast": 12, "slow": 26, "signal": 9 }
      "rsi": [6, 12, 24],            //   副图 RSI:true=默认14,或周期数组
      "kdj": true                    //   副图 KDJ:true=默认(9,3,3),或 { "n": 9, "k": 3, "d": 3 }
    },
    "heatmap": {                     // type=heatmap 必填:热点轮动矩阵(板块×日期)
      "rows": ["AI算力", "机器人"],   //   板块/主题名称(y 轴)
      "categories": ["07-01", "07-02"], // 日期/周期(x 轴)
      "values": [[5.2, 3.1], [-1.5, 2.3]], // 数值矩阵(行=板块,列=日期),可为 null;红涨绿跌
      "unit": "%"
    },
    "ladder": [                      // type=ladder 必填:连板晋级(按日期升序)
      { "date": "2026-07-01", "boards": [
        { "level": 1, "count": 42 },
        { "level": 2, "count": 9 },
        { "level": 3, "count": 3, "stocks": ["中际旭创", "新易盛", "天孚通信"] }  // 可选:具体连板股票,高板时格内直接展示
      ] }
    ],
    "pivots": true,                  // K线:自动标注波段高低点
    "pivotLookback": 3,              // 波段检测窗口(左右各 N 根,2-30,默认 3)
    "annotations": [                 // K线:自由标注
      { "type": "pivot", "kind": "high", "time": "2026-07-19T16:00:00Z", "price": 1329, "label": "前高" },
      { "type": "hline", "price": 1400, "label": "整数关口" },
      { "type": "trendline", "from": { "time": "2026-02-23T16:00:00Z", "price": 1524 }, "to": { "time": "2026-04-15T16:00:00Z", "price": 1477 }, "label": "下降压力线" },
      { "type": "arrow", "from": { "i": 0, "price": 1151 }, "to": { "i": 59, "price": 1362 } },
      { "type": "rect", "from": { "time": "2026-03-22T16:00:00Z", "price": 1400 }, "to": { "time": "2026-04-22T16:00:00Z", "price": 1420 }, "label": "横盘区" },
      { "type": "note", "time": "2026-07-19T16:00:00Z", "price": 1327.5, "text": "放量突破" }
    ]
  }
}

数据格式time(与 kline 的 time 一致)或 i(下标,0 起)定位;可加 color(hex)。K线 ≤800 根直接渲染、800–5000 根自动聚合、>5000 根拒绝。

指标说明:均线/指标全部基于全量数据计算,缩放平移后仍连续正确;指标值(EMA/BOLL/MACD/RSI/KDJ/MAVOL)同时显示在图例、悬浮提示和模型返回的摘要文本中。MACD 柱 = 2×(DIF−DEA),RSI 采用 SMA 平滑(与国内行情软件一致),KDJ 默认 (9,3,3)。

热点矩阵说明values 行=板块、列=日期;颜色以 0 为中性发散(红涨绿跌,符合 A 股惯例),null 显示为灰块。连板晋级说明:纵轴板数(首板在底、高板在顶),横轴日期;格内大数字为当日该板数家数,下方小字「晋级率 X%」= 今日该板家数 ÷ 昨日上一板家数(客户端自动计算,≥50% 标红);高板(股票少)时格内直接列出具体连板股票(最多 3 只,超出显示 +N只);首板行标注「首板」(新涨停无晋级概念);悬浮查看完整股票名单 / 断板数。

License

MIT