Files
quant/finance/download_data.py
2025-11-16 07:53:15 +08:00

46 lines
1.3 KiB
Python

import logging
from wind_data_fetcher import WindDataFetcher
# 设置更详细的日志级别
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - [%(funcName)s] - %(message)s'
)
def main():
# 数据库配置
db_config = {
'host': '127.0.0.1',
'database': 'fintech',
'user': 'root',
'password': 'secret',
'port': 3306
}
# 初始化Wind数据获取器
wind_fetcher = WindDataFetcher(db_config)
# 单个股票示例
print("=== 处理单个股票 ===")
success = wind_fetcher.process_and_save_data("000001.SZ", "2024-12-31")
print(f"处理结果: {'成功' if success else '失败'}")
# # 批量处理示例
# print("\n=== 批量处理多个股票 ===")
# stock_list = [
# "600519.SZ", # 贵州茅台
# "000002.SZ", # 万科A
# "600036.SH", # 招商银行
# "601318.SH", # 中国平安
# ]
# results = wind_fetcher.batch_fetch_stocks(stock_list, "2024-12-31")
# # 打印结果摘要
# print("\n=== 处理结果摘要 ===")
# for stock, success in results.items():
# status = "成功" if success else "失败"
# print(f"{stock}: {status}")
if __name__ == "__main__":
main()