# industry_runner.py (主程序 60 行)
import sys
from data_fetcher import fetch
from comparator import compare
from map_drawer import draw
def run(industry, num_companies=5):
"""1 行业 = 2 小时出报告""",
# Step 1 加载行业 (5 分钟)
companies = load_companies(industry, num_companies)
# Step 2 拉数据 (30 分钟)
data = fetch(companies, indicators=[
"scale", "profit", "valuation", "growth", "risk"
])
# Step 3 横向对比 (30 分钟)
compare_result = compare(data, dim="5d")
# Step 4 产业链拆解 (30 分钟)
value_chain = break_value_chain(industry)
# Step 5 出行业地图 (10 分钟)
map_path = draw(industry, value_chain)
# Step 6 出报告 (10 分钟)
report = generate_report(industry, compare_result, value_chain, map_path)
return report
if __name__ == "__main__":
industry = sys.argv[1] if len(sys.argv) > 1 else "xinnengyuanche"
report = run(industry)
print(f"行业 {industry} 报告已生成: output/{industry}_2024.md")