feat: accumulation/mr scanner写candidates.rr——全部scanner按规范提供RR
This commit is contained in:
@@ -230,16 +230,18 @@ def main():
|
|||||||
|
|
||||||
# UPSERT:只更新扫描器自有列,保留 score_*/pass_*/promoted/log/zhiwei_* 等计算列
|
# UPSERT:只更新扫描器自有列,保留 score_*/pass_*/promoted/log/zhiwei_* 等计算列
|
||||||
# (原 INSERT OR REPLACE 会把 promoted=1 的行整行替换,计算列全部清零——2026-07-23 审计发现)
|
# (原 INSERT OR REPLACE 会把 promoted=1 的行整行替换,计算列全部清零——2026-07-23 审计发现)
|
||||||
|
_mid_v = (entry_low + entry_high) / 2
|
||||||
|
_rr_v = round((tp - _mid_v) / (_mid_v - sl), 2) if _mid_v > sl > 0 else 0
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT INTO candidates (code, name, sector, reason, "
|
"INSERT INTO candidates (code, name, sector, reason, "
|
||||||
"entry_range, stop_loss, target, created_at) "
|
"entry_range, stop_loss, target, rr, created_at) "
|
||||||
"VALUES (?,?,?,?,?,?,?,datetime('now','localtime')) "
|
"VALUES (?,?,?,?,?,?,?,?,datetime('now','localtime')) "
|
||||||
"ON CONFLICT(code) DO UPDATE SET "
|
"ON CONFLICT(code) DO UPDATE SET "
|
||||||
"name=excluded.name, sector=excluded.sector, reason=excluded.reason, "
|
"name=excluded.name, sector=excluded.sector, reason=excluded.reason, "
|
||||||
"entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target",
|
"entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target, rr=excluded.rr",
|
||||||
(code, name, "accumulation",
|
(code, name, "accumulation",
|
||||||
f"主力建仓特征({reasons}) 评分{score}/7",
|
f"主力建仓特征({reasons}) 评分{score}/7",
|
||||||
f"{entry_low}~{entry_high}", sl, tp)
|
f"{entry_low}~{entry_high}", sl, tp, _rr_v)
|
||||||
)
|
)
|
||||||
inserted += 1
|
inserted += 1
|
||||||
print(f" 🟢 {code} {name} 价{price} 评分{score}/7 {reasons}", flush=True)
|
print(f" 🟢 {code} {name} 价{price} 评分{score}/7 {reasons}", flush=True)
|
||||||
|
|||||||
@@ -317,15 +317,17 @@ def main():
|
|||||||
(code,)).fetchone()
|
(code,)).fetchone()
|
||||||
if exists:
|
if exists:
|
||||||
continue
|
continue
|
||||||
|
_mid_v = (entry_low + entry_high) / 2
|
||||||
|
_rr_v = round((tp - _mid_v) / (_mid_v - sl), 2) if _mid_v > sl > 0 else 0
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT INTO candidates (code, name, sector, reason, "
|
"INSERT INTO candidates (code, name, sector, reason, "
|
||||||
"entry_range, stop_loss, target, created_at) "
|
"entry_range, stop_loss, target, rr, created_at) "
|
||||||
"VALUES (?,?,?,?,?,?,?,datetime('now','localtime')) "
|
"VALUES (?,?,?,?,?,?,?,?,datetime('now','localtime')) "
|
||||||
"ON CONFLICT(code) DO UPDATE SET "
|
"ON CONFLICT(code) DO UPDATE SET "
|
||||||
"name=excluded.name, sector=excluded.sector, reason=excluded.reason, "
|
"name=excluded.name, sector=excluded.sector, reason=excluded.reason, "
|
||||||
"entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target",
|
"entry_range=excluded.entry_range, stop_loss=excluded.stop_loss, target=excluded.target, rr=excluded.rr",
|
||||||
(code, name, "v_mr", reasons,
|
(code, name, "v_mr", reasons,
|
||||||
f"{entry_low}~{entry_high}", sl, tp))
|
f"{entry_low}~{entry_high}", sl, tp, _rr_v))
|
||||||
inserted += 1
|
inserted += 1
|
||||||
print(f" 🟢 {code} {name} 价{price} bias60={sig['bias60']}% "
|
print(f" 🟢 {code} {name} 价{price} bias60={sig['bias60']}% "
|
||||||
f"rsi={sig['rsi']} r5f={sig['r5f']}% {reasons}", flush=True)
|
f"rsi={sig['rsi']} r5f={sig['r5f']}% {reasons}", flush=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user