feat: 持仓同步优化 + Binance 平仓/减仓安全增强#23
Merged
brokermr810 merged 3 commits intobrokermr810:mainfrom Jan 28, 2026
Merged
Conversation
[FIX] Google搜索使用模糊匹配以避免无结果
## 核心功能 1. **持仓自动同步与插入** - 修复策略状态查询条件 (active -> running) - 移除阻塞空持仓同步的早期返回逻辑 - 自动检测交易所存在但本地不存在的持仓并插入数据库 - 修复 INSERT 语句列匹配 (移除 created_at,添加 user_id) 2. **Binance 平仓/减仓优化** - 订单执行前强制同步持仓 (Pre-execution Sync) - Close/Reduce 订单自动数量修正:防止超额平仓 - 当请求平仓数量 > 实际持仓时,自动调整为实际持有量 - 当数据库无持仓记录时,强制设置 amount=0 阻止错误订单 3. **日志增强** - 每10秒输出实际持仓详情 (symbol, size, entry_price) - 常规同步日志降级为 debug,保留关键操作为 info - 同步失败日志升级为 ERROR 并附带 traceback
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.
持仓同步优化 + Binance 平仓/减仓安全增强
核心功能
1. 持仓自动同步与插入
active→running)created_at,添加user_id)2. Binance 平仓/减仓安全增强
amount=0阻止错误订单3. 日志增强
代码变更
backend_api_python/app/services/pending_order_worker.py验证步骤