crypto.ai/cryptoai/monitor_endpoint.py
2025-05-06 22:59:43 +08:00

47 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from cryptoai.monitors.volume_growup import VolumeGrowupMonitor
from cryptoai.monitors.technical_indicators import TechnicalIndicatorsMonitor
from cryptoai.monitors.important_events import ImportantEventsMonitor
import schedule
def run_monitor():
# volume_growup_monitor = VolumeGroclearwupMonitor()
# volume_growup_monitor.run(time_interval="5m")
# technical_indicators_monitor = TechnicalIndicatorsMonitor()
# technical_indicators_monitor.run(time_interval="15m")
important_events_monitor = ImportantEventsMonitor()
# important_events_monitor.run()
try:
print("☕️ 加密货币监控程序已启动")
schedule.every().day.at("08:00").do(important_events_monitor.run)
# # 5分钟监控交易量增长
# for time in [":00", ":05", ":10", ":15", ":20", ":25", ":30", ":35", ":40", ":45", ":50", ":55"]:
# schedule.every().hour.at(time).do(volume_growup_monitor.run, time_interval="5m")
# # 每小时整点监控,技术指标
# for time in ["00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"]:
# schedule.every().hour.at(time).do(technical_indicators_monitor.run, time_interval="1h")
# # 4小时监控技术指标
# for time in ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]:
# schedule.every().day.at(time).do(technical_indicators_monitor.run, time_interval="4h")
while True:
schedule.run_pending()
import time
time.sleep(1)
except Exception as e:
print(f"程序运行出错: {e}")
import traceback
traceback.print_exc()