commit;
This commit is contained in:
parent
982e92c403
commit
16250cc2d9
|
|
@ -801,6 +801,36 @@ def collect_stock_daily_data_v3(db_url, tushare_token, mode='daily', date=None,
|
|||
|
||||
if mode == 'daily':
|
||||
collector.run_daily_collection(date)
|
||||
|
||||
# 股票日线数据采集完成后,自动计算行业和概念板块拥挤度指标
|
||||
print("\n" + "=" * 60)
|
||||
print("开始计算行业和概念板块拥挤度指标...")
|
||||
print("=" * 60)
|
||||
try:
|
||||
from src.valuation_analysis.industry_analysis import IndustryAnalyzer
|
||||
|
||||
analyzer = IndustryAnalyzer()
|
||||
|
||||
# 从数据库查询所有行业
|
||||
industry_list = analyzer.get_industry_list()
|
||||
industries = [item['name'] for item in industry_list]
|
||||
print(f"从数据库获取到 {len(industries)} 个行业")
|
||||
|
||||
# 从数据库查询所有概念板块
|
||||
concept_list = analyzer.get_concept_list()
|
||||
concepts = [item['name'] for item in concept_list]
|
||||
print(f"从数据库获取到 {len(concepts)} 个概念板块")
|
||||
|
||||
# 批量计算行业和概念板块拥挤度
|
||||
analyzer.batch_calculate_industry_crowding(industries, concepts)
|
||||
|
||||
print(f"批量计算完成:{len(industries)} 个行业和 {len(concepts)} 个概念板块的拥挤度指标")
|
||||
print("=" * 60)
|
||||
except Exception as e:
|
||||
# 行业拥挤度计算失败不影响主流程,只打印警告
|
||||
print(f"警告:计算行业拥挤度指标失败: {str(e)}")
|
||||
import traceback
|
||||
print(traceback.format_exc())
|
||||
elif mode == 'historical':
|
||||
collector.run_historical_collection(days)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -651,7 +651,16 @@ class TagRelationAPI:
|
|||
"message": f"从概念板块表匹配成功,关联{len(valid_stocks)}只股票",
|
||||
"error": None
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
"success": False,
|
||||
"tag_code": None,
|
||||
"tag_type": None,
|
||||
"source": None,
|
||||
"stock_count": 0,
|
||||
"message": "处理标签时发生异常"
|
||||
}
|
||||
|
||||
# 3. 都没匹配到,使用AI分析(异步队列处理)
|
||||
logger.info(f"在数据库表中未找到标签'{tag_name}',开始AI分析(异步队列)")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue