Preface

Connecting market data to agents is a common practice that involves registering with a market data service provider, applying for an API Key, storing the Key in the environment, and writing custom A-share/US stock identification logic. This process has to be repeated for every new agent; furthermore, if you want the agent to participate in trading decisions, you have to worry about credential security and accidental order placement.

dsh-trading-toolkit consolidates this into a DSH plugin: market quote queries, ADX state signals, and simple backtest previews, all read-only. Below, we introduce its functionality, installation method, and typical usage.

What is this

dsh-trading-toolkit is a DeepSeek Harness (DSH) plugin maintained by kentleenot, licensed under MIT, currently version 0.1.0. In one sentence: it is an A-share + US stock trading toolkit for DSH agents, containing real-time quotes, historical K-lines, ADX three-state signals, and simple backtest previews.

It emphasizes a read-only design—never places orders, and does not touch any trading credentials. The agent can see data and calculate signals, but lacks a trading channel, which is crucial when integrating market data capabilities into an agent.

DSH’s philosophy is “Everything is a plugin”; external capabilities like market data are accessed via plugins and can be called by the agent immediately after installation.

Four Tools

market_quote

Stock real-time quotes. It automatically identifies A-shares/US stocks; 6-digit codes (600519), prefix codes (sh600519), Chinese names (贵州茅台), US tickers (AAPL/NVDA), and indices (上证指数/深证成指/创业板指/科创50/沪深300) can all be passed in directly. The data source is the East Money public interface; domestic direct connection, no proxy, no API Key, and free, while covering both the Shanghai/Shenzhen and US markets.

kline_history

Historical OHLCV K-lines, supporting both A-shares and US stocks. Periods 1m/5m/15m/30m/60m/1d/1w/1M, adjustment 0/1/2, up to 1000 bars per request. The output format can be fed directly into regime_signal without intermediate conversion.

regime_signal

ADX three-state market classification: trend (trend) / oscillating (oscillating) / noise (noise), accompanied by long/short direction and 200-EMA bias. Pure calculation, does not initiate network requests.

backtest_run

Simple long/short backtest based on cross-state rules, outputting total return, maximum drawdown, win rate, and number of trades. Note that this is an educational preview and not a production-grade backtest.

Automatic Routing Rules

market_quote and kline_history automatically determine the market based on the passed symbol:

6-digit numbers / sh|sz|bj prefix / CN name   → A-shares
Pure letter ticker (AAPL, NVDA, PLTR)        → US stocks
US: / CN: prefix                             → Force specified market

Common US tickers (AAPL/MSFT/NVDA/TSLA/META/AMZN/GOOGL/HOOD/AMD/NFLX/BRK/JPM/KO/DIS/BA) go through built-in mapping; unknown tickers are auto-detected for NASDAQ/NYSE/AMEX. If unsure, you can use the US: / CN: prefix to force the market.

Installation and Enablement

First, execute the following command to install this plugin in a specified profile:

dsh plugin --profile web add github:kentleenot/dsh-trading-toolkit

web is the profile name and can be replaced with your own.

After installation, add the plugin to your DeepSeek Harness configuration. See the harness third-party plugin documentation for specifics. After the steps above, the agent can call these four tools.

Typical Usage

For market queries, Chinese names, codes, indices, or forced prefixes can all be used as input parameters:

market_quote(symbol: "600519")        # A-share: Kweichow Moutai
market_quote(symbol: "贵州茅台")       # A-share: Search by Chinese name
market_quote(symbol: "000001")        # A-share: Shanghai Composite Index
market_quote(symbol: "AAPL")          # US stock: Apple
market_quote(symbol: "NVDA")          # US stock: NVIDIA (Unknown ticker auto-detects market)
market_quote(symbol: "US:AAPL")       # Force US stock
market_quote(symbol: "CN:600519")     # Force A-share

For historical K-lines, period and limit control the timeframe and quantity:

kline_history(symbol: "600519", period: "1d", limit: 120)   # Kweichow Moutai daily K
kline_history(symbol: "AAPL", period: "60m", limit: 48)     # Apple 60-min K

For signals and backtest, candles are passed directly from the output of kline_history, and feePct is the fee rate:

regime_signal(candles: [[high, low, close], ...])
backtest_run(candles: [[high, low, close], ...], feePct: 0.05)

Thresholds for State Classification

The three-state division of regime_signal uses fixed thresholds:

trend:       ADX >= 25       Direction determined by +DI/-DI cross, 200-EMA bias covers
oscillating: 15 <= ADX < 25
noise:       ADX < 15

These thresholds match the author’s production environment: the author has open-sourced their live strategy stack PrinciplesV2 (ADX-driven three-state adaptive strategy) in a read-only, educational format. See the author’s blog libuyan.top for PrinciplesV2 live review and design notes.

Suitable Scenarios and Notes

Suitable scenarios:

  1. Agents in DSH for market Q&A or market watching assistance, directly calling market_quote and kline_history.

  2. Agents that want to integrate the three-state classification idea from PrinciplesV2 into their own workflow, using regime_signal for state determination.

  3. Agents that want to roughly verify signal ideas, using backtest_run for a preview.

Pre-use notes:

  1. backtest_run is for educational preview purposes; do not use it as a production-grade backtest.

  2. Market data comes from the East Money public interface; domestic direct connection is free of charge (no Key), covering both Shanghai/Shenzhen and US markets.

  3. The plugin runs with the current dsh process permissions. It is recommended to check the source code and license (MIT) before installing.

Conclusion

The value of dsh-trading-toolkit lies in turning the repetitive labor of “connecting market data” into a single plugin installation, and using a read-only design to clearly delineate the boundary between viewing data and placing orders. If you want to add A-share/US market data capabilities to your DSH agent, you can start from the two entry points below:

  • GitHub: https://github.com/kentleenot/dsh-trading-toolkit
  • Community Directory: https://www.skillhub.cn/plugins/kentleenot/dsh-trading-toolkit (Community-maintained plugin directory, no official affiliation with DeepSeek or Huaxuan)