no message

This commit is contained in:
aaron 2024-09-19 14:29:07 +08:00
parent 16808eceba
commit 830b9f93d3
5 changed files with 46 additions and 30 deletions

View File

@ -66,7 +66,7 @@ def get_symbols():
return df_in_USDT['symbol'] return df_in_USDT['symbol']
## 根据交易对和周期获取数据集 ## 根据交易对和周期获取数据集
def get_klines(symbol,interval , limit=500): def get_klines(symbol,interval , limit=1000):
# 获取 k 线数据 # 获取 k 线数据
data = client.klines(symbol, interval,limit=limit) data = client.klines(symbol, interval,limit=limit)

30
main.py
View File

@ -1,28 +1,32 @@
import schedule import schedule
import time import time
import monitors.vegas as vegas
import monitors.large_transfer as lt import monitors.large_transfer as lt
import telegram_sender,setting import telegram_sender,setting
import dingding import dingding
import monitors.move as move import monitors.move as move
#move from monitors import vegas, vegas_cross
schedule.every().hour.at(":00").do(move.run_crypto, interval = '30m')
schedule.every().hour.at(":30").do(move.run_crypto, interval = '30m')
schedule.every().hour.at(":00").do(move.run_crypto, interval = '1h') #move
schedule.every().hour.at(":00").do(move.run_crypto, interval = '4h') # schedule.every().hour.at(":00").do(move.run_crypto, interval = '30m')
# schedule.every().hour.at(":30").do(move.run_crypto, interval = '30m')
# schedule.every().hour.at(":00").do(move.run_crypto, interval = '1h')
# schedule.every().hour.at(":00").do(move.run_crypto, interval = '4h')
#vegas #vegas
# schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '30m') schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '1h')
# schedule.every().hour.at(":30").do(vegas.run_crypto, interval = '30m') 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')
# schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '1h') #vegas_cross
# times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"] schedule.every().hour.at(":00").do(vegas_cross.run_crypto, interval = '1h')
# for t in times: times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
# schedule.every().day.at(t).do(vegas.run_crypto, interval = '4h') for t in times:
schedule.every().day.at(t).do(vegas_cross.run_crypto, interval = '4h')
version = 'V1.10' version = 'V1.12'
print(f'Running... {version}') print(f'Running... {version}')
while True: while True:
schedule.run_pending() schedule.run_pending()

View File

@ -4,6 +4,7 @@ import time,setting
import telegram_sender import telegram_sender
from datasource import crypto from datasource import crypto
import dingding import dingding
import discord_sender
# crossover 函数:检测上穿信号 # crossover 函数:检测上穿信号
@ -43,12 +44,11 @@ def stratergy_run(symbol, interval, df, debug):
direction = "" direction = ""
if latest['shortResut']==True: if latest['shortResut']==True:
direction = '' direction = ''
if latest['longResut']==True: if latest['longResut']==True:
direction = '' direction = ''
message = f"🌟 信 号 提 醒 🌟\r\n\r\n" message = f"策略:【Vegas反转策略】\r\n"
message += f"策略:【Vegas反转策略】\r\n"
message += f"品种: {symbol}\r\n" message += f"品种: {symbol}\r\n"
message += f"周期: {interval}\r\n" message += f"周期: {interval}\r\n"
message += f"信号: 【{direction}\r\n" message += f"信号: 【{direction}\r\n"
@ -57,8 +57,9 @@ def stratergy_run(symbol, interval, df, debug):
print(f"{symbol} - {interval}】 is checked!") print(f"{symbol} - {interval}】 is checked!")
if direction != "": if direction != "":
if debug == False: if debug == False:
telegram_sender.send_message(setting.chat_id, message) url = 'https://discordapp.com/api/webhooks/1285867836454998077/JNAFUyur_ygOJIh6C4beUAVYMpm1TZf4IEeMn8Q1p0TglO1Hjyiu2LQqiU5AxVovWyiO'
dingding.send_message(message) discord_sender.send_message(url,'🦄信号提醒🦄',message)
print(f"{symbol} - {interval}】 is singal fired!") print(f"{symbol} - {interval}】 is singal fired!")
else: else:
print(message) print(message)
@ -69,8 +70,7 @@ def run_crypto(interval, debug=False):
# symbols = crypto.get_symbols() # symbols = crypto.get_symbols()
# symbols = crypto.get_top_binance_usdt_pairs(10) # symbols = crypto.get_top_binance_usdt_pairs(10)
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT'] for s in setting.symbols:
for s in symbols:
df = crypto.get_klines(s, interval) df = crypto.get_klines(s, interval)
stratergy_run(s,interval, df, debug) stratergy_run(s,interval, df, debug)

View File

@ -5,3 +5,7 @@ telegram_bot_key='5863718864:AAFijN65_SbbGQ0WDBggzKJw2SIcZVTVrPw'
# #
chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading") chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading")
#
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT']

22
test.py
View File

@ -4,17 +4,25 @@ from datasource import crypto
import talib import talib
import discord_sender import discord_sender
from binance.cm_futures import CMFutures from binance.cm_futures import CMFutures
from monitors import vegas_cross
from datasource import crypto
client = CMFutures()
data = client.funding_rate('BTCUSD_PERP', limit=1)
fundingRate = float(data[0]['fundingRate']) * 100 print(crypto._get_top_coins_by_market_cap(20))
# vegas_cross.run_crypto('1h')
text = f"币种: {data[0]['symbol']}\r\n资金费率: {fundingRate} %"
mUrl = "https://discordapp.com/api/webhooks/1285898004641091605/DwIh9yZvrU6TwelVmJr96XBdpFTEEpeFD8GsZpH7rBdwT4UwVyZTrtdmBzS4ae0Ta7PH"
discord_sender.send_message(mUrl, '消息内容',text) # client = CMFutures()
# data = client.funding_rate('BTCUSD_PERP', limit=1)
# fundingRate = float(data[0]['fundingRate']) * 100
# text = f"币种: {data[0]['symbol']}\r\n资金费率: {fundingRate} %"
# mUrl = "https://discordapp.com/api/webhooks/1285898004641091605/DwIh9yZvrU6TwelVmJr96XBdpFTEEpeFD8GsZpH7rBdwT4UwVyZTrtdmBzS4ae0Ta7PH"
# discord_sender.send_message(mUrl, '消息内容',text)