diff --git a/utils.py b/utils.py index e51654d..417c4ca 100644 --- a/utils.py +++ b/utils.py @@ -8,11 +8,22 @@ from datetime import datetime, timedelta def load_config(): config_path = 'config.yaml' if not os.path.exists(config_path): - config = {'tushare_token': 'sk - tushare token'} + config = { + 'tushare_token': 'your_token_here', + 'mysql': { + 'user': 'user', + 'password': 'password', + 'host': '127.0.0.1', + 'port': 3306, + 'database': 'tushare', + 'charset': 'utf8' + } + } with open(config_path, 'w') as f: yaml.dump(config, f) - print(f"请在 {config_path} 中填入您的 tushare token") + print(f"请在 {config_path} 中填入您的 tushare token 和 MySQL 连接信息") exit(1) + with open(config_path, 'r') as f: config = yaml.safe_load(f) return config