Introduction

In the DSH web GUI, if stocks are used solely as query targets or favorites, the list you see is usually manually maintained. For those who have recorded real holdings in the Tonghuashun Investment Ledger, the more direct need is to put real holdings P&L into the current working interface, reducing the need to switch back and forth between pages.

Below is an introduction to the DSH plugin dsh-ths-holdings. It reads real holdings data from the Tonghuashun Investment Ledger and displays today’s P&L, the Shanghai Composite Index, and the daily trend chart in the bottom right corner of the DSH web GUI. No manual addition of stocks is required.

What is this

dsh-ths-holdings is a DSH plugin positioned as a “Holdings P&L Floating Card”.

  • Plugin Name: dsh-ths-holdings
  • Maintainer: PM25000
  • License: MIT
  • Problem Solved: Automatically syncs real holdings data from the Tonghuashun Investment Ledger, displaying today’s P&L, the Shanghai Composite Index, and the daily trend chart in the DSH web GUI.

This plugin is not a simple favorites tool; it reads real holdings and P&L data.

Core Features

Verified features include:

  • Real-time Holdings P&L: Polls by default every 20 seconds, capable of fetching data from the real portfolio.
  • Today’s P&L Display: Can display currency amount, percentage, or both.
  • Daily Trend Chart: Mini line chart with a zero axis, following the Red for gain, Green for loss convention.
  • Shanghai Composite Index: Displayed alongside P&L.
  • Multi-account Support: Automatically discovers fund_key, supports selecting from a portfolio list dropdown.
  • Auto-get Cookie: One-click pop-up system browser login window and automatically save Cookie.
  • Validation on Save: Immediately validate Cookie validity after pasting or auto-getting.
  • Draggable: Drag the title bar vertically along the right edge; position is saved in localStorage.
  • Settings within Card: Paste Cookie and select portfolio directly within the card.
  • Credential Security: Cookie does not leave the host process.

Additionally, the plugin only retains Cookie for the 10jqka domain and does not store it in plaintext.

Installation and Usage

First, confirm the runtime environment. Documentation indicates Node requirements are:

^22.19.0 || >=24.0.0

Install to DSH web profile:

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

After installation, restart the web service:

dsh web

After starting, a floating card will appear in the bottom right corner of the DSH web GUI.

Typical Usage

It is recommended to use the auto-get process first:

  1. Open the DSH web GUI.
  2. Open card settings and select “Auto-get Cookie (Recommended)”.
  3. Log in to the Tonghuashun Investment Ledger in the popped-up system browser window.
  4. After successful login, the window closes automatically, Cookie is saved automatically, and the card refreshes holdings.
  5. If there are multiple portfolios, select the target portfolio from the dropdown.

The auto-get window includes anti-automation camouflage to bypass Tonghuashun WAF. If the page encounters WAF or Nginx forbidden, you can press F5 in the window or manually open:

https://tzzb.10jqka.com.cn

After logging in, click “I have logged in, continue →”.

If auto-getting fails, you can paste manually:

  1. Open the Tonghuashun Investment Ledger webpage and log in:
https://tzzb.10jqka.com.cn
  1. Open browser developer tools and execute in F12 Console:
copy(document.cookie)
  1. Return to DSH card settings and paste the Cookie into the configuration item:
STOCK_PNL_COOKIE
  1. Save.

The plugin will validate the Cookie immediately after saving and display a valid or invalid status.

Session Cookie will expire. After expiration, the card will display Token Expired, requiring re-auto-getting or manually pasting a new Cookie.

Portfolio Data Update

After completing new trades, re-upload data from the Investment Ledger app to the web version to keep holdings consistent.

Use Cases and Notes

Suitable for DSH users who already use the Tonghuashun Investment Ledger and wish to view real holdings P&L in the DSH web GUI.

Notes before use:

  • This plugin runs with the current dsh process permissions; source code and license should be checked before installation.
  • Cookie is a session credential and will expire; it needs to be re-obtained or manually pasted after expiration.
  • The functional descriptions in this article are based on verified data; there is truncation at the end of the data, and there may be unlisted capabilities, dependencies, or limitations.

Links

GitHub:

https://github.com/PM25000/dsh-ths-holdings