feat: 4环节记录依据策略(source_strategy贯穿候选→提拔→重评快照)
- candidates+source_strategy, 4scanner INSERT写策略名(ON CONFLICT同步) - promote读c.source_strategy→holding.strategy_name - snapshot_strategy_history继承strategy_name写history - 历史回填447只候选+18只自选+8只holding
This commit is contained in:
@@ -1960,7 +1960,7 @@ def snapshot_strategy_history(conn, code: str, source_trigger: str = "write_hold
|
||||
row = conn.execute(
|
||||
"SELECT code, name, decision_type, strategy_type, full_analysis, "
|
||||
"action, timing_signal, entry_low, entry_high, stop_loss, take_profit, "
|
||||
"position_advice, rr_ratio, version, reassessed_at "
|
||||
"position_advice, rr_ratio, version, strategy_name, reassessed_at "
|
||||
"FROM holding_strategies WHERE code=? AND status='active'",
|
||||
(code,)
|
||||
).fetchone()
|
||||
@@ -1971,14 +1971,14 @@ def snapshot_strategy_history(conn, code: str, source_trigger: str = "write_hold
|
||||
INSERT INTO strategy_history
|
||||
(code, name, decision_type, strategy_type, full_analysis, action,
|
||||
timing_signal, entry_low, entry_high, stop_loss, take_profit,
|
||||
position_advice, rr_ratio, version, source_trigger, reassessed_at, snapshotted_at)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||
position_advice, rr_ratio, version, strategy_name, source_trigger, reassessed_at, snapshotted_at)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||
""", (
|
||||
row[0], row[1], row[2], row[3],
|
||||
row[4], row[5], row[6],
|
||||
row[7], row[8], row[9], row[10],
|
||||
row[11], row[12], row[13],
|
||||
source_trigger, row[14], now
|
||||
row[14], source_trigger, row[15], now
|
||||
))
|
||||
conn.commit()
|
||||
# 每只股票只保留最近20条历史
|
||||
|
||||
Reference in New Issue
Block a user