fix: 修复外部因素数据源 - 北向资金改为南向资金,修复P0-P7全部外部因素

- P0资金面:DB数据过期时用麦蕊API获取资金流向
- P1市场情绪:去掉turnover字段依赖(DB无此字段)
- P2南向资金:北向实时数据已停公布,改用南向资金(港股通)替代
- P3美股:用腾讯财经API替代失效的AKShare接口
- P4大宗商品:用腾讯财经API替代,修复var_name解析
- P7汇率:用新浪财经API替代失效的AKShare接口
- 修复评分详情API技术得分硬编码问题
- 前端传入tech_score参数确保明细与列表分数一致
This commit is contained in:
selfrelease
2026-07-18 16:45:58 +08:00
parent bb5a72767f
commit 79e869eeda
13 changed files with 637 additions and 193 deletions
+27
View File
@@ -1096,6 +1096,33 @@ def _is_scan_running():
return False
@bp.route('/stock_score_detail/<code>', methods=['GET'])
def get_stock_score_detail(code):
"""获取单只股票的综合评分详情(外部因素)
通过 query 参数 tech_score 传入列表中的技术得分,确保明细与列表分数一致。
"""
try:
from services.score_engine import compute_comprehensive_score_batch
tech_score = float(request.args.get('tech_score', 50))
stocks_input = [{'stock_code': code, 'stock_name': '', 'technical_score': tech_score}]
scores_map = compute_comprehensive_score_batch(stocks_input)
sc = scores_map.get(code)
if sc:
return jsonify({
'success': True,
'technical_score': sc['technical_score'],
'external_score': sc['external_score'],
'final_score': sc['final_score'],
'verdict': sc['verdict'],
'factors': sc.get('factors', {}),
'summary': sc.get('summary', ''),
})
return jsonify({'success': False, 'error': '未找到评分数据'}), 404
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
@bp.route('/scan_status', methods=['GET'])
def get_scan_status():
"""查询扫描进度"""