This commit is contained in:
aaron 2024-07-25 00:12:02 +08:00
parent 48668406f2
commit 16ee95d585
6 changed files with 37 additions and 21 deletions

View File

@ -1,6 +1,7 @@
import requests
from binance.spot import Spot
import pandas as pd
import urllib3
api_key = "HCpeel8g6fsTK2630b7BvGBcS09Z3qfXkLVcAY2JkpaiMm1J6DWRvoQZBQlElDJg"
api_secret= "TySs6onlHOTrGzV8fMdDxLKTWWYnQ4rCHVAmjrcHby17acKflmo7xVTWVsbqtxe7"
@ -17,7 +18,8 @@ def _get_top_coins_by_market_cap(top):
'per_page': top,
'page': 1
}
response = requests.get(coingecko_url, params=params)
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
response = requests.get(coingecko_url, params=params, verify=False)
coins = response.json()
return coins
@ -63,9 +65,9 @@ def get_symbols():
return df_in_USDT['symbol']
## 根据交易对和周期获取数据集
def get_klines(symbol,interval):
def get_klines(symbol,interval , limit=500):
# 获取 k 线数据
data = client.klines(symbol, interval,limit=500)
data = client.klines(symbol, interval,limit=limit)
# 将数据转换为DataFrame
columns = ['timestamp', 'open', 'high', 'low', 'close', 'volume',

View File

@ -1,5 +1,6 @@
import requests
import setting
import urllib3
url = 'https://oapi.dingtalk.com/robot/send?access_token=c197bfacc77010e92804ecdbb6a6e0f95f86d9e7e4968fb35ec68720eeec8fa8'
@ -14,4 +15,5 @@ def send_message(text, isAtAll = False):
"isAtAll": isAtAll
}
}
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
print(requests.post(url, json=formData, verify=False).json())

12
main.py
View File

@ -4,6 +4,16 @@ import monitors.vegas as vegas
import monitors.large_transfer as lt
import telegram_sender,setting
import dingding
import monitors.move as move
#move
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 = '1h')
#vegas
schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '15m')
@ -19,7 +29,7 @@ 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')
version = 'V1.5'
version = 'V1.6'
print(f'Running... {version}')
while True:
schedule.run_pending()

View File

@ -34,25 +34,27 @@ def stratergy_run(symbol, interval, df, debug):
df['priceCheck'] = (longDiff <= maxDifference) & (midDiff <= maxDifference) & (shortDiff <= maxDifference)
df['isLongArrangement'] = (df['ema5'] > df['ema10']) & (df['ema10'] > df['ema30']) & (df['ema30'] > df['ema144'])
df['preLongArrangement'] = (df['ema5'].shift(1) > df['ema10'].shift(1)) & (df['ema10'].shift(1) > df['ema30'].shift(1)) & (df['ema30'].shift(1) > df['ema144'].shift(1))
latest = df.iloc[-1]
isbullish = latest['preLongArrangement'] == False & latest['isLongArrangement'] == True & latest['priceCheck'] ==True
print(f"{symbol} bullish: {isbullish}")
if(isbullish):
message = f"⭐️信号策略⭐️\r\n\r\n"
d1 = df.iloc[-1]
d2 = df.iloc[-2]
d3 = df.iloc[-3]
isbullish = d1['isLongArrangement'] == True & d2['isLongArrangement'] == False & d1['priceCheck'] == True
print(f"{symbol} bullish: {isbullish} | isLongArrangement: {d1['isLongArrangement']} | priceCheck: {d1['priceCheck']}")
if(isbullish == True):
message = f"🦄 信 号 提 醒 🦄\r\n\r\n"
message += f"策略:【趋势追踪V1.0】\r\n"
message += f"品种: {symbol}\r\n"
message += f"周期: {interval}\r\n\r\n"
message += f"信号: 【启动】\r\n\r\n"
message += f"周期: {interval}\r\n"
message += f"信号: 【多头排列】\r\n"
dingding.send_message(message)
dingding.send_message(message, isAtAll=True)
def run_crypto(interval, debug=False):
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT']
symbols = datasource.crypto.get_top_binance_usdt_pairs(100)
for s in symbols:
df = crypto.get_klines(s, interval)
stratergy_run(s,interval, df, debug)
time.sleep(1)

View File

@ -47,15 +47,15 @@ def stratergy_run(symbol, interval, df, debug):
direction = ""
if latest['shortResut']==True:
direction = ''
direction = ''
if latest['longResut']==True:
direction = ''
direction = ''
message = f"🌟信号提醒⭐️\r\n\r\n"
message = f"🌟 信 号 提 醒 🌟\r\n\r\n"
message += f"策略:【Vegas趋势跟踪策略】\r\n"
message += f"品种: {symbol}\r\n"
message += f"周期: {interval}\r\n\r\n"
message += f"信号: 【{direction}\r\n\r\n"
message += f"周期: {interval}\r\n"
message += f"信号: 【{direction}\r\n"
print(f"{symbol} - {interval}】 is checked!")
if direction != "":

View File

@ -1,4 +1,4 @@
import requests
from monitors import move
move.run_crypto('1h')
move.run_crypto('30m')