信义光能问题修复:两层级过滤+趋势检查
Bug 1 — strategy_lifecycle.py: enrich_timing_signal 用 factors[-1] 当信号
信义光能: base_signal=neutral, factors=[大盘中性,行业偏弱,高估值]
旧逻辑: factors[-1]='行业偏弱'→成为timing_signal→无效信号
新逻辑: 先找有效操作方向(买入/加仓/观望/持有/关注/信号不充分),
找不到→信号不充分。不再从上下文因子里拼凑信号。
Bug 2 — stale_push_wlin.py: 信号过滤太松
旧逻辑: 只跳过特定关键词(等企稳/关注/信号不充分/持有)
新逻辑: 信号必须含"买入"或"加仓"才进推荐,其他一律跳过
Check 3 — 趋势检查(新增)
fetch_trend_data(): 取实时行情+30日K线计算MA排列
空头排列/弱势震荡→不推荐
药明康德通过(多头排列+买入信号) 信义光能不通过(空头+行业偏弱)
This commit is contained in:
+171
-68
@@ -85,17 +85,17 @@
|
||||
{
|
||||
"code": "000711",
|
||||
"name": "ST京蓝",
|
||||
"price": 5.05,
|
||||
"price": 5.06,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | ⚠️盈亏比偏低(1:1.7),谨慎买入 | 目标5.38 | 止损4.86 | 买入区4.95~5.07 | 信号:观望",
|
||||
"action": "盈利持有 | ⚠️盈亏比偏低(1:1.6),谨慎买入 | 目标5.38 | 止损4.86 | 买入区4.96~5.07 | 信号:观望",
|
||||
"stop_loss": 4.86,
|
||||
"entry_low": 4.95,
|
||||
"entry_low": 4.96,
|
||||
"entry_high": 5.07,
|
||||
"tech_snapshot": "形态:长影星线/neutral 量价:主动卖盘占优 强撑:4.86 弱撑:4.86 弱压:5.25 强压:5.38",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 1.74,
|
||||
"rr_ratio": 1.6,
|
||||
"status": "updated",
|
||||
"note": "⚠️盈亏比偏低(1:1.6),谨慎买入",
|
||||
"timestamp": "2026-06-24 14:23",
|
||||
@@ -140,12 +140,12 @@
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=5.07",
|
||||
"price_lower": ">=4.95"
|
||||
"price_lower": ">=4.96"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 4.95,
|
||||
"limit": 4.96,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -352,17 +352,17 @@
|
||||
{
|
||||
"code": "002594",
|
||||
"name": "比亚迪",
|
||||
"price": 83.45,
|
||||
"price": 83.44,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标92.76 | 止损80.95 | 买入区81.78~85.12 | 信号:观望",
|
||||
"stop_loss": 80.95,
|
||||
"entry_low": 81.78,
|
||||
"entry_high": 85.12,
|
||||
"tech_snapshot": "形态:带下影阴线/neutral 量价:主动卖盘占优 强撑:76.5 弱撑:82.59 弱压:85.0 强压:92.76",
|
||||
"action": "盈利持有 | 目标92.76 | 止损80.94 | 买入区81.77~85.11 | 信号:观望",
|
||||
"stop_loss": 80.94,
|
||||
"entry_low": 81.77,
|
||||
"entry_high": 85.11,
|
||||
"tech_snapshot": "形态:带下影阴线/neutral 量价:主动卖盘占优 强撑:76.5 弱撑:82.58 弱压:85.0 强压:92.76",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 3.72,
|
||||
"rr_ratio": 3.73,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 14:23",
|
||||
@@ -389,7 +389,7 @@
|
||||
{
|
||||
"id": "002594_stop_loss",
|
||||
"condition": {
|
||||
"price": "<80.95"
|
||||
"price": "<80.94"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -406,13 +406,13 @@
|
||||
"id": "002594_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=85.12",
|
||||
"price_lower": ">=81.78"
|
||||
"price": "<=85.11",
|
||||
"price_lower": ">=81.77"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 81.78,
|
||||
"limit": 81.77,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -2391,13 +2391,13 @@
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标180.8 | 止损155.91 | 买入区162.39~168.76",
|
||||
"stop_loss": 155.91,
|
||||
"action": "盈利持有 | 目标180.97 | 止损160.73 | 买入区162.39~168.83",
|
||||
"stop_loss": 160.73,
|
||||
"entry_low": 162.39,
|
||||
"entry_high": 168.76,
|
||||
"tech_snapshot": "形态:倒T线/射击之星/bearish 量价:数据不足 强撑:151.2 弱撑:160.9 弱压:168.2 强压:180.8",
|
||||
"timing_signal": "行业偏强",
|
||||
"rr_ratio": 3.04,
|
||||
"entry_high": 168.83,
|
||||
"tech_snapshot": "形态:带上影阳线/neutral 量价:数据不足 强撑:151.29 弱撑:160.9 弱压:168.47 强压:180.97",
|
||||
"timing_signal": "信号不充分",
|
||||
"rr_ratio": 3.07,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 14:24",
|
||||
@@ -2409,7 +2409,7 @@
|
||||
"position_advice": "正常配置",
|
||||
"time_horizon": "数月~1年",
|
||||
"created_at": "2026-06-24 14:24",
|
||||
"take_profit": 180.8,
|
||||
"take_profit": 180.97,
|
||||
"changelog": [
|
||||
{
|
||||
"date": "2026-06-24 14:24",
|
||||
@@ -2418,7 +2418,110 @@
|
||||
"reason": "初始策略创建 | 形态:倒T线/射击之星/bearish 量价:数据不足 强撑:151.2 弱撑:160.9 弱压:168.2 强压:18",
|
||||
"trigger": "初始创建"
|
||||
}
|
||||
]
|
||||
],
|
||||
"strategy_tree": {
|
||||
"branches": [
|
||||
{
|
||||
"id": "06160_stop_loss",
|
||||
"condition": {
|
||||
"price": "<160.73"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
"amount": "all",
|
||||
"reason": "止损"
|
||||
},
|
||||
"priority": 0,
|
||||
"rationale": "止损保护本金",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
},
|
||||
{
|
||||
"id": "06160_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=168.83",
|
||||
"price_lower": ">=162.39"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 162.39,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
"rationale": "价格回调到支撑区,弱势市场低吸",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
},
|
||||
{
|
||||
"id": "06160_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=180.97"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": "market",
|
||||
"reason": "突破确认追涨"
|
||||
},
|
||||
"priority": 2,
|
||||
"rationale": "价格突破阻力,确认上升趋势后买入",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
},
|
||||
{
|
||||
"id": "06160_trim",
|
||||
"condition": {
|
||||
"scenario": "sharp_decline",
|
||||
"loss_pct": "<-15%"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
"amount": "half",
|
||||
"reason": "急跌降风险"
|
||||
},
|
||||
"priority": 3,
|
||||
"rationale": "急跌市场,深套股减半仓减少敞口",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
},
|
||||
{
|
||||
"id": "06160_take_profit",
|
||||
"condition": {
|
||||
"price": ">=180.97"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
"amount": "half",
|
||||
"reason": "止盈锁利"
|
||||
},
|
||||
"priority": 4,
|
||||
"rationale": "达到目标价,减半仓锁定利润",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
},
|
||||
{
|
||||
"id": "06160_hold",
|
||||
"condition": {},
|
||||
"action": {
|
||||
"type": "hold",
|
||||
"reason": "无明确信号,继续持有"
|
||||
},
|
||||
"priority": 99,
|
||||
"rationale": "没有分支匹配时的默认动作",
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "06869",
|
||||
@@ -3191,17 +3294,17 @@
|
||||
{
|
||||
"code": "300124",
|
||||
"name": "汇川技术",
|
||||
"price": 66.41,
|
||||
"price": 66.53,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标73.17 | 止损64.42 | 买入区65.08~67.74 | 信号:观望",
|
||||
"stop_loss": 64.42,
|
||||
"entry_low": 65.08,
|
||||
"entry_high": 67.74,
|
||||
"tech_snapshot": "形态:倒T线/射击之星/bearish 量价:主动卖盘占优 强撑:59.93 弱撑:65.6 弱压:67.35 强压:73.17",
|
||||
"action": "盈利持有 | 目标73.2 | 止损64.53 | 买入区65.2~67.86 | 信号:观望",
|
||||
"stop_loss": 64.53,
|
||||
"entry_low": 65.2,
|
||||
"entry_high": 67.86,
|
||||
"tech_snapshot": "形态:长影星线/neutral 量价:主动卖盘占优 强撑:59.96 弱撑:65.68 弱压:67.43 强压:73.2",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 3.4,
|
||||
"rr_ratio": 3.34,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 14:24",
|
||||
@@ -3213,7 +3316,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-24 14:24",
|
||||
"take_profit": 73.17,
|
||||
"take_profit": 73.2,
|
||||
"changelog": [
|
||||
{
|
||||
"date": "2026-06-24 14:24",
|
||||
@@ -3228,7 +3331,7 @@
|
||||
{
|
||||
"id": "300124_stop_loss",
|
||||
"condition": {
|
||||
"price": "<64.42"
|
||||
"price": "<64.53"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -3245,13 +3348,13 @@
|
||||
"id": "300124_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=67.74",
|
||||
"price_lower": ">=65.08"
|
||||
"price": "<=67.86",
|
||||
"price_lower": ">=65.2"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 65.08,
|
||||
"limit": 65.2,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -3264,7 +3367,7 @@
|
||||
"id": "300124_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=73.17"
|
||||
"price": ">=73.2"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -3298,7 +3401,7 @@
|
||||
{
|
||||
"id": "300124_take_profit",
|
||||
"condition": {
|
||||
"price": ">=73.17"
|
||||
"price": ">=73.2"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -3990,17 +4093,17 @@
|
||||
{
|
||||
"code": "601318",
|
||||
"name": "中国平安",
|
||||
"price": 49.1,
|
||||
"price": 49.12,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标53.6 | 止损47.63 | 买入区48.12~50.02 | 信号:观望",
|
||||
"stop_loss": 47.63,
|
||||
"entry_low": 48.12,
|
||||
"entry_high": 50.02,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.74 弱撑:48.46 弱压:50.4 强压:53.6",
|
||||
"action": "盈利持有 | 目标53.61 | 止损47.65 | 买入区48.14~50.03 | 信号:观望",
|
||||
"stop_loss": 47.65,
|
||||
"entry_low": 48.14,
|
||||
"entry_high": 50.03,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.75 弱撑:48.47 弱压:50.4 强压:53.61",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 3.06,
|
||||
"rr_ratio": 3.05,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 14:24",
|
||||
@@ -4012,7 +4115,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-24 14:24",
|
||||
"take_profit": 53.6,
|
||||
"take_profit": 53.61,
|
||||
"changelog": [
|
||||
{
|
||||
"date": "2026-06-24 14:24",
|
||||
@@ -4027,7 +4130,7 @@
|
||||
{
|
||||
"id": "601318_stop_loss",
|
||||
"condition": {
|
||||
"price": "<47.63"
|
||||
"price": "<47.65"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -4044,13 +4147,13 @@
|
||||
"id": "601318_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=50.02",
|
||||
"price_lower": ">=48.12"
|
||||
"price": "<=50.03",
|
||||
"price_lower": ">=48.14"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 48.12,
|
||||
"limit": 48.14,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -4063,7 +4166,7 @@
|
||||
"id": "601318_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=53.6"
|
||||
"price": ">=53.61"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -4097,7 +4200,7 @@
|
||||
{
|
||||
"id": "601318_take_profit",
|
||||
"condition": {
|
||||
"price": ">=53.6"
|
||||
"price": ">=53.61"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -4705,17 +4808,17 @@
|
||||
{
|
||||
"code": "688795",
|
||||
"name": "摩尔线程-U",
|
||||
"price": 705.0,
|
||||
"price": 704.0,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标831.84 | 止损676.81 | 买入区690.9~719.1 | 信号:观望",
|
||||
"stop_loss": 676.81,
|
||||
"entry_low": 690.9,
|
||||
"entry_high": 719.1,
|
||||
"tech_snapshot": "形态:带下影阳线/neutral 量价:主动卖盘占优 强撑:563.22 弱撑:676.81 弱压:725.39 强压:831.84",
|
||||
"action": "盈利持有 | 目标831.51 | 止损676.14 | 买入区689.92~718.08 | 信号:观望",
|
||||
"stop_loss": 676.14,
|
||||
"entry_low": 689.92,
|
||||
"entry_high": 718.08,
|
||||
"tech_snapshot": "形态:锤子线/T字线/neutral 量价:主动卖盘占优 强撑:563.22 弱撑:676.14 弱压:724.72 强压:831.51",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 4.5,
|
||||
"rr_ratio": 4.58,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 14:24",
|
||||
@@ -4727,7 +4830,7 @@
|
||||
"position_advice": "正常配置",
|
||||
"time_horizon": "数月~1年",
|
||||
"created_at": "2026-06-24 14:24",
|
||||
"take_profit": 831.84,
|
||||
"take_profit": 831.51,
|
||||
"changelog": [
|
||||
{
|
||||
"date": "2026-06-24 14:24",
|
||||
@@ -4742,7 +4845,7 @@
|
||||
{
|
||||
"id": "688795_stop_loss",
|
||||
"condition": {
|
||||
"price": "<676.81"
|
||||
"price": "<676.14"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -4759,13 +4862,13 @@
|
||||
"id": "688795_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=719.1",
|
||||
"price_lower": ">=690.9"
|
||||
"price": "<=718.08",
|
||||
"price_lower": ">=689.92"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 690.9,
|
||||
"limit": 689.92,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -4778,7 +4881,7 @@
|
||||
"id": "688795_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=831.84"
|
||||
"price": ">=831.51"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -4812,7 +4915,7 @@
|
||||
{
|
||||
"id": "688795_take_profit",
|
||||
"condition": {
|
||||
"price": ">=831.84"
|
||||
"price": ">=831.51"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -5028,5 +5131,5 @@
|
||||
}
|
||||
],
|
||||
"total": 39,
|
||||
"regenerated_at": "2026-06-24 14:25"
|
||||
"regenerated_at": "2026-06-24 14:37"
|
||||
}
|
||||
Reference in New Issue
Block a user