Files
sanguo_vnpy_v2/tests/portfolio
claude_dev 5a91be2efd
CI/CD / test (push) Failing after 7s
CI/CD / nas-deploy (push) Has been skipped
CI/CD / nas-verify (push) Has been skipped
fix(strategy): A1 卖出只卖自己——共享QMT账户互卖根治,持仓读取优先实例账本视图(spec §A1)
2026-08-19 盘后实锤:8路实盘共享miniQMT账户66639661,context.portfolio是
全账户视图→'卖掉所有不在目标里的持仓'卖掉别家持仓(518880/600036双实例
各卖当日真实发生)。spec: docs/design/multi-strategy-instance-budget-spec.md

- _get_positions(context, broker=None)(all_weather共享helper+all_weather_ex
  同构副本):broker.get_instance_positions存在(runner_live注入台账,dae56e2)
  →只返回本实例持仓(_InstancePosition:数量/成本取台账,price/value从共享
  视图同名标的补=市场数据非所有权);否则回测/影子原context.portfolio不变,
  模拟盘零改动;通道返非dict→TypeError fail-fast(回退=互卖,宁可崩)
- 视图空dict→轮换退化'只买不卖'(spec:正确行为不是bug)
- 逐个卖出腿过一遍(spec清单):channel_test rotate/partial_adjust/swap_one/
  t1_probe、momentum/_ex熊市清仓+调仓+买入去重、small_cap/_ex _rebalance、
  value_selection/_ex月度卖出、all_weather/_ex prepare/stop_loss/monthly
- 附带修:channel_test加仓腿市值未知时跳过,绝不order_target_value(code,0)
  把加仓变清仓
- 测试:test_instance_view_isolation.py 14条(helper5+channel_test5+momentum
  熊市2+small_cap1+all_weather止损1),含'实例视图空→零卖出'×3策略;
  strategy 126全绿;A2属性清单已发issue#29给前后端(B2虚拟化输入)
- 注:工作树另有前后端session未提交WIP(routes_live.py B3预算),不混入本commit

[vps]
2026-08-19 22:22:42 +08:00
..