46 lines
1.2 KiB
Python
46 lines
1.2 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.SH",
|
|
"600436.SH",
|
|
"600887.SH",
|
|
"000858.SZ",
|
|
]
|
|
|
|
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() |