49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
|
||
from cryptoai.monitors.volume_growup import VolumeGrowupMonitor
|
||
from cryptoai.monitors.technical_indicators import TechnicalIndicatorsMonitor
|
||
import schedule
|
||
|
||
|
||
def run_monitor():
|
||
volume_growup_monitor = VolumeGrowupMonitor()
|
||
# volume_growup_monitor.run(time_interval="5m")
|
||
|
||
technical_indicators_monitor = TechnicalIndicatorsMonitor()
|
||
# technical_indicators_monitor.run(time_interval="15m")
|
||
|
||
# return
|
||
|
||
try:
|
||
print("☕️ 加密货币监控程序已启动")
|
||
|
||
# 5分钟监控,交易量增长
|
||
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")
|
||
|
||
|
||
# 15分钟监控,技术指标
|
||
times = [":00", ":15", ":30", ":45"]
|
||
for time in times:
|
||
schedule.every().hour.at(time).do(technical_indicators_monitor.run, time_interval="15m")
|
||
|
||
# 1小时监控,技术指标
|
||
schedule.every().hour.at(":00").do(technical_indicators_monitor.run, time_interval="1h")
|
||
|
||
# 4小时监控,技术指标
|
||
times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
|
||
for time in times:
|
||
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()
|
||
|
||
|