Squashed 'docs/standards/playbook/' changes from b529012..a854534
a854534 ✨ feat(plan_progress): auto-detect env for blocked plans 0d9a8ec 🐛 fix(playbook): honor no_backup for sync 2d401fa ✅ test(templates): update prompts validation e23474e 📝 docs(playbook): update prompts and sync notes 60ff3cd 🐛 fix(playbook): sync templates per file 816f036 ✅ test(playbook): add sync and vendor coverage 625cabb 📝 docs(memory_bank): reformat templates 2554c87 📝 docs(prompts): refresh prompt templates 6774a9d ✨ feat(plan_progress): track plan status in progress.md 73d5c26 🔧 chore(playbook): split sync_templates into sections 278750e ✨ feat(playbook): add plan progress tracking and rules updates 6efd637 🐛 fix(sync): keep agents block blank lines ea00d43 🐛 fix(playbook): support toml without tomllib ab0dd11 📝 docs(playbook): drop docs/plans snapshots 398696c ✨ feat(playbook): merge unified cli d959f80 🎨 style(docs): format markdown b4f712a 🗑️ remove(legacy): drop old scripts and tests 0c4cd0e ✨ feat(actions): add install_skills and format_md 3d1582c ✨ feat(sync): add templates and standards actions 49bbfa1 ✨ feat(vendor): add playbook snapshot generation 8cfcc25 ✨ feat(cli): parse toml config and dispatch actions 05903c3 ✨ feat(cli): add toml config and dispatch order 65d216e ✅ test(cli): add basic playbook cli tests f0bcf54 📝 docs(plans): add unified playbook cli plan 0885309 📝 docs(plans): add unified playbook cli design 3483d8a 🔧 chore(git): ignore .worktrees dir eb75036 🔧 chore(templates): align agent templates and docs efb93f1 📝 docs(playbook): drop todo/confirm mentions 4a85306 🗑️ remove(workflow): drop todo/confirm artifacts 9c5ee9f 🎨 style(markdown): format docs with prettier 5a2925f 🐛 fix(scripts): repair windows script parsing 26a35e0 ✅ test(ci): update required skills list 8df3883 🐛 fix(test): skip external root doc links b067fc1 📦 deps(skills): sync superpowers c03cda0 🔧 chore(ci): sync from origin main 55e05cb 🔧 chore(ci): use superpowers sync script 73c97f3 🔧 chore(ci): centralize superpowers sync 945704f 🔧 chore(ci): add superpowers sync workflow e5d2c93 🗑️ remove(skills): drop duplicate workflows 3ae9708 🐛 fix(ci): update tests for flag-only scripts c44b9aa 🔧 chore(scripts): require flag-driven args e4e1d14 🔧 chore(scripts): unify single-dash options b2eb475 ✅ test(templates): add template coverage fc230b7 🎨 style(markdown): format markdown files 8dc8924 🔧 chore(markdown): add prettier config and usage 2045dd4 ✨ feat(vendor_playbook): add apply-templates option 872d8cf ✨ feat(templates): add sync templates scaffolding 5b1ca45 📝 docs(skills): clarify todo-plan template 054967a ✨ feat(skills): add todo-plan skill cc340f1 🔧 chore(ci): align standards-check workflow template e9de0aa 🔧 chore(ci): drop removed skill check e5dd7d9 🔧 fix(sync): avoid backtick expansion 087b0b9 🔧 chore(sync): align agents block across ps1/bat 9481510 🔧 chore(sync): scope agents block to existing langs b0ca842 🔧 fix(sync): rewrite docs path in agents c98d65c 🔧 chore(sync): rewrite agents docs paths c33611c 🗑️ remove(skills): drop unused skills and update references 2b37860 🎨 style(markdown): format markdown files e3ecd26 📝 docs(tsl): align syntax annotations and examples 37546fe 🐛 fix(playbook): enforce rulesets to agents flow f2df89d 🐛 fix(scripts): include language list in AGENTS.md c0d0737 🐛 fix(playbook): add agents mirror for sync 3b8b99b 🎨 style(markdown): normalize md headings and lists 31f3000 ♻️ refactor(playbook): rename agents template directory to rulesets 11b2bed ✨ feat(markdown): add ruleset and sync support 5b89580 ✅ test(scripts): quiet git init warnings 5822a87 ♻️ refactor(playbook): streamline agents and refresh tsl docs git-subtree-dir: docs/standards/playbook git-subtree-split: a85453439f65b0c0aa05a5bbece773a02216ce76
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# 天软 pyTSL 接口使用说明
|
||||
|
||||
## 定位
|
||||
|
||||
- 官方 Python SDK,面向取数/执行/批量/异步与数据转换。
|
||||
|
||||
## 结构索引
|
||||
|
||||
- 安装与配置
|
||||
- pyTSL 接口说明(Client / AsyncClient / async_util / Batch / Task / Const / TSResultValue)
|
||||
- pyTSLPy 兼容说明
|
||||
- 示例与数据类型转换
|
||||
- 附录与常见问题
|
||||
|
||||
## 安装方式(摘要)
|
||||
|
||||
- `pip install tspytsl`(在线安装)
|
||||
- 离线安装与手动部署
|
||||
|
||||
## 核心类与模块
|
||||
|
||||
- `pyTSL.Client`:同步客户端
|
||||
- `pyTSL.AsyncClient`:异步客户端
|
||||
- `pyTSL.async_util`:异步工具函数
|
||||
- `TSBatch` / `Task`:批量与任务
|
||||
- `TSResultValue`:统一返回结果封装
|
||||
- `pyTSL.Const`:常量与字段
|
||||
|
||||
## 关键方法(常用)
|
||||
|
||||
- `login` / `logout`
|
||||
- `exec` / `call` / `query`
|
||||
- `download_list` / `download` / `upload` / `remove`
|
||||
- `DatetimeToDouble` / `DoubleToDatetime`
|
||||
- `EncodeStream` / `DecodeStream`
|
||||
- `DataFrameToTSArray`
|
||||
|
||||
## 示例(Python)
|
||||
|
||||
```python
|
||||
import pyTSL
|
||||
|
||||
c = pyTSL.Client("user", "password")
|
||||
c.login()
|
||||
|
||||
result = c.query("select close from market where stock = 'SZ000001' end")
|
||||
print(result.dataframe())
|
||||
|
||||
c.logout()
|
||||
```
|
||||
@@ -0,0 +1,66 @@
|
||||
# 策略回测框架 TSBackTesting
|
||||
|
||||
## 定位
|
||||
|
||||
- 提供统一的策略回测框架(股票/期货/期权/组合等),覆盖资金、交易约束、清算与绩效输出。
|
||||
|
||||
## 结构索引
|
||||
|
||||
- 策略回测流程
|
||||
- 成员变量
|
||||
- 成员方法
|
||||
- 查询用接口
|
||||
- 回测范例
|
||||
- 债券品种回测说明
|
||||
- 期权组合策略回测说明
|
||||
- 常见问题
|
||||
|
||||
## 回测流程概览
|
||||
|
||||
- 组合类型选择 → 交易数据准备 → 回测执行 → 结果查询与分析。
|
||||
|
||||
## 组合类型
|
||||
|
||||
- 比例类组合:提供目标权重。
|
||||
- 数量类组合:提供成交量/成交价等交易明细。
|
||||
|
||||
## 关键成员变量(分组摘要)
|
||||
|
||||
- **时间与周期**:`FBegT`、`FEndT`、`FCycle`
|
||||
- **组合类型**:`FGroupType`(比例类/数量类)
|
||||
- **资金与价格**:`FIniCash`、`FPriceType`、`FPriceType1..4`
|
||||
- **交易约束**:`FNoZT`、`FNoDT`、`FMinVol`、`FMinAmount`、`FMaxVolPercent`、`FMaxAmountPercent`
|
||||
- **费用与分红**:`FFeeType`、`FlowestFeeType`、`FDividendType`
|
||||
- **期权与期货特性**:`FOptionRs`、`FMainFutureMap`
|
||||
- **基准与输出**:`FBMType`、`FBMDetail`、`FBMOption`、`FHFDataOutPut`
|
||||
|
||||
> 详细取值及说明以实际接口定义为准。
|
||||
|
||||
## 关键成员方法(常用)
|
||||
|
||||
- `BackTest`:执行回测
|
||||
- `GetTimeSeries`:返回净值/收益率时间序列
|
||||
- `GetTradeOrder`:返回调仓/成交数据
|
||||
- `GetNetAssetValue` / `GetAssetData` / `GetHoldData`:资产与持仓
|
||||
- `GetPercent`、`GetIRRReturn`、`ReturnBenchmark`:绩效指标
|
||||
- `GetClearancePrice` / `GetIntVol` / `GetOtherData`:扩展查询
|
||||
|
||||
## 最小流程示例(概念化)
|
||||
|
||||
```tsl
|
||||
// 1) 初始化参数
|
||||
backtest := new TSBackTesting();
|
||||
backtest.FBegT := 20240101T;
|
||||
backtest.FEndT := 20241231T;
|
||||
backtest.FGroupType := 1; // 比例类
|
||||
backtest.FIniCash := 1000000;
|
||||
|
||||
// 2) 设置交易数据(比例类:目标持仓)
|
||||
// backtest.SetTradeData(trade_data);
|
||||
|
||||
// 3) 执行回测
|
||||
backtest.BackTest();
|
||||
|
||||
// 4) 获取结果
|
||||
return backtest.GetTimeSeries();
|
||||
```
|
||||
@@ -0,0 +1,46 @@
|
||||
# 天软平台和 Python 的交互
|
||||
|
||||
## 摘要
|
||||
|
||||
- 覆盖三类交互:Python 调用 TSL、TSL 调用 Python、落地服务器开启 Python 服务。
|
||||
- 提供 COM/远程登录两种路径,以及 `PyRun`/`PyCall` 体系。
|
||||
|
||||
## 结构索引
|
||||
|
||||
- 支持版本
|
||||
- Python 调用 TSL:配置步骤 / 接口说明 / 范例
|
||||
- TSL 调用 Python:配置步骤 / 接口说明 / 范例
|
||||
- do Python 方式
|
||||
- 落地服务器开启 Python 服务
|
||||
- sklearn 机器学习接口
|
||||
- 附录与 FAQ
|
||||
|
||||
## Python 调用 TSL(核心步骤)
|
||||
|
||||
1. 配置环境变量(天软目录、Python 目录)。
|
||||
2. 加载 TSLPy 模块(直接加载或修改包名)。
|
||||
3. 选择连接方式(COM / 远程登录)。
|
||||
|
||||
## 主要接口(Python 侧)
|
||||
|
||||
- 服务器:`ConnectServer` / `LoginServer` / `Disconnect`
|
||||
- 执行:`RemoteExecute` / `RemoteCallFunc`
|
||||
- 系统参数:`SetSysParam` / `GetSysParam`
|
||||
- 日期转换:`EncodeDate` / `DecodeDate` / `EncodeDateTime` / `DecodeDateTime`
|
||||
|
||||
## TSL 调用 Python(核心接口)
|
||||
|
||||
- `PyPutVar` / `PyGetVar`
|
||||
- `PyRun`(执行脚本)
|
||||
- `PyCall`(调用 Python 函数,支持命名参数)
|
||||
- `PyError` / `PyRelease` / `PyEnsure`
|
||||
|
||||
## do Python 方式
|
||||
|
||||
- 适合快速执行 Python 脚本,省去显式接口调用。
|
||||
|
||||
## 注意事项(精简)
|
||||
|
||||
- Python 与 TSL 位数必须一致。
|
||||
- 多版本 Python 需同步设置 `PYTHONHOME`。
|
||||
- TSL 调 Python 不支持网格调用。
|
||||
@@ -0,0 +1,60 @@
|
||||
# 发送微信消息使用说明
|
||||
|
||||
## 摘要
|
||||
|
||||
- 通过“天软科技服务号”向微信客户端发送模板消息。
|
||||
- 支持同步/异步发送,异步可用消息 ID 查询状态。
|
||||
|
||||
## 前置条件
|
||||
|
||||
- 用户关注并绑定天软科技服务号,获得 `userid`。
|
||||
- 给他人发送消息需对方授权其 `userid`。
|
||||
|
||||
## 核心接口
|
||||
|
||||
- `send_wechat_message(userid, url, title, first, remark[, k1..k6])`
|
||||
- 同步发送;成功返回 `success`,否则返回错误信息。
|
||||
- `send_wechat_message_async(userid, url, title, first, remark[, k1..k6])`
|
||||
- 异步发送;返回 16 位消息 ID(时间戳 + 随机数)。
|
||||
- `get_wechat_message_status(userid, username, wechat_message_id)`
|
||||
- 查询异步发送结果;返回 “成功” 或错误信息。
|
||||
|
||||
## 参数说明(模板消息)
|
||||
|
||||
- `userid`:绑定账户后获取的用户标识(必需)。
|
||||
- `url`:详情地址(必需,可为空字符串)。
|
||||
- `title`:模板消息标题(必需)。
|
||||
- `first`:副标题(一般需要)。
|
||||
- `remark`:备注(一般需要)。
|
||||
- `k1..k6`:模板关键字参数(根据模板类型变化)。常见模板示例:
|
||||
- 监控报告通知:运行状态/时间
|
||||
- 系统运行简报:系统名称/简报内容/发布时间
|
||||
- 告警通知:告警内容/发生时间
|
||||
|
||||
## 同步 vs 异步
|
||||
|
||||
- 同步:阻塞等待结果,适合紧急通知。
|
||||
- 异步:立即返回,适合非紧急通知;用 `get_wechat_message_status` 查询。
|
||||
|
||||
## 示例(TSL)
|
||||
|
||||
```tsl
|
||||
// 定义参数
|
||||
url := "http://tinysoft.com.cn";
|
||||
user_id := "190F1826267E0EB45658FB81836636A7";
|
||||
|
||||
title := "监控报告通知";
|
||||
first := "运行状态";
|
||||
keyword_1 := "运行正常";
|
||||
keyword_2 := "";
|
||||
DateTimeToString(keyword_2, "YYYY-MM-DD HH:NN:SS", Now());
|
||||
remark := "如有疑问请与技术人员联系!";
|
||||
|
||||
// 同步发送
|
||||
echo send_wechat_message(user_id, url, title, first, remark, keyword_1, keyword_2);
|
||||
|
||||
// 异步发送
|
||||
wechat_message_id := send_wechat_message_async(user_id, url, title, first, remark, keyword_1, keyword_2);
|
||||
// 获取结果
|
||||
echo get_wechat_message_status(user_id, "username", wechat_message_id);
|
||||
```
|
||||
Reference in New Issue
Block a user