feat(ths): switch_account 多账户盲切工具(Alt+N) - #6
Merged
Merged
Conversation
同花顺 xiadan 支持多账户登录(账户下拉框 Alt+1..Alt+9 加速键切换当前 资金账户)。本工具把切换能力暴露给 MCP 调用方,受控端保持账户无感知: - 只做「拉前台 + 发 Alt+N」盲切,不核验切换结果;账户身份核对责任在 调用方(切换后必须用 balance/position 做指纹核对再继续操作,工具 description 已写明) - slot 参数闸:非整数 / 超出 1-9 一律在碰 Win32 之前拒绝 - 纳入 trading_methods:受插件开关门控 + win_lock 串行化 + 25s 总超时 - FALLBACK_TOOLS_SCHEMA 与 docs/tools_schema.json 双源同步(受 test_fallback_schema_matches_file_schema 全等校验护住) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
suny911
marked this pull request as ready for review
July 13, 2026 15:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
xiadan 新版皮肤支持多账户登录,账户下拉框为每个已登录账户注册 Alt+1..Alt+9 加速键。操盘副驾需要在多账户场景下切换资金账户继续执行策略——但受控端保持账户无感知(最小影响原则):不加 account 参数、不核验身份,只提供一个发快捷键的开关。
变更
WinThsBackend.switch_account(slot):slot 参数闸(int 强转 + 1-9 范围,非法值在碰任何 Win32 前拒绝)→_ensure_bound→ 拉前台 +hot_key(["alt", str(slot)])盲切,回执明确标注「未核验结果,请先 balance/position 指纹核对」。_invoke路由 / tools/list 过滤名单,四处登记。账户身份核对責任在调用方
切换后所有工具作用于新的当前账户。调用方(操盘副驾)纪律:
switch_account→balance/position指纹核对 → 批式操作 → 用完切回默认账户。待实测(Windows 端)
sleep_time*2是否足够🤖 Generated with Claude Code