自成长体系补齐:分支扫描+每日剪枝+决策树全覆盖+分支输出
核心改动: 1. 创建 branch_scanner.py — 每15分钟扫价格→评估分支适用性→记录trigger_count cron: 分支自成长-盘中 (15,30,45,00 9-15) 2. 创建 prune_branches.py — 每日21:00剪枝(触发>=5次且成功率<50% → 淘汰) cron: 分支剪枝-每日 (0 21 * * 1-5) — 之前是每周,频率太低 3. strategy_tree.py: _check_branch_condition 新增 price_lower 支持 buy_dip 分支同时检查上下界(price<=entry_high AND price_lower>=entry_low) 4. 43只股票全部补全决策树(之前只有6只) init_default_branches 生成每只6条分支:止损/回调买入/突破追涨/减仓/止盈/持有 5. stale_push_wlin 分支输出已存在(302-315行加载策略树,437-455行评估+追加) 下一期报告即显示:【弱势震荡→buy】价格回调到支撑区,弱势市场低吸 新增: 南亚新材(688519) 全面分析+策略+自选 买入区335~350 止损320 止盈400 RR=1.7 6月从285拉至409(+43%)后急跌至331(-19%),今日反弹缩量。高PE(228)炒作品种,等回调确认支撑
This commit is contained in:
@@ -181,6 +181,24 @@ def _check_branch_condition(branch, scenario_id, price, shares, cost):
|
||||
return False
|
||||
if op == "==" and not (abs(price - val) < 0.01):
|
||||
return False
|
||||
|
||||
# Price lower bound (separate field)
|
||||
price_lower = cond.get("price_lower", "")
|
||||
if price_lower:
|
||||
ops = re.findall(r'([<>=!]+)\s*([\d.]+)', price_lower)
|
||||
for op, val_str in ops:
|
||||
val = float(val_str)
|
||||
op = op.strip()
|
||||
if op == "<" and not (price < val):
|
||||
return False
|
||||
if op == ">" and not (price > val):
|
||||
return False
|
||||
if op == "<=" and not (price <= val):
|
||||
return False
|
||||
if op == ">=" and not (price >= val):
|
||||
return False
|
||||
if op == "==" and not (abs(price - val) < 0.01):
|
||||
return False
|
||||
|
||||
# Trend condition
|
||||
trend = cond.get("trend", "")
|
||||
|
||||
Reference in New Issue
Block a user