From 38acb38e82ecc053590776f3fe2b6023bcdbd1a9 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sat, 3 May 2025 21:54:09 +0800 Subject: [PATCH] update --- cryptoai/monitor_endpoint.py | 36 ++++++++++++++++-------------------- run_monitor.py | 10 ++++++++-- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/cryptoai/monitor_endpoint.py b/cryptoai/monitor_endpoint.py index 0df59a6..c3fa9de 100644 --- a/cryptoai/monitor_endpoint.py +++ b/cryptoai/monitor_endpoint.py @@ -2,27 +2,23 @@ from cryptoai.monitors.volume_growup import VolumeGrowupMonitor import schedule -class MonitorEndpoint: - """ - 监控端点 - """ - def __init__(self): - self.volume_growup_monitor = VolumeGrowupMonitor() - def run(self): - try: - print("☕️ 加密货币监控程序已启动") - times = [":00", ":05", ":10", ":15", ":20", ":25", ":30", ":35", ":40", ":45", ":50", ":55"] - for time in times: - schedule.every().hour.at(time).do(self.volume_growup_monitor.run, time_interval="5m") +def run_monitor(): + volume_growup_monitor = VolumeGrowupMonitor() - while True: - schedule.run_pending() - import time - time.sleep(1) - except Exception as e: - print(f"程序运行出错: {e}") - import traceback - traceback.print_exc() + try: + print("☕️ 加密货币监控程序已启动") + times = [":00", ":05", ":10", ":15", ":20", ":25", ":30", ":35", ":40", ":45", ":50", ":55"] + for time in times: + schedule.every().hour.at(time).do(volume_growup_monitor.run, time_interval="5m") + + while True: + schedule.run_pending() + import time + time.sleep(1) + except Exception as e: + print(f"程序运行出错: {e}") + import traceback + traceback.print_exc() diff --git a/run_monitor.py b/run_monitor.py index 7652245..dac7dc0 100644 --- a/run_monitor.py +++ b/run_monitor.py @@ -1,4 +1,10 @@ -from cryptoai.monitor_endpoint import MonitorEndpoint +from cryptoai.monitor_endpoint import run_monitor +import os +import sys + +# 添加项目根目录到Python路径 +current_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(current_dir) if __name__ == "__main__": - MonitorEndpoint().run() \ No newline at end of file + run_monitor() \ No newline at end of file