mengmenghao/dsh-stock-quote: View A-shares, HK stocks, and US stock quotes in DSH

Preface

DSH’s philosophy is “Everything is a plugin”; high-frequency, structured, and time-sensitive data like market quotes fits this model perfectly. Existing approaches mostly involve installing a separate quote client or having the Agent report numbers from memory in the session—the former is disconnected from DSH’s sessions and pages, while the latter lacks a stable data source and easily provides outdated or even incorrect prices.

Below is an introduction to mengmenghao/dsh-stock-quote. It simultaneously addresses two paths: providing a stock quote panel and individual stock details within DSH, and providing two tools for the Agent to directly check real-time quotes and K-lines in the session. The plugin uses public interfaces, requires no API key, and runs with zero dependencies after installation.

What is this

@liaomenghao/dsh-stock-quote, repository mengmenghao/dsh-stock-quote, maintainer mengmenghao (author in package.json is liaomenghao). Categorized as “Networked Tools”. Solves the problem of: viewing watchlist quotes and browsing individual stock K-lines uniformly within the DSH interface, and handing the quote capability as a tool for the Agent to call, avoiding data inconsistencies between the page and the tool.

Requires DSH ≥ 0.2.0 and Node.js ≥ 20. The plugin has zero runtime dependencies.

Core Features

The plugin consists of three parts:

  1. “Stock Quotes” Page: Sidebar entry + Main area panel, maintains a watchlist (add, delete, manual/auto refresh), A-shares, HK stocks, and US stocks simultaneously.
  2. Individual Stock Details: Click the name in the list to enter. Daily K-line (candlestick chart + volume + MA5/MA20, switchable 60/120/240 days), plus today’s intraday view.
  3. AI Analysis: Write analysis requirements on the details page, generate conclusions using the current profile’s default model.
  4. Agent Tools: stock_quote and stock_search (also stock_kline), allowing direct questions in the session like “How much is Moutai now?”.

The watchlist is stored in browser localStorage (key dsh-stock-quote.watchlist), defaulting to sh000001, 600519, 00700.HK, AAPL. The page auto-refreshes every 30 seconds (can be turned off); the “Refresh” button in the top right takes a snapshot immediately. The table displays Name/Code, Current Price, Change, Change %, Volume, Turnover Rate, and Quote Time. Red is for gains, Green for losses.

The stock details page defaults to today’s intraday view: minute-by-minute price line, moving average line, previous close dashed baseline, and volume bars. The daily K-line is pre-adjusted daily data (candlesticks, wicks, MA5/MA20 lines, volume bars, right-side price scale, latest price dashed line). The period is switchable 60/120/240 days.

AI Analysis has three quick-fill options: “Trend Direction / Support & Resistance / Risk Points”. After clicking “Start Analysis”, the answer appears below the input box without page navigation. You can ask continuously about the same stock; each round of Q&A is listed in the conversation thread below, sent with up to the last 6 rounds to the model, max 20 rounds retained on the page, max 30 stocks remembered. Records are stored per stock in localStorage (key dsh-stock-quote.analyses), persisting when leaving details, switching stocks, or refreshing the page. “Clear Conversation” only deletes the record for the current stock.

Installation & Enablement

npx @deepseek-ai/dsh plugin --profile <profile> add @liaomenghao/dsh-stock-quote

After installation, restart Harness, and the “Stock Quotes” entry appears in the sidebar. package.json shows current version 1.5.2, license MIT. It is recommended to open the repository to verify the source code and license before installing; the plugin runs with the permissions of the current dsh process.

Typical Usage

After installation, you can ask for quotes directly in the session. The Agent side has three tools:

Tool Parameters Returns
stock_quote symbols: Code array, max 20 at a time Current price, change, change %, previous close, open, high, low, volume, turnover, turnover rate, P/E ratio, market cap, and the exchange timestamp of this quote
stock_kline symbol, days: 20–250, default 60 Pre-adjusted daily line (Date/Open/High/Low/Close/Volume, old to new) + current quote
stock_search keyword: Name / Code / Pinyin initials, limit: 1–20, default 8 Candidate list, each item with symbol, can be passed directly to stock_quote

Supported code formats: 600519, sh600519, 600519.SH, 430047 (BSE), 00700, 0700.HK, AAPL, BRK.B, usBRK.B. Use stock_search when only the company name is given.

Install-free method (same as DeepSeek Harness): Open the community directory page https://www.skillhub.cn/plugins/mengmenghao/dsh-stock-quote , follow the instructions, or use the command above. The community directory is an independent site with no official affiliation with DeepSeek / Fangfang.

Data Source & Internal Implementation

  • Real-time quotes: Tencent qt.gtimg.cn, GBK encoding, single request can batch fetch multiple.
  • Daily K-line: Eastmoney push2his.eastmoney.com, pre-adjusted daily line; US stocks detect market segments 105/106/107 after caching.
  • Code search: Eastmoney suggest interface.

The plugin does not write cache or disk (except US market segments, process-only cache), every call requests upstream in real-time. Pages fetch data via same-origin interfaces, sharing the same parsing logic with tools to avoid inconsistencies. Routes include GET /stock-quote/quotes, /stock-quote/search, /stock-quote/kline, /stock-quote/intraday. “Analyze in Session” does not go through HTTP; the client uses ctx.sessions.create to create a session, prompt to submit the first message, then uiWorkspace.openSession to switch over.

Main files: index.js (Host side: two tools, four panel routes, assemble analysis request), quote.js (Code normalization, parse quotes/K-line/search, format), client.js (Client side: sidebar icon, watchlist panel, details page and K-line chart), cordis.patch.yml (bundle patch, insert stock-quote line).

Configuration

The config in the cordis.patch.yml line supports:

Key Default Meaning
timeoutMs 8000 Timeout for a single upstream quote/K-line request, range 1000–20000 ms

Acceptance

npm test

It runs test/accept-analyze.mjs: uses a minimal React implementation (supports state, effect, useCallback memoization, and element key remounting) to actually mount client.js, then drives the interface with stub data, asserting the behavior of the “Analyze” button item by item, including entering details from the list and restoring history, disabling when input is empty, clicking only sends one request with new question and history in the body, results are presented in place, results are written to localStorage and clearing only deletes current stock, switching stocks doesn’t mix records. npm test passes 18 items.

It does not cover real browser rendering, CSS effects, or occlusion by third-party overlays like skins/pets; these can only be seen in the actual interface.

Applicable Scenarios & Notes

Suitable for developers who need to keep an eye on watchlists in DSH for a long time, or want the Agent to reliably answer quote questions. Please note when using:

  • Quote timestamps are exchange local time (A-shares Asia/Shanghai, HK stocks Asia/Hong_Kong, US stocks America/New_York). During non-trading hours, it returns a snapshot of the most recent trading session. To judge “is it real-time”, look at this timestamp, not the “Last Updated” on the page.
  • The intraday chart during non-trading days shows the full trend of the previous trading day; the date in the top left tells you which day the data belongs to.
  • A-share volume upstream unit is “lots” (手), turnover is “ten thousand yuan” (万元); the plugin has converted them to shares and yuan; HK and US stocks upstream are already shares and local currency.
  • There is only one real-time quote upstream. If the upstream is unreachable, the tool will put the failure reason in the result’s unresolved, the page will show an error bar, and neither will return old values or guessed values.
  • AI Analysis consumes model quota, per call; repeated clicks on the same question within 10 minutes will hit the page cache.
  • If the skin decoration layer at the top of the interface covers the page title, that is the fixed decoration of the enabled skin (e.g., maid-atelier) on non-session pages, and the host’s “Task Board” is the same; the page header has left whitespace according to that decoration height.

Conclusion

The value of this plugin lies in connecting quote data into DSH: the panel is for viewing, the tool is for the Agent to use, and they share the same parsing logic, so the data metrics don’t clash. Suitable for watchlist monitoring and Q&A with quotes. Directory page: https://www.skillhub.cn/plugins/mengmenghao/dsh-stock-quote ; Source code: https://github.com/mengmenghao/dsh-stock-quote .

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye