持仓导入完成:holding.xls→SQLite+portfolio.json全同步

1. 从 ~/stocks/holding.xls 导入25只持仓(14A/11H)
2. 同时写入 portfolio.json + SQLite holdings 表
3. stale_push_wlin 现金来源从 stale_report 改为 portfolio.json
4. portfolio.json 增加 total_assets 字段兼容 stale_detector
5. 导入脚本已规范化为 MoFin/scripts/import_holding_xls.py
   用法:python3 import_holding_xls.py [--cash 金额]
6. 全量策略重评+决策树重建立即执行

Dad下次更新holding.xls后跑:
  cd MoFin && python3 scripts/import_holding_xls.py
This commit is contained in:
知微
2026-06-24 11:21:51 +08:00
parent df4f898bc4
commit e2646c36cb
5 changed files with 414 additions and 158 deletions
+62 -62
View File
@@ -315,18 +315,18 @@
{
"code": "000711",
"name": "ST京蓝",
"price": 5.16,
"price": 5.0,
"cost": 0,
"shares": 0,
"avg_price": 0,
"action": "盈利持有 | ⚠️盈亏比不足1:1.5,不建议买入 | 目标5.38 | 止损4.4 | 买入区5.06~5.11 | 信号:观望",
"stop_loss": 4.4,
"entry_low": 5.06,
"entry_high": 5.11,
"tech_snapshot": "形态:带下影阳线/neutral 量价:主动卖盘占优 强撑:4.86 弱撑:4.93 弱压:5.32 强压:5.38",
"action": "盈利持有 | 目标5.38 | 止损4.82 | 买入区4.9~5.04 | 信号:观望",
"stop_loss": 4.82,
"entry_low": 4.9,
"entry_high": 5.04,
"tech_snapshot": "形态:倒T线/射击之星/bearish 量价:主动卖盘占优 强撑:4.86 弱撑:4.82 弱压:5.21 强压:5.38",
"timing_signal": "观望",
"rr_ratio": 0.96,
"status": "review",
"rr_ratio": 2.11,
"status": "updated",
"note": "⚠️盈亏比不足1:1.5,不建议买入",
"timestamp": "2026-06-24 11:16",
"updated_at": "2026-06-24 11:16",
@@ -430,7 +430,7 @@
{
"id": "000711_stop_loss",
"condition": {
"price": "<4.4"
"price": "<4.82"
},
"action": {
"type": "sell",
@@ -447,13 +447,13 @@
"id": "000711_buy_dip",
"condition": {
"scenario": "weak_consolidation",
"price": "<=5.11",
"price_lower": ">=5.06"
"price": "<=5.04",
"price_lower": ">=4.9"
},
"action": {
"type": "buy",
"amount": "normal",
"limit": 5.06,
"limit": 4.9,
"reason": "回调支撑买入"
},
"priority": 1,
@@ -743,17 +743,17 @@
{
"code": "002594",
"name": "比亚迪",
"price": 82.82,
"price": 82.79,
"cost": 0,
"shares": 0,
"avg_price": 0,
"action": "盈利持有 | 目标92.55 | 止损80.34 | 买入区81.16~84.48 | 信号:观望",
"stop_loss": 80.34,
"entry_low": 81.16,
"entry_high": 84.48,
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.17 弱压:85.0 强压:92.55",
"action": "盈利持有 | 目标92.54 | 止损80.31 | 买入区81.13~84.45 | 信号:观望",
"stop_loss": 80.31,
"entry_low": 81.13,
"entry_high": 84.45,
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.15 弱压:85.0 强压:92.54",
"timing_signal": "观望",
"rr_ratio": 3.92,
"rr_ratio": 3.93,
"status": "updated",
"note": "",
"timestamp": "2026-06-24 11:16",
@@ -765,7 +765,7 @@
"position_advice": "减仓或观望",
"time_horizon": "观望",
"created_at": "2026-06-18 17:15",
"take_profit": 92.55,
"take_profit": 92.54,
"updated_reason": "技术面重评: 止损77.92→77.93 | 形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:76.5 弱撑:82.17 弱压:85.0 强压:92.5",
"changelog": [
{
@@ -865,7 +865,7 @@
{
"id": "002594_stop_loss",
"condition": {
"price": "<80.34"
"price": "<80.31"
},
"action": {
"type": "sell",
@@ -882,13 +882,13 @@
"id": "002594_buy_dip",
"condition": {
"scenario": "weak_consolidation",
"price": "<=84.48",
"price_lower": ">=81.16"
"price": "<=84.45",
"price_lower": ">=81.13"
},
"action": {
"type": "buy",
"amount": "normal",
"limit": 81.16,
"limit": 81.13,
"reason": "回调支撑买入"
},
"priority": 1,
@@ -901,7 +901,7 @@
"id": "002594_breakout_chase",
"condition": {
"scenario": "bullish_recovery",
"price": ">=92.55"
"price": ">=92.54"
},
"action": {
"type": "buy",
@@ -935,7 +935,7 @@
{
"id": "002594_take_profit",
"condition": {
"price": ">=92.55"
"price": ">=92.54"
},
"action": {
"type": "sell",
@@ -5192,17 +5192,17 @@
{
"code": "300124",
"name": "汇川技术",
"price": 65.87,
"price": 66.01,
"cost": 0,
"shares": 0,
"avg_price": 0,
"action": "盈利持有 | 目标72.99 | 止损63.89 | 买入区64.55~67.19 | 信号:观望",
"stop_loss": 63.89,
"entry_low": 64.55,
"entry_high": 67.19,
"tech_snapshot": "形态:带上影阴线/bearish 量价:主动卖盘占优 强撑:59.75 弱撑:65.24 弱压:66.99 强压:72.99",
"action": "盈利持有 | 目标73.03 | 止损64.03 | 买入区64.69~67.33 | 信号:观望",
"stop_loss": 64.03,
"entry_low": 64.69,
"entry_high": 67.33,
"tech_snapshot": "形态:带上影阴线/bearish 量价:主动卖盘占优 强撑:59.79 弱撑:65.34 弱压:67.09 强压:73.03",
"timing_signal": "观望",
"rr_ratio": 3.6,
"rr_ratio": 3.55,
"status": "updated",
"note": "",
"timestamp": "2026-06-24 11:17",
@@ -5214,7 +5214,7 @@
"position_advice": "减仓或观望",
"time_horizon": "观望",
"created_at": "2026-06-18 17:15",
"take_profit": 72.99,
"take_profit": 73.03,
"updated_reason": "技术面重评: 止损61.97→62.13 | 形态:带上影阴线/bearish 量价:主动卖盘占优 强撑:59.78 弱撑:65.32 弱压:67.07 强压:73.",
"changelog": [
{
@@ -5307,7 +5307,7 @@
{
"id": "300124_stop_loss",
"condition": {
"price": "<63.89"
"price": "<64.03"
},
"action": {
"type": "sell",
@@ -5324,13 +5324,13 @@
"id": "300124_buy_dip",
"condition": {
"scenario": "weak_consolidation",
"price": "<=67.19",
"price_lower": ">=64.55"
"price": "<=67.33",
"price_lower": ">=64.69"
},
"action": {
"type": "buy",
"amount": "normal",
"limit": 64.55,
"limit": 64.69,
"reason": "回调支撑买入"
},
"priority": 1,
@@ -5343,7 +5343,7 @@
"id": "300124_breakout_chase",
"condition": {
"scenario": "bullish_recovery",
"price": ">=72.99"
"price": ">=73.03"
},
"action": {
"type": "buy",
@@ -5377,7 +5377,7 @@
{
"id": "300124_take_profit",
"condition": {
"price": ">=72.99"
"price": ">=73.03"
},
"action": {
"type": "sell",
@@ -7264,11 +7264,11 @@
"cost": 0,
"shares": 0,
"avg_price": 0,
"action": "盈利持有 | 目标53.71 | 止损47.9 | 买入区48.39~50.22 | 信号:观望",
"action": "盈利持有 | 目标53.72 | 止损47.9 | 买入区48.39~50.23 | 信号:观望",
"stop_loss": 47.9,
"entry_low": 48.39,
"entry_high": 50.22,
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.81 弱撑:48.65 弱压:50.5 强压:53.71",
"entry_high": 50.23,
"tech_snapshot": "形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:45.82 弱撑:48.65 弱压:50.5 强压:53.72",
"timing_signal": "观望",
"rr_ratio": 2.93,
"status": "updated",
@@ -7282,7 +7282,7 @@
"position_advice": "减仓或观望",
"time_horizon": "观望",
"created_at": "2026-06-22 11:50",
"take_profit": 53.71,
"take_profit": 53.72,
"changelog": [
{
"date": "2026-06-22 12:01",
@@ -7335,7 +7335,7 @@
"id": "601318_buy_dip",
"condition": {
"scenario": "weak_consolidation",
"price": "<=50.22",
"price": "<=50.23",
"price_lower": ">=48.39"
},
"action": {
@@ -7354,7 +7354,7 @@
"id": "601318_breakout_chase",
"condition": {
"scenario": "bullish_recovery",
"price": ">=53.71"
"price": ">=53.72"
},
"action": {
"type": "buy",
@@ -7388,7 +7388,7 @@
{
"id": "601318_take_profit",
"condition": {
"price": ">=53.71"
"price": ">=53.72"
},
"action": {
"type": "sell",
@@ -8426,17 +8426,17 @@
{
"code": "688795",
"name": "摩尔线程-U",
"price": 678.5,
"price": 679.95,
"cost": 0,
"shares": 0,
"avg_price": 0,
"action": "盈利持有 | 目标816.82 | 止损658.14 | 买入区664.93~692.07 | 信号:观望",
"stop_loss": 658.14,
"entry_low": 664.93,
"entry_high": 692.07,
"tech_snapshot": "形态:带下影阴线/neutral 量价:主动卖盘占优 强撑:563.22 弱撑:665.33 弱压:704.03 强压:816.82",
"action": "盈利持有 | 目标817.3 | 止损659.55 | 买入区666.35~693.55 | 信号:观望",
"stop_loss": 659.55,
"entry_low": 666.35,
"entry_high": 693.55,
"tech_snapshot": "形态:带下影阴线/neutral 量价:主动卖盘占优 强撑:563.22 弱撑:666.3 弱压:704.03 强压:817.3",
"timing_signal": "观望",
"rr_ratio": 6.79,
"rr_ratio": 6.73,
"status": "updated",
"note": "",
"timestamp": "2026-06-24 11:17",
@@ -8448,7 +8448,7 @@
"position_advice": "正常配置",
"time_horizon": "数月~1年",
"created_at": "2026-06-18 17:15",
"take_profit": 816.82,
"take_profit": 817.3,
"updated_reason": "技术面重评: 止损635.13→637.94 | 形态:光头光脚阴线/bearish 量价:主动卖盘占优 强撑:563.22 弱撑:665.0 弱压:704.03 强压:",
"changelog": [
{
@@ -8541,7 +8541,7 @@
{
"id": "688795_stop_loss",
"condition": {
"price": "<658.14"
"price": "<659.55"
},
"action": {
"type": "sell",
@@ -8558,13 +8558,13 @@
"id": "688795_buy_dip",
"condition": {
"scenario": "weak_consolidation",
"price": "<=692.07",
"price_lower": ">=664.93"
"price": "<=693.55",
"price_lower": ">=666.35"
},
"action": {
"type": "buy",
"amount": "normal",
"limit": 664.93,
"limit": 666.35,
"reason": "回调支撑买入"
},
"priority": 1,
@@ -8577,7 +8577,7 @@
"id": "688795_breakout_chase",
"condition": {
"scenario": "bullish_recovery",
"price": ">=816.82"
"price": ">=817.3"
},
"action": {
"type": "buy",
@@ -8611,7 +8611,7 @@
{
"id": "688795_take_profit",
"condition": {
"price": ">=816.82"
"price": ">=817.3"
},
"action": {
"type": "sell",
@@ -9065,5 +9065,5 @@
}
],
"total": 42,
"regenerated_at": "2026-06-24 11:19"
"regenerated_at": "2026-06-24 11:21"
}