This commit is contained in:
aaron 2024-11-15 22:28:21 +08:00
parent 44ffcfdcca
commit 150d25e7a2
2 changed files with 14 additions and 7 deletions

View File

@ -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)

View File

@ -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('信号 测试')
# dingding.send_message('信号 测试')