This commit is contained in:
aaron 2025-05-04 10:24:43 +08:00
parent ab95ecd539
commit bbe80661f8
3 changed files with 9 additions and 11 deletions

View File

@ -7,6 +7,8 @@ import argparse
from typing import Dict, Any
import schedule
import time
import logging
# 添加项目根目录到Python路径
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
@ -16,32 +18,28 @@ from cryptoai.agents.crypto_agent import CryptoAgent
from cryptoai.agents.gold_agent import GoldAgent
from cryptoai.utils.config_loader import ConfigLoader
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def task_start():
try:
# GoldAgent().start_agent()
# # CryptoAgent().start_agent()
# CryptoAgent().start_agent()
# return
print("🚀 加密货币Agent程序已启动")
# 设置 08:00, 20:00 运行一次
logger.info("🚀 加密货币Agent程序已启动")
schedule.every().day.at("00:00").do(CryptoAgent().start_agent)
schedule.every().day.at("08:00").do(CryptoAgent().start_agent)
schedule.every().day.at("12:00").do(CryptoAgent().start_agent)
schedule.every().day.at("16:00").do(CryptoAgent().start_agent)
schedule.every().day.at("20:00").do(CryptoAgent().start_agent)
# schedule.every().day.at("00:00").do(GoldAgent().start_agent)
# schedule.every().day.at("08:00").do(GoldAgent().start_agent)
# schedule.every().day.at("12:00").do(GoldAgent().start_agent)
# schedule.every().day.at("16:00").do(GoldAgent().start_agent)
# schedule.every().day.at("20:00").do(GoldAgent().start_agent)
while True:
schedule.run_pending()
time.sleep(1)
except Exception as e:
print(f"程序运行出错: {e}")
logger.error(f"程序运行出错: {e}")
import traceback
traceback.print_exc()

View File

@ -4,7 +4,7 @@ services:
cryptoai:
build: .
container_name: cryptoai-task
image: cryptoai:0.0.12
image: cryptoai:0.0.13
restart: always
volumes:
- ./cryptoai/data:/app/cryptoai/data