总资产修正+购车图标联动
Fix1: 总资产错误 — HK市价被当人民币算
portfolio.json已有正确 total_assets(含港币→人民币换算),
改为直接读取该字段,不再手动累加持仓市值
原代码用 h.get('currency')=='HKD' 判断但strategy_lifecycle
格式不保存currency字段 → 所有HK持仓被当CNY计算 → 总资产多出6.8万
Fix2: 换仓推荐时显示🛒非⚠️
原来用 lots==0 判断→永远⚠️,换仓推荐可让操作变为可行
改为 lots>0 OR swap_text 时用 🛒(可操作)
This commit is contained in:
+71
-71
@@ -367,17 +367,17 @@
|
||||
{
|
||||
"code": "002594",
|
||||
"name": "比亚迪",
|
||||
"price": 83.0,
|
||||
"price": 83.24,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标92.61 | 止损80.51 | 买入区81.34~84.66 | 信号:观望",
|
||||
"stop_loss": 80.51,
|
||||
"entry_low": 81.34,
|
||||
"entry_high": 84.66,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.29 弱压:85.0 强压:92.61",
|
||||
"action": "盈利持有 | 目标92.69 | 止损80.74 | 买入区81.58~84.9 | 信号:观望",
|
||||
"stop_loss": 80.74,
|
||||
"entry_low": 81.58,
|
||||
"entry_high": 84.9,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.45 弱压:85.0 强压:92.69",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 3.86,
|
||||
"rr_ratio": 3.78,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 12:00",
|
||||
@@ -389,7 +389,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-18 17:15",
|
||||
"take_profit": 92.61,
|
||||
"take_profit": 92.69,
|
||||
"updated_reason": "技术面重评: 止损80.51→74.97 | 形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.29 弱压:85.0 强压:92.6",
|
||||
"changelog": [
|
||||
{
|
||||
@@ -503,7 +503,7 @@
|
||||
{
|
||||
"id": "002594_stop_loss",
|
||||
"condition": {
|
||||
"price": "<80.51"
|
||||
"price": "<80.74"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -520,13 +520,13 @@
|
||||
"id": "002594_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=84.66",
|
||||
"price_lower": ">=81.34"
|
||||
"price": "<=84.9",
|
||||
"price_lower": ">=81.58"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 81.34,
|
||||
"limit": 81.58,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -539,7 +539,7 @@
|
||||
"id": "002594_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=92.61"
|
||||
"price": ">=92.69"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -573,7 +573,7 @@
|
||||
{
|
||||
"id": "002594_take_profit",
|
||||
"condition": {
|
||||
"price": ">=92.61"
|
||||
"price": ">=92.69"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -595,9 +595,9 @@
|
||||
},
|
||||
"priority": 99,
|
||||
"rationale": "没有分支匹配时的默认动作",
|
||||
"trigger_count": 1,
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": "2026-06-24"
|
||||
"last_triggered": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1084,13 +1084,13 @@
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标15.51 | 止损12.7 | 买入区12.91~13.43 | 信号:弱势持有",
|
||||
"action": "盈利持有 | 目标15.48 | 止损12.7 | 买入区12.91~13.43 | 信号:弱势持有",
|
||||
"stop_loss": 12.7,
|
||||
"entry_low": 12.91,
|
||||
"entry_high": 13.43,
|
||||
"tech_snapshot": "形态:锤子线/T字线/bullish 量价:数据不足 强撑:10.45 弱撑:12.7 弱压:13.41 强压:15.51",
|
||||
"tech_snapshot": "形态:锤子线/T字线/bullish 量价:数据不足 强撑:10.42 弱撑:12.7 弱压:13.36 强压:15.48",
|
||||
"timing_signal": "弱势持有",
|
||||
"rr_ratio": 4.98,
|
||||
"rr_ratio": 4.91,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 12:00",
|
||||
@@ -1102,7 +1102,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-18 17:15",
|
||||
"take_profit": 15.51,
|
||||
"take_profit": 15.48,
|
||||
"updated_reason": "技术信号变化: 弱势持有: 止损12.27→11.83 | 形态:锤子线/T字线/bullish 量价:数据不足 强撑:10.44 弱撑:12.7 弱压:13.39 强压:15.5",
|
||||
"changelog": [
|
||||
{
|
||||
@@ -1280,7 +1280,7 @@
|
||||
"id": "01070_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=15.51"
|
||||
"price": ">=15.48"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -1314,7 +1314,7 @@
|
||||
{
|
||||
"id": "01070_take_profit",
|
||||
"condition": {
|
||||
"price": ">=15.51"
|
||||
"price": ">=15.48"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -3707,17 +3707,17 @@
|
||||
{
|
||||
"code": "300124",
|
||||
"name": "汇川技术",
|
||||
"price": 66.49,
|
||||
"price": 66.38,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标73.19 | 止损64.5 | 买入区65.16~67.82 | 信号:观望",
|
||||
"stop_loss": 64.5,
|
||||
"entry_low": 65.16,
|
||||
"entry_high": 67.82,
|
||||
"tech_snapshot": "形态:长影星线/neutral 量价:主动卖盘占优 强撑:59.95 弱撑:65.66 弱压:67.41 强压:73.19",
|
||||
"action": "盈利持有 | 目标73.16 | 止损64.39 | 买入区65.05~67.71 | 信号:观望",
|
||||
"stop_loss": 64.39,
|
||||
"entry_low": 65.05,
|
||||
"entry_high": 67.71,
|
||||
"tech_snapshot": "形态:倒T线/射击之星/bearish 量价:主动卖盘占优 强撑:59.92 弱撑:65.58 弱压:67.33 强压:73.16",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 3.37,
|
||||
"rr_ratio": 3.41,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 12:00",
|
||||
@@ -3729,7 +3729,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-18 17:15",
|
||||
"take_profit": 73.19,
|
||||
"take_profit": 73.16,
|
||||
"updated_reason": "技术面重评: 止损64.5→60.06 | 形态:长影星线/neutral 量价:主动卖盘占优 强撑:59.95 弱撑:65.66 弱压:67.41 强压:73.1",
|
||||
"changelog": [
|
||||
{
|
||||
@@ -3843,7 +3843,7 @@
|
||||
{
|
||||
"id": "300124_stop_loss",
|
||||
"condition": {
|
||||
"price": "<64.5"
|
||||
"price": "<64.39"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -3860,13 +3860,13 @@
|
||||
"id": "300124_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=67.82",
|
||||
"price_lower": ">=65.16"
|
||||
"price": "<=67.71",
|
||||
"price_lower": ">=65.05"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 65.16,
|
||||
"limit": 65.05,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -3879,7 +3879,7 @@
|
||||
"id": "300124_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=73.19"
|
||||
"price": ">=73.16"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -3913,7 +3913,7 @@
|
||||
{
|
||||
"id": "300124_take_profit",
|
||||
"condition": {
|
||||
"price": ">=73.19"
|
||||
"price": ">=73.16"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -3935,9 +3935,9 @@
|
||||
},
|
||||
"priority": 99,
|
||||
"rationale": "没有分支匹配时的默认动作",
|
||||
"trigger_count": 1,
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": "2026-06-24"
|
||||
"last_triggered": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4989,17 +4989,17 @@
|
||||
{
|
||||
"code": "601318",
|
||||
"name": "中国平安",
|
||||
"price": 49.36,
|
||||
"price": 49.33,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标53.71 | 止损47.88 | 买入区48.37~50.21 | 信号:观望",
|
||||
"stop_loss": 47.88,
|
||||
"entry_low": 48.37,
|
||||
"entry_high": 50.21,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.81 弱撑:48.63 弱压:50.48 强压:53.71",
|
||||
"action": "盈利持有 | 目标53.69 | 止损47.85 | 买入区48.34~50.19 | 信号:观望",
|
||||
"stop_loss": 47.85,
|
||||
"entry_low": 48.34,
|
||||
"entry_high": 50.19,
|
||||
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.8 弱撑:48.61 弱压:50.46 强压:53.69",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 2.94,
|
||||
"rr_ratio": 2.95,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 12:00",
|
||||
@@ -5011,7 +5011,7 @@
|
||||
"position_advice": "减仓或观望",
|
||||
"time_horizon": "观望",
|
||||
"created_at": "2026-06-22 11:50",
|
||||
"take_profit": 53.71,
|
||||
"take_profit": 53.69,
|
||||
"updated_reason": "技术面重评: 策略文字调整",
|
||||
"changelog": [
|
||||
{
|
||||
@@ -5062,7 +5062,7 @@
|
||||
{
|
||||
"id": "601318_stop_loss",
|
||||
"condition": {
|
||||
"price": "<47.88"
|
||||
"price": "<47.85"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -5079,13 +5079,13 @@
|
||||
"id": "601318_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=50.21",
|
||||
"price_lower": ">=48.37"
|
||||
"price": "<=50.19",
|
||||
"price_lower": ">=48.34"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 48.37,
|
||||
"limit": 48.34,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -5098,7 +5098,7 @@
|
||||
"id": "601318_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=53.71"
|
||||
"price": ">=53.69"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -5132,7 +5132,7 @@
|
||||
{
|
||||
"id": "601318_take_profit",
|
||||
"condition": {
|
||||
"price": ">=53.71"
|
||||
"price": ">=53.69"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -5154,9 +5154,9 @@
|
||||
},
|
||||
"priority": 99,
|
||||
"rationale": "没有分支匹配时的默认动作",
|
||||
"trigger_count": 1,
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": "2026-06-24"
|
||||
"last_triggered": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5741,17 +5741,17 @@
|
||||
{
|
||||
"code": "688795",
|
||||
"name": "摩尔线程-U",
|
||||
"price": 686.0,
|
||||
"price": 696.0,
|
||||
"cost": 0,
|
||||
"shares": 0,
|
||||
"avg_price": 0,
|
||||
"action": "盈利持有 | 目标819.32 | 止损665.42 | 买入区672.28~699.72 | 信号:观望",
|
||||
"stop_loss": 665.42,
|
||||
"entry_low": 672.28,
|
||||
"entry_high": 699.72,
|
||||
"tech_snapshot": "形态:锤子线/T字线/bullish 量价:主动卖盘占优 强撑:563.22 弱撑:670.33 弱压:704.03 强压:819.32",
|
||||
"action": "盈利持有 | 目标822.65 | 止损675.12 | 买入区682.08~709.92 | 信号:观望",
|
||||
"stop_loss": 675.12,
|
||||
"entry_low": 682.08,
|
||||
"entry_high": 709.92,
|
||||
"tech_snapshot": "形态:锤子线/T字线/neutral 量价:主动卖盘占优 强撑:563.22 弱撑:677.0 弱压:707.0 强压:822.65",
|
||||
"timing_signal": "观望",
|
||||
"rr_ratio": 6.48,
|
||||
"rr_ratio": 6.07,
|
||||
"status": "updated",
|
||||
"note": "",
|
||||
"timestamp": "2026-06-24 12:01",
|
||||
@@ -5763,7 +5763,7 @@
|
||||
"position_advice": "正常配置",
|
||||
"time_horizon": "数月~1年",
|
||||
"created_at": "2026-06-18 17:15",
|
||||
"take_profit": 819.32,
|
||||
"take_profit": 822.65,
|
||||
"updated_reason": "技术面重评: 止损665.42→658.37 | 形态:锤子线/T字线/bullish 量价:主动卖盘占优 强撑:563.22 弱撑:670.33 弱压:704.03 强",
|
||||
"changelog": [
|
||||
{
|
||||
@@ -5877,7 +5877,7 @@
|
||||
{
|
||||
"id": "688795_stop_loss",
|
||||
"condition": {
|
||||
"price": "<665.42"
|
||||
"price": "<675.12"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -5894,13 +5894,13 @@
|
||||
"id": "688795_buy_dip",
|
||||
"condition": {
|
||||
"scenario": "weak_consolidation",
|
||||
"price": "<=699.72",
|
||||
"price_lower": ">=672.28"
|
||||
"price": "<=709.92",
|
||||
"price_lower": ">=682.08"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
"amount": "normal",
|
||||
"limit": 672.28,
|
||||
"limit": 682.08,
|
||||
"reason": "回调支撑买入"
|
||||
},
|
||||
"priority": 1,
|
||||
@@ -5913,7 +5913,7 @@
|
||||
"id": "688795_breakout_chase",
|
||||
"condition": {
|
||||
"scenario": "bullish_recovery",
|
||||
"price": ">=819.32"
|
||||
"price": ">=822.65"
|
||||
},
|
||||
"action": {
|
||||
"type": "buy",
|
||||
@@ -5947,7 +5947,7 @@
|
||||
{
|
||||
"id": "688795_take_profit",
|
||||
"condition": {
|
||||
"price": ">=819.32"
|
||||
"price": ">=822.65"
|
||||
},
|
||||
"action": {
|
||||
"type": "sell",
|
||||
@@ -5969,9 +5969,9 @@
|
||||
},
|
||||
"priority": 99,
|
||||
"rationale": "没有分支匹配时的默认动作",
|
||||
"trigger_count": 1,
|
||||
"trigger_count": 0,
|
||||
"success_rate": null,
|
||||
"last_triggered": "2026-06-24"
|
||||
"last_triggered": null
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6264,5 +6264,5 @@
|
||||
}
|
||||
],
|
||||
"total": 43,
|
||||
"regenerated_at": "2026-06-24 12:20"
|
||||
"regenerated_at": "2026-06-24 13:02"
|
||||
}
|
||||
+23
-13
@@ -26,7 +26,8 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:0.9),不建议加仓",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 794.1
|
||||
"price": 794.5,
|
||||
"change_pct": 5.23
|
||||
},
|
||||
{
|
||||
"code": "01478",
|
||||
@@ -83,7 +84,7 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:1.3),不建议加仓",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 10.48
|
||||
"price": 10.45
|
||||
},
|
||||
{
|
||||
"code": "601899",
|
||||
@@ -111,7 +112,8 @@
|
||||
"action_note": "深套持有",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 27.5
|
||||
"price": 27.68,
|
||||
"change_pct": -0.25
|
||||
},
|
||||
{
|
||||
"code": "688639",
|
||||
@@ -139,7 +141,7 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:1.1),不建议加仓",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 21.44
|
||||
"price": 21.43
|
||||
},
|
||||
{
|
||||
"code": "09988",
|
||||
@@ -196,7 +198,8 @@
|
||||
"action_note": "",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 116.94
|
||||
"price": 115.9,
|
||||
"change_pct": 9.02
|
||||
},
|
||||
{
|
||||
"code": "688981",
|
||||
@@ -224,7 +227,8 @@
|
||||
"action_note": "",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 154.23
|
||||
"price": 153.36,
|
||||
"change_pct": 8.23
|
||||
},
|
||||
{
|
||||
"code": "01888",
|
||||
@@ -339,7 +343,8 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:0.8),不建议加仓",
|
||||
"timing_signal": "弱势持有"
|
||||
},
|
||||
"price": 394.78
|
||||
"price": 395.84,
|
||||
"change_pct": 0.85
|
||||
},
|
||||
{
|
||||
"code": "01211",
|
||||
@@ -483,7 +488,8 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:1.1),不建议加仓",
|
||||
"timing_signal": "弱势持有"
|
||||
},
|
||||
"price": 37.04
|
||||
"price": 37.01,
|
||||
"change_pct": -1.04
|
||||
},
|
||||
{
|
||||
"code": "300548",
|
||||
@@ -511,7 +517,8 @@
|
||||
"action_note": "短炒强趋势持",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 278.12
|
||||
"price": 278.58,
|
||||
"change_pct": -2.6
|
||||
},
|
||||
{
|
||||
"code": "02318",
|
||||
@@ -568,7 +575,7 @@
|
||||
"action_note": "深套持有",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 16.13
|
||||
"price": 16.15
|
||||
},
|
||||
{
|
||||
"code": "000700",
|
||||
@@ -596,7 +603,8 @@
|
||||
"action_note": "",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 14.64
|
||||
"price": 14.54,
|
||||
"change_pct": -2.94
|
||||
},
|
||||
{
|
||||
"code": "518880",
|
||||
@@ -624,7 +632,8 @@
|
||||
"action_note": "深套持有",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 8.44
|
||||
"price": 8.45,
|
||||
"change_pct": -0.98
|
||||
},
|
||||
{
|
||||
"code": "01088",
|
||||
@@ -709,7 +718,8 @@
|
||||
"action_note": "⚠️盈亏比偏低(1:1.2),不建议加仓",
|
||||
"timing_signal": "持有"
|
||||
},
|
||||
"price": 22.87
|
||||
"price": 22.9,
|
||||
"change_pct": -3.09
|
||||
}
|
||||
],
|
||||
"cash": 20230.1,
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
"date": "2026-06-24",
|
||||
"high": 88.32,
|
||||
"low": 82.78,
|
||||
"close": 83.0
|
||||
"close": 83.24
|
||||
}
|
||||
],
|
||||
"00700": [
|
||||
@@ -444,7 +444,7 @@
|
||||
"date": "2026-06-24",
|
||||
"high": 13.47,
|
||||
"low": 12.55,
|
||||
"close": 13.19
|
||||
"close": 13.11
|
||||
}
|
||||
],
|
||||
"01088": [
|
||||
@@ -1284,7 +1284,7 @@
|
||||
"date": "2026-06-24",
|
||||
"high": 68.8,
|
||||
"low": 65.74,
|
||||
"close": 66.49
|
||||
"close": 66.38
|
||||
}
|
||||
],
|
||||
"300548": [
|
||||
@@ -2316,7 +2316,7 @@
|
||||
"date": "2026-06-24",
|
||||
"high": 745.2,
|
||||
"low": 660.01,
|
||||
"close": 686.0
|
||||
"close": 696.0
|
||||
}
|
||||
],
|
||||
"688802": [
|
||||
@@ -2610,7 +2610,7 @@
|
||||
"date": "2026-06-24",
|
||||
"high": 52.43,
|
||||
"low": 49.03,
|
||||
"close": 49.36
|
||||
"close": 49.33
|
||||
}
|
||||
],
|
||||
"002171": [
|
||||
|
||||
@@ -39,6 +39,8 @@ SUSPICIOUS_NUMBERS = [
|
||||
(r'0\.8[5-9]\d{1,3}', '可能的硬编码汇率值'),
|
||||
(r'0\.9[0-5]\d{1,3}', '可能的硬编码汇率值'),
|
||||
(r'1手\s*[:=]\s*\d{3,}', '可能的每手股数硬编码'),
|
||||
(r'[><=]\s*0\.[0-9]+', '可能的百分比阈值硬编码'),
|
||||
(r'仓位\s*[:=]\s*\d{3,}', '可能的仓位金额硬编码'),
|
||||
# 扩展点 — meta_growth 在此追加新规则
|
||||
]
|
||||
|
||||
|
||||
@@ -318,12 +318,16 @@ def main():
|
||||
with open("/home/hmo/web-dashboard/data/portfolio.json") as f:
|
||||
pf = json.load(f)
|
||||
available_cash = pf.get("cash", 0) or 0
|
||||
for h in pf.get("holdings", []):
|
||||
mv = h.get("shares", 0) * h.get("price", 0)
|
||||
if h.get("currency") == "HKD":
|
||||
mv *= h.get("exchange_rate", 0.866)
|
||||
total_assets += mv
|
||||
total_assets += available_cash
|
||||
# 直接取 portfolio.json 的总资产(导入时已做港币→人民币换算)
|
||||
total_assets = pf.get("total_assets", 0) or 0
|
||||
if total_assets <= 0:
|
||||
# fallback: 手动算
|
||||
for h in pf.get("holdings", []):
|
||||
mv = h.get("shares", 0) * h.get("price", 0)
|
||||
if len(str(h.get("code", ""))) <= 5: # 港股
|
||||
mv *= 0.866
|
||||
total_assets += mv
|
||||
total_assets += available_cash
|
||||
except Exception:
|
||||
total_assets = available_cash * 5 # fallback
|
||||
|
||||
@@ -610,8 +614,6 @@ def main():
|
||||
if cooled:
|
||||
continue
|
||||
|
||||
action_tag = "⚠️" if lots == 0 else "🛒"
|
||||
|
||||
# 换仓评估:现金不足时评估是否卖差票换推荐股
|
||||
swap_text = None
|
||||
if lots == 0:
|
||||
@@ -620,6 +622,8 @@ def main():
|
||||
total_assets, available_cash, pf, code_data
|
||||
)
|
||||
|
||||
action_tag = "🛒" if (lots > 0 or swap_text) else "⚠️"
|
||||
|
||||
lines.append(
|
||||
f" {action_tag} {name}({code}) {pfx}{price:.2f} 买区{buy_low}~{buy_high} | "
|
||||
f"1手{lot:,.0f}元 RR={rr:.1f} 损{sl} 盈{tp}\n"
|
||||
|
||||
Reference in New Issue
Block a user