增加主力数据
This commit is contained in:
5
app.py
5
app.py
@@ -9211,18 +9211,19 @@ def get_stock_quote_detail(stock_code):
|
||||
result_data['week52_low'] = float(w52.get('week52_low') or 0)
|
||||
|
||||
# 3. 获取主力资金流向数据(取最新交易日)
|
||||
# 注意:stock_main_capital_flow 表中 code 格式为 "688150.SH",需要匹配带后缀的格式
|
||||
capital_flow_query = text("""
|
||||
SELECT
|
||||
net_inflow,
|
||||
net_active_buy_ratio,
|
||||
main_inflow_ratio
|
||||
FROM stock_main_capital_flow
|
||||
WHERE code = :stock_code
|
||||
WHERE code LIKE :stock_code_pattern
|
||||
ORDER BY trade_date DESC
|
||||
LIMIT 1
|
||||
""")
|
||||
|
||||
capital_flow_result = conn.execute(capital_flow_query, {'stock_code': base_code}).fetchone()
|
||||
capital_flow_result = conn.execute(capital_flow_query, {'stock_code_pattern': f'{base_code}.%'}).fetchone()
|
||||
if capital_flow_result:
|
||||
cf = row_to_dict(capital_flow_result)
|
||||
result_data['net_inflow'] = float(cf.get('net_inflow') or 0) if cf.get('net_inflow') is not None else None
|
||||
|
||||
Reference in New Issue
Block a user