New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

dsh-ths-holdings

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsh-ths-holdings

DSH 持仓盈亏悬浮卡片(同花顺投资账本)— 自动同步真实持仓数据,显示今日盈亏、上证指数和当日走势图,无需手动添加股票。Real portfolio holdings overlay for the DSH web GUI — automatically syncs your positions from the Tonghuashun investment-ledger API.

latest
Source
npmnpm
Version
0.3.1
Version published
Weekly downloads
232
-63.64%
Maintainers
1
Weekly downloads
 
Created
Source

dsh-ths-holdings

Awesome DSH Plugin npm version GitHub stars MIT npm version

English | 中文

A floating position P&L card for DeepSeek Harness (DSH) Desktop and Web. It automatically syncs your real portfolio data from the Tonghuashun investment-ledger (同花顺投资账本) — no manual stock picking. Displays 今日盈亏 (today's P&L), 上证指数 (Shanghai Composite Index), and an intraday mini chart, all in the A-share red-up/green-down convention.

Unlike watchlist tools, this plugin reads your actual positions and shows your real profit & loss — both as a percentage and as a yuan amount — updating every 20 seconds.

Screenshots

dsh-ths-holdings card

Version compatibility

Plugin 0.3.1 targets the DSH 0.2 series and has been tested with Desktop 0.2.0-rc.2, without a compatibility exemption. For DSH 0.1, keep plugin 0.2.0; this migration does not support the older host.

0.3.1 adds Settings → Tonghuashun holdings, with a refresh interval field and card visibility switch. Changes apply when saved and persist after restart.

Installation

Desktop

  • Open DSH Desktop and select Plugins in the sidebar.
  • Select Add plugin and enter dsh-ths-holdings in the package field.
  • Confirm that you trust the plugin as prompted, then select Install.
  • When installation finishes, select Enable now. The floating card appears at the bottom-right corner. If a restart is requested, fully quit Desktop and reopen it.

Desktop does not currently update plugins automatically. To upgrade an installed version, uninstall it from the Plugins page, then install the new version. See the official DSH installation guide.

Web

Run in a terminal:

dsh plugin --profile web add dsh-ths-holdings

After installation, restart dsh web and refresh the DSH page. The floating card appears at the bottom-right corner.

Desktop and Web manage their plugins separately; use the installation method for the application you run.

Usage

Recommended — auto-acquire:

  • Open DSH Desktop or Web and click ⚙ on the card.
  • Click 🖥 自动获取 Cookie(推荐) — a system browser window opens (Edge / Chrome — the first installed one wins).
  • Sign in to the Tonghuashun investment ledger in that window (QR code / account).
  • When the sign-in succeeds the window closes itself, the Cookie is saved automatically, and the card refreshes with your portfolio.
  • The plugin auto-discovers your portfolio — if you have several, pick one from the dropdown. Done.

Click 立即更新数据 in the expanded ⚙ settings to fetch P&L and the index immediately using the saved sign-in and selected portfolio. The button shows a loading state during the request; failures retain previous successful values and their original update time.

Open Settings → Tonghuashun holdings in DSH to change the refresh interval (default: 20000 ms, or 20 seconds) and card visibility. Click Save to apply changes immediately and retain them after restart. Hiding the card stops its automatic refresh; chat queries and scheduled reports remain available.

Manual (backup):

  • Open https://tzzb.10jqka.com.cn and log in.
  • Click the browser's top-right menu → More tools → Developer tools (… in Edge, ⋮ in Chrome). F12 may have no effect on this page; open the tools through the browser menu.
  • Keep developer tools open, select Network, then refresh the ledger page to record requests.
  • Select a page or ledger API request to tzzb.10jqka.com.cn. Under Headers → Request Headers, copy the complete Cookie value. Copy only the name=value; name2=value2 portion, without the Cookie: prefix; do not copy a response's Set-Cookie header.
  • Return to DSH Desktop or Web — click ⚙, paste the cookie into STOCK_PNL_COOKIE → save.
  • The card validates the saved cookie immediately — it shows ✓ valid or ✗ invalid (with the reason/hint).

If the page reports that developer tools are unsupported, first check whether Network has already recorded a ledger request with a Cookie header. If no usable Cookie is available, use auto-acquire above. Keep developer tools open while inspecting cookies manually.

The session cookie expires eventually — when it does, the card shows a Token 已过期 banner; re-open ⚙ and click auto-acquire (or repeat manual steps 1–5) with a fresh cookie.

💡 After completing a new trade, re-upload your data from the investment-ledger app to the web version so your holdings stay consistent between the two.

Data upload tutorial

Query holdings in chat

Installing and enabling the plugin automatically makes the bundled ths-portfolio-report Skill available in ordinary chat and scheduled tasks. No separate Skill installation or MCP server is needed. Sign-in and portfolio selection use the card settings; you do not need to find or enter a portfolio ID.

After signing in, simply say in DSH chat:

Show my holdings in Tonghuashun Investment Ledger.

The assistant uses the selected portfolio. If several are available and none is selected, choose by name when asked. You can also say “Show holdings from my ‘Long-term investments’ portfolio in Tonghuashun Investment Ledger.”

Reports default to an asset overview, the full holdings table and the largest positions. They include security names and codes, quantities, cost and current prices, market values, portfolio weights, holding P&L and daily P&L. Query time and ledger upload time are shown separately; missing data is identified rather than treated as zero.

Schedule reports

For example, say:

Every weekday at 4:30 p.m. Beijing time, check my holdings in Tonghuashun Investment Ledger and generate a holdings and P&L report. Keep this task linked to the currently selected portfolio.

You can also include relevant news:

Every weekday at 9:00 a.m., check my holdings in Tonghuashun Investment Ledger and tell me about important news related to those holdings.

Have the assistant confirm the portfolio name and next run time. Scheduled reports require a running DSH host with Schedule enabled. Weekday rules do not automatically exclude exchange holidays.

Features

  • 📊 Real-time position P&L — polls every 20 s (configurable) from your actual portfolio
  • ¥ / % toggle — show today's P&L as a yuan amount, a percentage, or both
  • 📈 Intraday chart — mini polyline with a zero axis, red-up/green-down
  • 🇨🇳 Shanghai Composite Index — displayed alongside your P&L
  • 🔄 Auto-discovery — fund_key is discovered from the portfolio list; multi-account selection via dropdown
  • 🖥 Auto-acquire Cookie — one click pops the Edge sign-in window; the cookie is saved automatically, no F12 needed
  • ✓ Validate on save — the stored cookie is checked against the ledger right after paste or auto-acquire
  • ↕ Draggable — drag the title bar vertically along the right edge (position persists in localStorage)
  • ⚙ In-place settings — paste Cookie and select portfolio from the card itself
  • 🔒 Credential-safe — the Cookie never leaves the host process

FAQ / Troubleshooting

SymptomCause & fix
Card shows 请配置 CookieSTOCK_PNL_COOKIE is empty — click auto-acquire in the ⚙ panel, or paste manually.
Card shows Token 已过期Re-acquire the cookie or copy the Cookie request header using the manual steps above.
F12 has no effectClick the browser's top-right menu → More tools → Developer tools, then follow the manual steps.
Login page says developer tools are unsupportedAuto-acquire does not require developer tools. For manual acquisition, check already recorded ledger requests in Network; if no usable Cookie is available, use auto-acquire.
No portfolio in the dropdownThe account list needs a valid Cookie first; save the Cookie, then click ↻ to refresh.
Multiple portfoliosSelect the one you want from the dropdown — the choice is saved as STOCK_PNL_FUND_KEY.
Cookie pasted with line breaksThe plugin strips whitespace on save, so wrapped lines are fine.
“稍后重试” or “数据暂时无法获取”Wait and retry. The card may retain previous successful values; check the displayed update time.
The assistant cannot query holdingsCheck that the plugin is enabled and sign-in is complete. Fully restart DSH, then try again.
The report fails while the card still has valuesThe card may be showing an earlier snapshot. Reports treat the current query as failed and do not reuse old results.

Known Limitations

  • Auto-acquire uses a system browser — no Playwright installation is needed. Edge or Chrome must be installed and the host must have a visible desktop session; otherwise use manual paste.
  • Reports currently support ordinary CNY portfolios holding Shanghai/Shenzhen stocks and ETFs. Margin accounts, short positions, B shares and other markets are outside the supported scope.
  • Enter login information only in plugin settings, not in chat or scheduled prompts.

License

MIT

Keywords

dsh

FAQs

Package last updated on 18 Oct 2026

Related posts