@dshtrading/client-ui-trading 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,75 @@
1
+ Copyright (c) 2026 zhu1090093659 (dsh-trading)
2
+
3
+ # PolyForm Noncommercial License 1.0.0
4
+
5
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @dshtrading/client-ui-trading
2
+
3
+ 交易 GUI 壳(专业交易软件的三栏式架构载体),dsh web 宿主双面包插件:
4
+
5
+ - **node 半**(`src/index.ts`):注册 `/dshtrading/api` 前缀路由,把客户端行情请求透传给
6
+ 对应市场的 `MarketDataService`(connector-binance/yahoo/tencent)。依赖 `webServer` +
7
+ `connection`(`ctx.inject` 子插件声明),**headless 宿主永不解析、零副作用**。
8
+ 路由挂在 `connection.requestRejection` 认证栅栏后(与 `/api` 同一浏览器 cookie)。
9
+ - **浏览器半**(`src/client/index.ts`):
10
+ - 遮蔽 `sidebar.workspaces`(priority -1)→ 左栏市场页签(自选/crypto/us/cn/hk)+
11
+ 标的行(迷你走势、最新价、涨跌幅,红涨绿跌)、搜索加自选(localStorage 持久化);
12
+ - `shell.overlay` 加 `dshtrading-quote-pane`(order 50)→ 中栏舞台
13
+ `MiddleStage`(3.0):视图注册表(行情 | 量化占位)+ 顶部切换条;行情视图 =
14
+ 报价头 + **lightweight-charts v5 K线**(主图蜡烛 + 叠加指标,副图成交量 +
15
+ 指标,周期页签,crypto 支持分钟级)+ OKX 式技术指标选择器(3.1:单按钮
16
+ 展开,主/副图两组勾选 + 行内参数编辑);
17
+ - `shell.overlay` 加 `dshtrading-session-rail`(order 60)→ 右缘常驻会话竖条
18
+ (折叠/新会话/设置,2.9)。
19
+ - 中栏几何由 QuotePane 实测(自选停靠右缘 ↔ 对话列/竖条左缘),视图互斥挂载。
20
+
21
+ ## 指标系统(3.1 插件化)
22
+
23
+ - 指标 definition(类型 + math + 预置)在纯库 `@dshtrading/indicators`;预置
24
+ MA/EMA/BOLL/MACD/RSI/KDJ 由 `@dshtrading/client-ui-indicators` 插件在
25
+ client 上下文 provide 为 `tradingIndicators` 服务(cordis reflect.provide)。
26
+ - 本包持有本地注册表(`indicator-registry.ts` 单例)+ 可选桥接(`ctx.inject`
27
+ 服务可用才合并 definition);插件未安装时行情视图零指标正常工作。
28
+ - definition 的 title/label 是普通字符串(宿主 locale 命名空间单占,外部插件
29
+ 无 i18n 通道);社区指标 = 交付纯数据 definition 并 inject 服务 register。
30
+ 设计与备选:`.agents/notes/implemented/architecture/2026-08-30-indicator-plugin-split.md`。
31
+
32
+ ## 数据与合规(铁律 #5)
33
+
34
+ - 桥是无状态透传:不缓存、不落盘、不再分发;频率由客户端轮询控制
35
+ (自选批量 8s/市场、行情页 5s,页面隐藏时暂停),单次批量 symbols 封顶 32。
36
+ - 行情源是各连接器的公共端点(Yahoo/腾讯/Binance),ToS 边界见根 README 数据源表。
37
+ - 自选列表只存浏览器 localStorage(`dshtrading.watchlist.v1`),不上传。
38
+
39
+ ## 已知边界(上游改进候选)
40
+
41
+ 1. **视图切换没有跨组件通路**:`conversation.view` 的激活视图是宿主按会话持久化的
42
+ 私有 store,外部无法程序化切 tab——左栏点击标的后,若当前不在「行情」tab,需手动点
43
+ 一次(之后按会话保持)。上游若把视图切换暴露成 ctx 服务即可消除。
44
+ 2. **无会话时中栏是宿主 hero**(选择工作区 + 新会话输入框):`conversation.view` 只在
45
+ 会话内渲染,属宿主结构;在官方 composer 直接输入即建会话进入。历史会话面板
46
+ 已 portal 并入该 hero 容器拼成同一张卡(HomeHistory),设置/新会话/折叠收敛在
47
+ 右缘常驻会话竖条(SessionRail,2.9)。
48
+ 3. 右栏面板是浮层(`shell.overlay`),非占位列——展开时覆盖中栏右缘;折叠为 34px 细轨。
49
+ 真正的停靠列需要宿主 AppFrame 扩展(上游建议)。
50
+ 4. `Ticker` 契约无 name 字段:搜索添加的标的以代码为显示名(种子列表带中文名)。
51
+
52
+ ## 构建
53
+
54
+ `pnpm build`(node 半 tsdown + 浏览器半 tsdown.client.config.mjs,与 client-ui-settings
55
+ 同款三段 banner/intro/footer 契约与 CSS module 内联)。