-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: 实现手动平仓历史记录检测功能 #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 实现手动平仓历史记录检测功能 #521
Conversation
- 新增 PositionDetail 结构体存储持仓快照 - 在 AutoTrader 中维护 previousPositions 和 currentCyclePositions - 每个交易周期对比持仓快照,检测消失的持仓 - 将检测到的手动平仓操作记录到决策日志 - 使用标记价格(MarkPrice)作为平仓价格估算 Author: sue
🤖 Advisory Check ResultsThese are advisory checks to help improve code quality. They won't block your PR from being merged. 📋 PR InformationTitle Format: ✅ Good - Follows Conventional Commits 🔧 Backend ChecksGo Formatting: Files needing formattingGo Vet: ✅ Good Fix locally: go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests⚛️ Frontend ChecksBuild & Type Check: ✅ Success Fix locally: cd web
npm run build # Test build (includes type checking)📖 ResourcesQuestions? Feel free to ask in the comments! 🙏 These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml. |
|
这个平台用户多,性能会受影响不? |
代码审查报告 - PR #521📋 基本信息
|
| 维度 | 评分 | 说明 |
|---|---|---|
| 业务价值 | ⭐⭐⭐⭐⭐ | 重要功能,提升数据完整性 |
| 实现思路 | ⭐⭐⭐⭐ | 快照对比方案简洁有效 |
| 代码质量 | ⭐⭐⭐⭐ | 清晰规范 |
| 边界处理 | ⭐⭐⭐ | 缺少部分平仓和强平区分 |
| 测试覆盖 | ⭐⭐ | 缺少单元测试 |
🔧 必须修复(BLOCKING)
-
解决合并冲突 - rebase到最新dev分支
-
修复AI平仓误判问题 - 在executeTrades()后同步更新currentCyclePositions
// executeTrades()中,成功平仓后 if success && (action == "close_long" || action == "close_short") { posKey := fmt.Sprintf("%s_%s", symbol, side) delete(at.currentCyclePositions, posKey) }
💡 强烈建议
-
区分强平和手动平仓
- 检查MarkPrice是否接近LiquidationPrice
- 使用不同的Error消息标记
-
支持部分平仓检测
- 对比数量变化
- 记录减少的数量
-
添加单元测试
- 测试完全平仓、部分平仓、强平等场景
📌 可选优化
- 添加配置开关
- 在统计API中显示手动平仓统计
- 考虑从交易所API获取实际成交记录(更准确)
🎯 下一步
- ✅ 先rebase解决冲突
⚠️ 修复AI平仓误判问题(BLOCKING)- 💡 考虑添加强平区分和部分平仓支持
- 🧪 添加单元测试
- 📝 更新后re-request review
总评: 这是一个有价值的功能,实现思路清晰,但存在AI平仓误判的严重bug。修复后可以合并。
审查时间: 2025-11-08
审查者: Claude AI Code Reviewer
Author: sue
Pull Request | PR 提交
📝 Description | 描述
实现了手动平仓历史记录检测功能,通过对比每个交易周期的持仓快照,自动检测并记录手动平仓操作
。
🎯 Type of Change | 变更类型
🔗 Related Issues | 相关 Issue
📋 Changes Made | 具体变更
English:
中文:
🧪 Testing | 测试
Manual Testing | 手动测试
Test Environment | 测试环境
Test Results | 测试结果
📸 Screenshots / Demo | 截图/演示
Before | 变更前:
After | 变更后:
✅ Checklist | 检查清单
Code Quality | 代码质量
go build/npm run build)go fmt(for Go code) | 我已运行go fmt(Go 代码)npm run lint(for frontend code) | 我已运行npm run lint(前端代码)Testing | 测试
Documentation | 文档
Git
feat:,fix:, etc.)devbranch | 我已将分支 rebase 到最新的dev分支🔒 Security Considerations | 安全考虑
⚡ Performance Impact | 性能影响
English:
中文:
🌐 Internationalization | 国际化
📚 Additional Notes | 补充说明
English:
中文:
💰 For Bounty Claims | 赏金申请
Payment Details | 付款详情:
🙏 Reviewer Notes | 审查者注意事项
English:
中文:
📋 PR Size Estimate | PR 大小估计
🎯 Review Focus Areas | 审查重点
Please pay special attention to:
请特别注意:
By submitting this PR, I confirm that:
提交此 PR,我确认: