This commit is contained in:
aaron 2024-11-14 13:41:55 +08:00
parent 192454d476
commit c619cf3275
6 changed files with 67 additions and 21 deletions

View File

@ -67,7 +67,6 @@ def get_symbols():
def get_future_symbols(): def get_future_symbols():
data = future_client.exchange_info()["symbols"] data = future_client.exchange_info()["symbols"]
print(data)
# 创建DataFrame # 创建DataFrame
columns = ['symbol', 'status','contractType', 'baseAsset', 'quoteAsset'] columns = ['symbol', 'status','contractType', 'baseAsset', 'quoteAsset']

View File

@ -2,7 +2,7 @@ import requests
import setting import setting
import urllib3 import urllib3
url = 'https://oapi.dingtalk.com/robot/send?access_token=c197bfacc77010e92804ecdbb6a6e0f95f86d9e7e4968fb35ec68720eeec8fa8' url = 'https://oapi.dingtalk.com/robot/send?access_token=2278b723cd363bb6f85592c743b59b166e70b9e02a275bb5cedbc33b53a5cbdc'
# 发送消息 # 发送消息
def send_message(text, isAtAll = False): def send_message(text, isAtAll = False):

32
main.py
View File

@ -1,21 +1,27 @@
import schedule import schedule
import time import time
import dingding
import monitors.jin10_cal as jin10 import monitors.jin10_cal as jin10
from monitors import vegas, vegas_cross, macd_boll from monitors import macd_boll,vol_up
#vegas #vegas
schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '1h') # schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '1h')
times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"] # times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
for t in times: # for t in times:
schedule.every().day.at(t).do(vegas.run_crypto, interval = '4h') # schedule.every().day.at(t).do(vegas.run_crypto, interval = '4h')
#vegas_cross #vegas_cross
schedule.every().hour.at(":00").do(vegas_cross.run_crypto, interval = '1h') # schedule.every().hour.at(":00").do(vegas_cross.run_crypto, interval = '1h')
times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"] # times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
for t in times: # for t in times:
schedule.every().day.at(t).do(vegas_cross.run_crypto, interval = '4h') # schedule.every().day.at(t).do(vegas_cross.run_crypto, interval = '4h')
#vol
schedule.every(5).minutes.do(vol_up.run_crypto, interval = '5m')
schedule.every().hour.at(":00").do(vol_up.run_crypto, interval = '1h')
#macd_boll #macd_boll
schedule.every().hour.at(":00").do(macd_boll.run_crypto, interval = '15m') schedule.every().hour.at(":00").do(macd_boll.run_crypto, interval = '15m')
@ -31,8 +37,10 @@ for t in times:
#jin10 #jin10
schedule.every().day.at("00:00").do(jin10.run) schedule.every().day.at("00:00").do(jin10.run)
version = 'V1.23' version = 'V1.3'
print(f'Running... {version}') text = f'☕️ Signals running... {version} !'
print(text)
dingding.send_message(text)
while True: while True:
schedule.run_pending() schedule.run_pending()
time.sleep(1) time.sleep(1)

34
monitors/vol_up.py Normal file
View File

@ -0,0 +1,34 @@
# 突然放量策略
import numpy as np
import datasource,time, dingding
def stratergy_run(symbol, interval, df, debug):
# 计算过去 30 根 K 线的平均交易量
average_volume = df["volume"].iloc[-31:-1].mean() # 倒数第 31 到倒数第 2 根的平均
# 获取当前(最后一根,即第 500 根)交易量
current_volume = df["volume"].iloc[-1]
timestamp = df['timestamp'].iloc[-1]
rate = current_volume / average_volume
print(f"{timestamp}】【{symbol}】当前交易量: {current_volume} , 平均交易量: {average_volume} , 倍数: {rate}")
if rate > 3:
message = "📢信号提醒📢\r\n\r\n"
message += f"{symbol}{interval} 出现放量!\r\n\r\n"
message += timestamp
if debug == False:
dingding.send_message(message, True)
print(f"{symbol} - {interval}】 is singal fired!")
else:
print(message)
def run_crypto(interval, debug=False):
symbols = datasource.crypto.get_future_symbols()
for s in symbols:
df = datasource.crypto.get_klines(s, interval, True,limit=50)
stratergy_run(s,interval, df, debug)
time.sleep(1)

View File

@ -8,3 +8,7 @@ chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading")
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT',"REEFUSDT","BONDUSDT","VIDTUSDT","UNFIUSDT"] symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT',"REEFUSDT","BONDUSDT","VIDTUSDT","UNFIUSDT"]
#dingding bot
singal_bot_url = 'https://oapi.dingtalk.com/robot/send?access_token=2278b723cd363bb6f85592c743b59b166e70b9e02a275bb5cedbc33b53a5cbdc'

15
test.py
View File

@ -4,7 +4,7 @@ from monitors import move
from datasource import crypto from datasource import crypto
import talib import talib
import discord_sender import discord_sender
from monitors import vegas_cross, jin10_cal from monitors import vegas_cross, jin10_cal,vol_up
from datasource import crypto from datasource import crypto
from monitors import macd_boll from monitors import macd_boll
import datasource import datasource
@ -12,6 +12,7 @@ from binance.um_futures import UMFutures
import redis import redis
vol_up.run_crypto('1h')
@ -31,14 +32,14 @@ import redis
key = 'QSZvYevTytwi8CJEkiUqqlZRQBOjIa23BoB8wFwTSY26GBAFkViTExex2mFNJ0ij' # key = 'QSZvYevTytwi8CJEkiUqqlZRQBOjIa23BoB8wFwTSY26GBAFkViTExex2mFNJ0ij'
secret = '1eGO4aeICAxPRXQzw2lQBc0QAkIKn6WiCV4cRLnUwnJulzixYFkoBeho5ZzsKTbn' # secret = '1eGO4aeICAxPRXQzw2lQBc0QAkIKn6WiCV4cRLnUwnJulzixYFkoBeho5ZzsKTbn'
client = UMFutures(key=key, secret=secret) # client = UMFutures(key=key, secret=secret)
# print(client.exchange_info()) # # print(client.exchange_info())
# data = client.funding_rate('BTCUSD_PERP', limit=1) # # data = client.funding_rate('BTCUSD_PERP', limit=1)
print(client.balance()) # print(client.balance())
# fundingRate = float(data[0]['fundingRate']) * 100 # fundingRate = float(data[0]['fundingRate']) * 100