feat(trading): rebuild as autonomous trading operator - #10
Open
lyeka wants to merge 1 commit into
Open
Conversation
Merge plan/apply two-stage execution into a single trade_execute tool — no TTL token, no confirm_text, no request_confirm in the trading path. Confirmation (human-in-the-loop) and risk control are distinct concerns: the trading path drops HITL entirely and relies solely on a new RiskGuard seam (AllowAllGuard, no-op this phase) as the programmatic safety boundary, with automation/env context wired through for a future risk-control implementation. Also adds a real-time Futu market_snapshot tool, and hardens the REAL-account TRADE_LOCKED error to point at manual OpenD unlock since the codebase intentionally carries zero trade passwords. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
trade_plan/trade_apply二段式合并为单个trade_execute,删除 TTL 令牌、confirm_text、request_confirm——自主交易操作员范式,LLM 决策后一次调用完成校验+preview+风控裁决+下单/撤单+状态回读RiskGuardseam(trading/policy.py):RiskAction(ALLOW/DENY/ESCALATE) /RiskContext(operation/env/automation/intent) /RiskDecision,这期唯一实现AllowAllGuard恒 ALLOW,占位 + TODO,真实风控是独立后续专题request_confirm;程序化护栏是唯一安全边界market_snapshot(FutuAdapter.snapshot(),走get_market_snapshot,无需 subscribe)TRADE_LOCKED)报错改为明确指向 Futu OpenD 手工解锁——代码侧零密码,不调用unlock_trade()trade_execute对自动化任务放行(RiskContext.automation字段已预留裁决挂钩,当前未强制)TradePlanStore/TradePlan及相关 TTL/plan-id 流转逻辑docs/trading.md(权威规格重写)、docs/tools.md、docs/agent-design.md、docs/automation.md、.env.example、pyproject.toml(futuextra)、GEB 分形文档(新建trading/CLAUDE.md,更新athenaclaw/CLAUDE.md)Test plan
pytest tests/unit tests/integration -q→ 90 passedpytest tests/bdd -v→ 183 passedtrade_plan|trade_apply|TradePlanStore|plan_store|PLAN_NOT_FOUND|PLAN_EXPIRED|PLAN_ALREADY_APPLIED|ATHENACLAW_TRADE_MODE→ 0 处残留market_snapshot→trade_execute一步下单无确认弹窗 → real 账户返回手工解锁提示🤖 Generated with Claude Code