update api,libs

This commit is contained in:
2026-08-30 00:34:27 +08:00
parent 9a43aaba23
commit cdccc48d8c
21 changed files with 2616 additions and 179 deletions

View File

@@ -2,10 +2,9 @@
# -*- coding: utf-8 -*-
import logging
from logging.handlers import TimedRotatingFileHandler
import os
import sys
import schedule
from apscheduler.schedulers.background import BackgroundScheduler
import config
from dataclasses import dataclass
import yaml
@@ -98,7 +97,7 @@ def wait_for_any_key() -> None:
def main() -> int:
try:
if not require_windows():
log.error("本程序仅支持 Windows 环境运行")
logging.error("本程序仅支持 Windows 环境运行")
return 1
if not check_single_instance(PROJECT_ROOT):
return 1
@@ -108,10 +107,21 @@ def main() -> int:
raise RuntimeError("配置尚未加载,请先调用 config.load()")
wait_for_qmt_api()
# 自动打新与主策略隔离;申购服务失败不能阻止趋势策略启动
schedule.every().day.at("10:00").do(AutoBuyIpo)
schedule.run_pending()
logging.info("IPO 自动打新启动成功")
# 后台调度不受趋势策略永久循环阻塞;同一时刻最多执行一个实例
scheduler = BackgroundScheduler(
timezone="Asia/Shanghai",
job_defaults={"coalesce": True, "max_instances": 1},
)
scheduler.add_job(
AutoBuyIpo,
trigger="cron",
hour="10,14",
minute=0,
id="auto_buy_ipo",
replace_existing=True,
)
scheduler.start()
logging.info("IPO 自动打新定时任务已启动:每日 10:00、14:00")
STRATEGIES[config.account_config.strategy].start_strategy()
logging.info("%s 策略启动成功",config.account_config.strateg)