DeepSeek Harness (DSH) core philosophy is “everything is a plugin.” When developing or using agents to analyze financial data, intuitive charts are often needed to support judgment. dsh-stock-chart, as a built-in plugin, aims to solve the problem of “how to quickly render professional-grade K-line charts in the DSH environment.” It is based on TradingView’s Lightweight Charts engine, provides daily/weekly switching, common technical indicator calculations, and drawing tools, and uses SQLite persistent storage for data to save model context Tokens. This plugin is maintained by xlin20021 and is licensed under the MIT License.

Core Features

  1. K-line charts: Supports one-click switching between daily and weekly charts (weekly charts are automatically aggregated from daily charts).
  2. Technical indicators: Automatically calculates MA5/10/20/60/120, BOLL, MACD, KDJ, and volume.
  3. Drawing annotations: Based on lightweight-charts-drawing, supports tools such as lines, rectangles, and text, and supports deleting selected elements with the Delete/Backspace keyboard shortcuts.
  4. Data persistence: Uses SQLite to store historical data, supporting chart reproduction across sessions and browsers.
  5. Token-efficient data fetching: Includes the stk-fetch.mjs script, which writes K-line data directly into SQLite and avoids passing large amounts of historical data through the model context.
  6. Plugin configuration: Provides a visual settings page where you can configure parameters such as the Python path and MCP server name.

Installation

Before installation, ensure the dependencies @deepseek-ai/dsh-settings and @deepseek-ai/schemastery are installed.

Option 1: Local development installation

Add the dependency to the package.json of the web profile:

"dependencies": { "dsh-stock-chart": "file:E:/dsh/dsh-stock-chart" }

Add the entry "dsh-stock-chart" to dsh.profile.bundles, then restart dsh web.

Option 2: Post-release installation

Use the official installation command:

dsh plugin --profile web add github:<repo>#vX.Y.Z

(Replace <repo> with the actual GitHub repository address and vX.Y.Z with the specific version number.)

Usage

The usage workflow has two steps: data ingestion and chart rendering.

1. Data ingestion

Run the fetching script to write data into SQLite. For A-shares as an example:

node E:\dsh\dsh-stock-chart\stk-fetch.mjs <symbol> mootdx

For HK stocks (5-digit codes) or US stocks (letter codes), you can use the mcp source:

node E:\dsh\dsh-stock-chart\stk-fetch.mjs <symbol> mcp

2. Chart rendering

Call the stock_chart_push function in a DSH session. Because the data is already stored in SQLite, the agent only needs to pass the stock code:

stock_chart_push({ symbol: "600519", name?: "贵州茅台", quote?: { ... } })

The plugin automatically reads the data from SQLite and renders the chart. If there is no data in the database, the function returns a path hint for the fetching script and prompts the user to ingest the data first.

Configuration

The plugin configuration is located under DSH’s “Settings -> Plugins -> dsh-stock-chart”, and the configuration file is saved to ~/.dsh/stkdata/config.json.

  • Python path: Used to run the mootdx library to fetch A-share data. Defaults to python in PATH.
  • Stock MCP server name: Used to fetch HK/US stock data. Defaults to stock.
  • Data directory: Storage location for the SQLite database. Defaults to ~/.dsh/stkdata.

The environment variables STK_PYTHON, STK_MCP_URL, and STK_DATA_DIR can override the above configuration.

Architecture and Dependencies

  • Architecture:
    • stk-fetch.mjs: Runs on the agent side, responsible for fetching data from data sources and writing it to SQLite.
    • dsh/index.js: The main plugin program, which provides interfaces to read SQLite, calculate indicators, and provide HTTP endpoints.
    • chart.html: The browser-side page responsible for chart rendering and drawing interactions.
  • Dependencies:
    • The plugin itself depends on @deepseek-ai/cordis, @deepseek-ai/dsh-brand, @deepseek-ai/dsh-invariants, @deepseek-ai/dsh-settings, and @deepseek-ai/schemastery.
    • Third-party dependencies: Lightweight Charts (Apache-2.0), lightweight-charts-drawing (MIT), and mootdx (MIT).

dsh-stock-chart provides a standardized financial charting solution for the DSH environment, suitable for developers and users who need to visually analyze stock quotes in a conversation. All code and configuration are open source; refer to the GitHub repository for secondary development or customization.