dsh-stock-ticker: Adds a scrolling ticker bar at the top of the DSH Web interface.

Introduction

When running agents via DSH’s Web UI, there is no stock quote display area in the interface. To check the watchlist, you have to open another quote page and switch back and forth between the chat and quotes. The dsh-stock-ticker plugin maintained by kfat77 attaches the ticker directly to the top of the DSH page: the watchlist, refresh frequency, and flash threshold can be modified on the interface, and the changes are written to the profile for long-term saving.

Below is an introduction to the plugin’s features, installation method, and configuration syntax.

What is it

dsh-stock-ticker is a DSH plugin maintained by kfat77, categorized as a networking tool, with current version 0.2.0 and an MIT license. Its scope is narrow: adding an exchange-style ticker at the top of the Web UI, supporting a mix of indexes and A-shares, Hong Kong stocks, and US stocks. Quotes are batch-fetched by the host side and forwarded to the browser side. The data source is the Tencent quote interface; the browser does not connect directly to the upstream.

Core Features

  • Full-width ticker at the top, content scrolls from right to left in a loop; pause on hover, resume on move.
  • Distinguish up/down by color: green for up, red for down, gray for flat, accompanied by ▲ / ▼ markers.
  • Supports mixing indexes with A-shares, HK stocks, and US stocks, fetching in a single batch request; defaults include Shanghai Composite Index, Shenzhen Component Index, and NASDAQ.
  • Clicking any entry opens a detail card showing open, high, low, previous close, and quote time; close by pressing Esc or clicking elsewhere.
  • Entries exceeding the threshold (default 3%) flash lightly as a reminder; the threshold can be changed in settings, with 0 meaning disabled.
  • The gear button on the right opens the settings panel; changes take effect immediately upon saving and are written to cordis.patch.yml in the profile, persisting after restart.
  • The ticker reserves its own height, shifting the three columns below down as a whole without obscuring interface content; native title bar buttons on Windows desktop are always visible.

Installation and Activation

The installation command provided in the README is for local directory installation, used in development scenarios:

dsh plugin install /path/to/dsh-stock-ticker

This step installs the plugin into the current DSH environment. After installation, the ticker appears at the top of the page immediately without needing to modify document.body or replace the app root node.

You can also call plugin_manager install_bundle within an agent, passing a local directory or GitHub repository URL as the target. The plugin manifest is driven by package.json: dsh.bundle.patch points to the patch file, dsh.client declares the browser-side entry, and cordis.patch.yml is responsible for inserting the plugin row into the profile.

Stock Code Syntax

The stock code column in the settings panel supports the following syntaxes:

Syntax Market Example
Alphabet Code US Stocks / US Indexes AAPL, TSLA, usIXIC (NASDAQ), usDJI (Dow Jones)
Numeric Code + Suffix A-shares / A-share Indexes 600519.SH, 000001.SZ, 430047.BJ, 000001.SH (Shanghai Composite)
Numeric or Alphabetic Code + Suffix HK Stocks / HK Indexes 00700.HK, HSI.HK (Hang Seng)
Original Prefix Any sh600519, sz000001, hk00700, usAAPL, hkHSI
Pure Numeric Inferred by rules 6-digit numbers: starting with 5/6/9 is Shanghai, 4/8 is Beijing Stock Exchange, the rest are Shenzhen; 4-5 digits filled to 5 digits represent HK stocks

Unrecognized codes will be ignored, and a prompt will be displayed on the right side of the ticker.

Configuration

The settings panel on the interface uses configEditor to write to the profile layer, equivalent to writing in cordis.patch.yml:

- id: stock-ticker
  name: dsh-stock-ticker
  config:
    symbols:
      - sh000001
      - sz399001
      - usIXIC
      - AAPL
      - 600519.SH
      - 00700.HK
    refreshSeconds: 15
    flashPercent: 3

The three fields correspond to the stock code list, refresh frequency (seconds), and alert threshold (%). After saving, the plugin validates and returns the latest snapshot.

Data Source and Routing

The host side (lib/index.js) makes batch requests to https://qt.gtimg.cn/q=, parses name, current price, change amount, change percentage, open, high, low, previous close, and time after GBK decoding. The browser only accesses the plugin’s same-origin routes and does not connect directly to the upstream, so it is not subject to CORS restrictions. Results for the same batch of codes are cached for half a refresh cycle; if the upstream fails, the previous data is displayed.

There are two host routes:

  • GET /api/dsh-stock-ticker/quotes — Snapshot of current watchlist quotes.
  • POST /api/dsh-stock-ticker/config — Validates and saves watchlist, refresh frequency, and alert threshold, returning the latest snapshot.

Both routes go through connection.requestRejection() first, sharing the same source validation with other Web APIs.

Implementation Highlights

  • The browser side is registered to shell.overlay (full-frame overlay). After the component mounts, it traverses up the DOM to find the parent element of [data-shell-overlay], reads its current padding-top (equals native title bar height on Windows desktop, 0 in browser), positions the ticker below this height, and writes this height plus 32px back to padding-top, thereby reserving space for the ticker.
  • The ticker uses translate3d and CSS animation; the track consists of two copies, aligning perfectly at -50% displacement to form a seamless loop. If there are too few watchlist items, the loop is repeated several times until the viewport is filled to avoid empty segments.
  • Polling uses setInterval, rebuilt with refreshSeconds; it refreshes immediately when the page becomes visible again.
  • Both alerts and detail cards respect prefers-reduced-motion: no flashing when motion is reduced, and the ticker changes to horizontal scrolling.
  • All timers, listeners, and injected <style> are registered with cleanup functions via ctx.effect, leaving no residue after component unmounting.

Use Cases and Notes

Suitable for developers and agent users who want to keep an eye on their watchlist in the DSH Web UI without switching windows. The limits of the settings panel are: up to 40 stock codes, refresh frequency 5–300 seconds (default 15), alert threshold 0–20 (default 3).

Two points need attention: the plugin runs with the permissions of the current DSH process; check the source code and license (MIT) before installing. Quote data comes from a public third-party interface, and the repository has 0 stars, so evaluate the upstream stability yourself before use.

Summary

dsh-stock-ticker fulfills a very lightweight requirement completely: a top ticker, multi-market watchlist, threshold alerts, detail cards, and profile persistence. It does not change the structure of the DSH core; it injects into the profile via patch, and the installation path and configuration fields are centralized in the README. The directory page is at https://www.skillhub.cn/plugins/kfat77/dsh-stock-ticker, and the source code is at https://github.com/kfat77/dsh-stock-ticker.

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

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

Xiaoye