omdsh-dev/dsh-longbridge 预览 preview

omdsh-dev/dsh-longbridge

DSH plugin for Longbridge HK/US market data, accounts, positions, and approval-gated order placement, with a built-in settings panel.

Project Overview项目介绍

dsh-longbridge is a native plugin built exclusively for DeepSeek Harness (DSH) that connects to the Longbridge Open API for Hong Kong and US stock market data and trading. To install the plugin, you can use the DSH CLI to add it from a local absolute path, a Git repository, or an npm package, and it is also automatically indexed every two hours in the DSH Hub catalog. After installation, you just need to refresh your local DSH web GUI at http://127.0.0.1:3080 to see the new Longbridge settings section and all enabled longbridge_* tools.

This plugin is designed for DSH users who need access to professional Hong Kong and US stock data and trading capabilities directly within their DSH agent workflow. It differentiates from the existing dsh-stock-market DSH plugin, which focuses on free, public Chinese A-share market data. All 9 of its tools are organized into toggleable groups: market data tools are enabled by default, while account and trading tools are disabled by default for security. Users can toggle groups on or off at any time in the Longbridge settings section with no restart required.

This plugin is released under the permissive BSD-3-Clause open source license. Before first use, you must complete several prerequisites: open a Longbridge brokerage account, apply for OpenAPI access on the Longbridge developer platform, enable separate market data and trading permissions, then copy your App Key, App Secret, and Access Token into the DSH credentials vault. Credentials are stored only locally on your machine in $DSH_HOME/.credentials.yaml, and never logged or shared with the DSH agent. The plugin enforces built-in rate limits for trade requests to comply with Longbridge Open API quotas.

这是一款专为DeepSeek Harness(DSH)开发的原生插件,用于接入长桥开放平台的港美股数据与交易功能。它一共提供9个可分组开关的工具,涵盖实时行情查询、K线获取、指数查询、自选管理、交易状态查询,以及账户资金持仓查询、下单撤单等券商级功能,交易工具默认关闭且每次调用都需要经过DSH的审批确认。插件可通过DSH CLI从本地路径、Git或npm源安装,也会自动收录到DSH官方插件中心每两小时更新的目录中,安装后刷新DSH网页界面即可使用。

本插件面向需要在DSH代理工作流中获取港美股专业行情、对接长桥账户交易功能的用户。用户可以通过DSH设置页的长桥专区配置凭据、开关各工具分组,还可以开启实验性的右侧固定行情面板,每5秒轮询更新主要指数快照。本插件和专注免费沪深A股数据的dsh-stock-market插件形成差异化覆盖,专注港美股领域的专业级数据与全流程交易能力。

本插件采用BSD-3-Clause许可证开源,使用前用户需要先在长桥App完成开户,再到长桥开发者平台申请OpenAPI权限,分别开通行情和交易权限后获取App Key、App Secret和Access Token三件套,填入DSH设置页即可完成配置。凭据仅保存在本地DSH凭据保险箱,不会泄露到日志或会话中。插件内置了交易请求限流规则,适配长桥OpenAPI的配额要求,历史K线查询按月度分配配额。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:omdsh-dev/dsh-longbridge

把 omdsh-dev/dsh-longbridge 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-longbridge

Author / Maintainer: @Zacklinkk

DSH 长桥(Longbridge)港美股数据接入插件:券商级行情、账户与交易工具 + 设置页凭据管理。

定位

  • 港美股(700.HK / AAPL.US 格式)+ 券商级能力(持仓/下单/账户),数据源为 Longbridge OpenAPI(longbridge npm SDK,App Key/Secret 认证)。
  • 与 dsh-stock-market 差异化:它覆盖沪深 A 股免费公开源;本插件覆盖港美股与券商级数据。
  • 交易工具强制确认:longbridge_place_order / longbridge_cancel_order 每次调用都过 DSH 审批通道(tools/pre-execute → approval),非 allowed-once 一律拒绝。

硬前置:凭据门槛

  1. 在长桥 App 完成开户;
  2. 登录 open.longbridge.com 开发者平台完成开发者认证 / OpenAPI 权限申请;
  3. 行情权限与交易权限分别开通(免费;港股实时订阅级别、美股期权数据有单独条件);
  4. 在用户中心取得 App Key / App Secret / Access Token 三件套,填入 设置 → 长桥。

凭据只写入 DSH 凭据保险箱(ctx.credentials,本地 $DSH_HOME/.credentials.yaml), 不进入 settings 文档、日志或会话内容;环境变量 LONGBRIDGE_APP_KEY / LONGBRIDGE_APP_SECRET / LONGBRIDGE_ACCESS_TOKEN 提供时优先(只读遮蔽)。

工具清单(9 个,按开关分组)

分组 工具 说明
行情(默认开) longbridge_quote 实时快照(≤20 代码)
longbridge_kline K线(1m…year,≤500 根,前/不复权)
longbridge_indices 港美主要指数(HSI/HSTECH/DJI/SPX/NDX…)
longbridge_watchlist 券商自选分组 list/add/remove
longbridge_market_status 当日交易时段
账户(默认关) longbridge_account 资金总览(现金/净资产/保证金)
longbridge_positions 持仓列表
交易(默认关,强制确认) longbridge_place_order 下单(LO/ELO/MO,限价校验)
longbridge_cancel_order 撤单

开关在 设置 → 长桥 即时生效(动态注册/注销工具组)。账户/交易组默认关闭; 交易组开启后每次下单仍会弹确认。

UI

  • 设置页(settings.section「长桥」):凭据三件套 + 状态徽章 + 测试连接(700.HK 探活)、 环境(live/paper)、三组工具开关、实验面板开关。
  • 右侧行情面板(实验,默认关):自挂固定列 + --dsh-longbridge-panel-width 挤压布局, 每 5s 轮询指数快照。开启方式:设置 → 长桥 → 实验:右侧行情面板。

开发与构建

npm ci --include=dev                              # 公开依赖(含 longbridge SDK)
DSH_WORKSPACE_ROOT=/path/to/dsh-checkout npm run setup:dsh-workspace   # 链接 DSH 私有 peer
npm run typecheck && npm test && npm run build    # 门禁:tsc + vitest + tsdown(client bundle)

lib/ 为构建产物(host 半区 tsc 输出 + client 半区 tsdown bundle,含 CSS 内联)。

安装

dsh plugin --profile web add link:/absolute/path/to/dsh-longbridge
# 或从 git/npm 源安装发布包;hub catalog 每 2h 自动收录本仓库

安装后刷新 Web GUI(http://127.0.0.1:3080):设置页出现「长桥」;模型工具目录出现 longbridge_*(按开关)。

限流与配额(实现内已处理/需知)

  • Quote:10 req/s、并发 5(SDK 自动限流);Trade:30 req/30s、间隔 ≥20ms(本插件 TradeThrottle 强制);
  • 历史 K 线按月配额(unique symbols,按资产分级 100–3000),实时 K 线(candlesticks) 与行情快照不受此配额限制。

路线备注(第一轮调研结论,存档)

  • dsh-mcp-client(streamable-http)不支持 OAuth 2.1,无法直挂 https://mcp.longbridge.com (实测 401 + RFC 9728 挑战);自托管 longbridge-mcp 仍走同一 OAuth。原生插件(本仓库) 使用 legacy App Key/Secret 三元组,无浏览器交互。详见 docs/(若随仓发布)与工作目录调研文档。
← 上一个 Prev dsh-game-hud 下一个 Next dsh-context7 →