feat: 股票分析加政策注入(A股CN/港美股CN+INTL) + 新建calc_cn_levels.py+fetch_policy.py
This commit is contained in:
@@ -148,6 +148,11 @@ def calc_levels(symbol: str, klines: list, quote: dict, side: str, min_rr: float
|
||||
), strategy
|
||||
|
||||
|
||||
def _read_policy(path):
|
||||
p = Path(path)
|
||||
return p.read_text(encoding="utf-8").strip() if p.exists() else None
|
||||
|
||||
|
||||
def format_qq_output(levels, change, current_price, side, symbol, score, adr, mode):
|
||||
"""格式化为 QQ 推送文本 (单条)"""
|
||||
if mode == 'strict':
|
||||
@@ -186,6 +191,10 @@ def main():
|
||||
ap.add_argument('--strategy', default='rsi2_revert',
|
||||
choices=['rsi2_revert', 'vwap_revert', 'early_bird', 'turtle_breakout'],
|
||||
help='策略 (default rsi2_revert)')
|
||||
ap.add_argument('--policy-cn', default='/tmp/policy_cn.txt',
|
||||
help='国内政策文件 (空/不存在则跳过)')
|
||||
ap.add_argument('--policy-intl', default='/tmp/policy_intl.txt',
|
||||
help='国际政策文件 (空/不存在则跳过)')
|
||||
args = ap.parse_args()
|
||||
|
||||
if not os.path.exists(CANDIDATE_FILE):
|
||||
@@ -262,9 +271,20 @@ def main():
|
||||
print()
|
||||
|
||||
if output_lines:
|
||||
header = f"📊 港股日内做T点位 ({date})\n⚠️ 仅参考, 不交易\n"
|
||||
header_parts = []
|
||||
pol_cn = _read_policy(args.policy_cn)
|
||||
pol_intl = _read_policy(args.policy_intl)
|
||||
if pol_cn:
|
||||
header_parts.append(pol_cn)
|
||||
if pol_intl:
|
||||
header_parts.append(pol_intl)
|
||||
header_parts.append(f"📊 港股日内做T点位 ({date})")
|
||||
if args.strategy != 'rsi2_revert':
|
||||
header_parts.append(f"(策略: {args.strategy})")
|
||||
header_parts.append("⚠️ 仅参考, 不交易")
|
||||
header = "\n".join(header_parts)
|
||||
print("\n=== QQ 推送内容 ===")
|
||||
print(header + "\n---\n".join(output_lines))
|
||||
print(header + "\n" + "\n---\n".join(output_lines))
|
||||
else:
|
||||
print("\n💤 全部场景否决, 无输出")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user