diff --git a/monitors/vol_up.py b/monitors/vol_up.py index af8eb25..d5ee714 100644 --- a/monitors/vol_up.py +++ b/monitors/vol_up.py @@ -1,6 +1,7 @@ # 突然放量策略 import numpy as np -import datasource,time, dingding +from datasource import crypto +import time, dingding def stratergy_run(symbol, interval, df, debug): # 计算过去 30 根 K 线的平均交易量 @@ -13,7 +14,13 @@ def stratergy_run(symbol, interval, df, debug): rate = current_volume / average_volume - if rate > 10: + rate_limit = 10 + if interval == '15m': + rate_limit = 5 + if interval == '1h': + rate_limit = 3 + + if rate > rate_limit: message = "📢Signals Notificaiton📢\r\n\r\n" message += f"{symbol} 在 {interval} 出现放量 {round(rate, 2)}倍 !\r\n\r\n" message += f"{timestamp}" @@ -25,11 +32,11 @@ def stratergy_run(symbol, interval, df, debug): print(message) def run_crypto(interval, debug=False): - print('Vols-up strategy is running...') + print(f"Vols-up strategy {interval} is running...") - symbols = datasource.crypto.get_future_symbols() + symbols = crypto.get_future_symbols() for s in symbols: - df = datasource.crypto.get_klines(s, interval, True,limit=50) + df = crypto.get_klines(s, interval, True,limit=50) stratergy_run(s,interval, df, debug) time.sleep(1) \ No newline at end of file diff --git a/test.py b/test.py index 0ae40c1..fce698c 100644 --- a/test.py +++ b/test.py @@ -20,7 +20,7 @@ import redis,dingding # print(r.get('r_symbols')) -# print(datasource.crypto.get_future_symbols()) +print(datasource.crypto.get_future_symbols()) # macd_boll.run_crypto('15m', debug=True) @@ -51,4 +51,4 @@ import redis,dingding -dingding.send_message('信号 测试') \ No newline at end of file +# dingding.send_message('信号 测试') \ No newline at end of file