fix: 修复6个数据和代码问题

1. 修复 _generate_plain_summary position key 不匹配 (20d→d20, pct→range_pct)
2. 修复 mairui_api.py 日期解析不一致及 float(None) 崩溃风险
3. 修复 fund_flow_analyzer.py 麦蕊回退数据 close_price=0 导致量价背离误判
4. 修复 db_get_fund_flow_history 缺少完整字段和日期过滤
5. 修复 scheduler.py 连接池泄漏 (conn.close() → put_db(conn))
6. 修复多处北交所股票代码映射缺失 (8/9开头→bj)
This commit is contained in:
freedakgmail
2026-07-22 07:20:44 +08:00
parent 9a5e24ccd6
commit 40ce519188
7 changed files with 84 additions and 37 deletions
+6 -3
View File
@@ -552,7 +552,7 @@ def db_save_fundamental(code, data):
# ========== 资金流向历史数据操作(数据库版) ==========
def db_get_fund_flow_history(code):
def db_get_fund_flow_history(code, limit=60):
"""获取股票的资金流向历史数据"""
conn = get_db()
if not conn:
@@ -564,11 +564,14 @@ def db_get_fund_flow_history(code):
SELECT code, trade_date::text, close_price, change_pct,
main_net_inflow, main_net_inflow_pct,
super_net_inflow, super_net_inflow_pct,
big_net_inflow, big_net_inflow_pct
big_net_inflow, big_net_inflow_pct,
mid_net_inflow, mid_net_inflow_pct,
small_net_inflow, small_net_inflow_pct
FROM stock_fund_flow_history
WHERE code = %s
ORDER BY trade_date DESC
""", (code,))
LIMIT %s
""", (code, limit))
rows = cur.fetchall()
# 获取最新日期