update
This commit is contained in:
parent
f7cac309fc
commit
da3c2836c0
12
discord_sender.py
Normal file
12
discord_sender.py
Normal file
@ -0,0 +1,12 @@
|
||||
import requests
|
||||
|
||||
|
||||
mUrl = "https://discordapp.com/api/webhooks/1285867836454998077/JNAFUyur_ygOJIh6C4beUAVYMpm1TZf4IEeMn8Q1p0TglO1Hjyiu2LQqiU5AxVovWyiO"
|
||||
|
||||
def send_message(content):
|
||||
data = {"content": content}
|
||||
response = requests.post(mUrl, json=data)
|
||||
|
||||
print(response.status_code)
|
||||
|
||||
print(response.content)
|
||||
10
main.py
10
main.py
@ -7,17 +7,11 @@ import dingding
|
||||
import monitors.move as move
|
||||
|
||||
#move
|
||||
# schedule.every(5).minutes.do(move.run_crypto, interval = '5m')
|
||||
|
||||
schedule.every().hour.at(":00").do(move.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":30").do(move.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":15").do(move.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":45").do(move.run_crypto, interval = '15m')
|
||||
|
||||
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
|
||||
# schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '30m')
|
||||
@ -28,7 +22,7 @@ schedule.every().hour.at(":00").do(move.run_crypto, interval = '1h')
|
||||
# for t in times:
|
||||
# schedule.every().day.at(t).do(vegas.run_crypto, interval = '4h')
|
||||
|
||||
version = 'V1.8'
|
||||
version = 'V1.9'
|
||||
print(f'Running... {version}')
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
|
||||
@ -8,6 +8,7 @@ import telegram_sender
|
||||
from datasource import crypto
|
||||
from datetime import datetime
|
||||
import dingding
|
||||
import discord_sender
|
||||
|
||||
|
||||
# crossover 函数:检测上穿信号
|
||||
@ -42,10 +43,9 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
|
||||
maxDiff = max(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
minDiff = min(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
isOffset = maxDiff / minDiff < 3
|
||||
|
||||
isbullish = d1['isLongArrangement'] == True and d2['isLongArrangement'] == True and d3['isLongArrangement'] == False and isOffset == True
|
||||
isBear = d1['isShortArrangement'] == True and d2['isShortArrangement'] == True and d3['isShortArrangement'] == False and isOffset == True
|
||||
isbullish = d1['isLongArrangement'] == True and d2['isLongArrangement'] == True and d3['isLongArrangement'] == False
|
||||
isBear = d1['isShortArrangement'] == True and d2['isShortArrangement'] == True and d3['isShortArrangement'] == False
|
||||
|
||||
print(f"{symbol} - {interval} bullish: {isbullish} | bear : {isBear} | LongArrangement: {d1['isLongArrangement']} | ShortArrangement: {d1['isShortArrangement']}")
|
||||
if(isbullish | isBear):
|
||||
@ -57,6 +57,7 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
message += f"收盘价: {d1['close']}\r\n"
|
||||
dingding.send_message(message, isAtAll=True)
|
||||
telegram_sender.send_message(setting.chat_id, message)
|
||||
discord_sender.send_message(message)
|
||||
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
|
||||
47
test.py
47
test.py
@ -2,33 +2,38 @@ import requests
|
||||
from monitors import move
|
||||
from datasource import crypto
|
||||
import talib
|
||||
import discord_sender
|
||||
|
||||
# move.run_crypto('5m')
|
||||
# # move.run_crypto('5m')
|
||||
|
||||
df = crypto.get_klines('PEOPLEUSDT', '5m')
|
||||
# df = crypto.get_klines('PEOPLEUSDT', '5m')
|
||||
|
||||
|
||||
## 计算 ema
|
||||
df['ema5'] = talib.EMA(df['close'], timeperiod=5)
|
||||
df['ema10'] = talib.EMA(df['close'], timeperiod=10)
|
||||
df['ema30'] = talib.EMA(df['close'], timeperiod=30)
|
||||
df['ema144'] = talib.EMA(df['close'], timeperiod=144)
|
||||
# ## 计算 ema
|
||||
# df['ema5'] = talib.EMA(df['close'], timeperiod=5)
|
||||
# df['ema10'] = talib.EMA(df['close'], timeperiod=10)
|
||||
# df['ema30'] = talib.EMA(df['close'], timeperiod=30)
|
||||
# df['ema144'] = talib.EMA(df['close'], timeperiod=144)
|
||||
|
||||
df['shortDiff'] = abs(df['ema5'] - df['ema10']) / df['ema10']
|
||||
df['midDiff'] = abs(df['ema10'] - df['ema30']) / df['ema30']
|
||||
df['longDiff'] = abs(df['ema30'] - df['ema144']) / df['ema144']
|
||||
# df['shortDiff'] = abs(df['ema5'] - df['ema10']) / df['ema10']
|
||||
# df['midDiff'] = abs(df['ema10'] - df['ema30']) / df['ema30']
|
||||
# df['longDiff'] = abs(df['ema30'] - df['ema144']) / df['ema144']
|
||||
|
||||
df['isLongArrangement'] = ((df['ema5'] > df['ema10']) & (df['ema10'] > df['ema30']) & (df['ema30'] > df['ema144']))
|
||||
df['isShortArrangement'] = ((df['ema5'] < df['ema10']) & (df['ema10'] < df['ema30']) & (df['ema30'] < df['ema144']))
|
||||
# df['isLongArrangement'] = ((df['ema5'] > df['ema10']) & (df['ema10'] > df['ema30']) & (df['ema30'] > df['ema144']))
|
||||
# df['isShortArrangement'] = ((df['ema5'] < df['ema10']) & (df['ema10'] < df['ema30']) & (df['ema30'] < df['ema144']))
|
||||
|
||||
d1 = df.iloc[-1]
|
||||
d2 = df.iloc[-2]
|
||||
d3 = df.iloc[-3]
|
||||
# d1 = df.iloc[-1]
|
||||
# d2 = df.iloc[-2]
|
||||
# d3 = df.iloc[-3]
|
||||
|
||||
isBear = d1['isShortArrangement'] == True and d2['isShortArrangement'] == True and d3['isShortArrangement'] == False
|
||||
maxDiff = max(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
minDiff = min(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
isOffset = maxDiff / minDiff < 3
|
||||
# isBear = d1['isShortArrangement'] == True and d2['isShortArrangement'] == True and d3['isShortArrangement'] == False
|
||||
# maxDiff = max(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
# minDiff = min(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
# isOffset = maxDiff / minDiff < 3
|
||||
|
||||
# print(df)
|
||||
# print(isOffset)
|
||||
|
||||
|
||||
discord_sender.send_message('https://www.youtube.com/watch?v=_yI5SYTMo0U')
|
||||
|
||||
print(df)
|
||||
print(isOffset)
|
||||
Loading…
Reference in New Issue
Block a user