diff --git a/main.py b/main.py index 7ca9ca4..1b68b49 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"] for t in times: schedule.every().day.at(t).do(vegas.run_crypto, interval = '4h') -version = 'V1.2' +version = 'V1.3' print(f'Running... {version}') telegram_sender.send_message(setting.chat_id, f'☕️ Strategy is updated!\r\n\r\nVersion: {version}') while True: diff --git a/monitors/vegas.py b/monitors/vegas.py index 3651bbe..2efa5ec 100644 --- a/monitors/vegas.py +++ b/monitors/vegas.py @@ -6,6 +6,8 @@ import datasource.crypto import time,setting import telegram_sender from datasource import crypto +from datetime import datetime + # crossover 函数:检测上穿信号 def crossover(series1, series2): @@ -48,23 +50,21 @@ def stratergy_run(symbol, interval,df): if latest['longResut']==True: direction = '多' - message = f"⭐️信号提醒⭐️\r\n\ - \r\n\ - 策略:【Vegas趋势跟踪V1.0】\r\n\ - 品种: {symbol}\r\n\ - 周期: {interval}\r\n\ - 信号: 【{direction}】\r\n\ - r\n\ - 当前价格:{latest['open']}\r\n\ - EMA13:{latest['ema13']}\r\n\ - EMA144:{latest['ema144']}\r\n\ - EMA169:{latest['ema169']}\r\n\ - \r\n\ - {latest['timestamp']}" - print(f"{symbol} - {interval} is checked!") + message = f"⭐️信号提醒⭐️\r\n\r\n" + message += f"策略:【Vegas趋势跟踪V1.0】\r\n" + message += f"品种: {symbol}\r\n" + message += f"周期: {interval}\r\n\r\n" + message += f"信号: 【{direction}】\r\n\r\n" + message += f"当前价格: {round(latest['open'],5)}\r\n" + message += f"EMA13: {round(latest['ema13'],5)}\r\n" + message += f"EMA144: {round(latest['ema144'],5)}\r\n" + message += f"EMA169: {round(latest['ema169'],5)}\r\n\r\n" + message += f"{latest['timestamp'].strftime('%Y/%m/%d %H:%M:%S')}" + + print(f"【{symbol} - {interval}】 is checked!") if direction != "": telegram_sender.send_message(setting.chat_id, message) - + print(f"【{symbol} - {interval}】 is singaled!") def run_crypto(interval): print('Vegas策略运行.') diff --git a/test.py b/test.py index e88c3d8..e954158 100644 --- a/test.py +++ b/test.py @@ -1,13 +1,8 @@ import yfinance as yf import pandas as pd -import monitors -import monitors.vegas from datasource import crypto from monitors import large_transfer +from monitors import vegas - -# large_transfer.run() - - -print(crypto.get_top_binance_usdt_pairs(20)) +vegas.run_crypto('4h') \ No newline at end of file