1
This commit is contained in:
parent
6decd1b4db
commit
721968b85d
4
main.py
4
main.py
@ -6,11 +6,11 @@ import monitors.large_transfer as lt
|
|||||||
|
|
||||||
# 监控
|
# 监控
|
||||||
schedule.every(setting.whaleAlert_minutes).minutes.do(lt.run)
|
schedule.every(setting.whaleAlert_minutes).minutes.do(lt.run)
|
||||||
|
|
||||||
schedule.every().hour.at(":00").do(vegas.run, interval = '1h')
|
schedule.every().hour.at(":00").do(vegas.run, interval = '1h')
|
||||||
|
schedule.every().hour.at(":00").do(vegas.run, interval = '4h')
|
||||||
|
|
||||||
print(f'Running... ChatID: {setting.chat_id}')
|
print(f'Running... ChatID: {setting.chat_id}')
|
||||||
while True:
|
while True:
|
||||||
schedule.run_pending()
|
schedule.run_pending()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# vegas.run('1h')
|
|
||||||
@ -4,6 +4,7 @@ import numpy as np
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import time,setting
|
import time,setting
|
||||||
import telegram_sender
|
import telegram_sender
|
||||||
|
import utils
|
||||||
|
|
||||||
|
|
||||||
api_key = "HCpeel8g6fsTK2630b7BvGBcS09Z3qfXkLVcAY2JkpaiMm1J6DWRvoQZBQlElDJg"
|
api_key = "HCpeel8g6fsTK2630b7BvGBcS09Z3qfXkLVcAY2JkpaiMm1J6DWRvoQZBQlElDJg"
|
||||||
@ -91,14 +92,14 @@ def check_signal(symbol, interval,df):
|
|||||||
if latest['longResut']==True:
|
if latest['longResut']==True:
|
||||||
direction = '多'
|
direction = '多'
|
||||||
|
|
||||||
message = f"⭐️信号提醒⭐️\r\n\r\n品种: {symbol}\r\n周期: {interval}\r\n信号: {direction}\r\n当前价格:{latest['open']}\r\n\r\n{latest['timestamp']}"
|
message = f"⭐️信号提醒⭐️\r\n\r\n品种: {symbol}\r\n周期: {interval}\r\n信号: 【{direction}】\r\n当前价格:{latest['open']}\r\n\r\n{latest['timestamp']}"
|
||||||
print(f"{symbol} - {interval} is checked!")
|
print(f"{symbol} - {interval} is checked!")
|
||||||
if direction != "":
|
if direction != "":
|
||||||
telegram_sender.send_message(setting.chat_id, message)
|
telegram_sender.send_message(setting.chat_id, message)
|
||||||
|
|
||||||
def run(interval):
|
def run(interval):
|
||||||
print('Vegas策略运行....')
|
print('Vegas策略运行....')
|
||||||
symbols= get_symbols()
|
symbols = utils.get_top_binance_usdt_pairs(20)
|
||||||
for s in symbols:
|
for s in symbols:
|
||||||
df = get_dataFrame(s, interval)
|
df = get_dataFrame(s, interval)
|
||||||
check_signal(s,interval, df)
|
check_signal(s,interval, df)
|
||||||
|
|||||||
18
test.py
18
test.py
@ -1,17 +1,7 @@
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
import utils
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print(utils.get_top_binance_usdt_pairs(30))
|
||||||
|
|
||||||
# telegram bot key
|
main()
|
||||||
telegram_bot_key='5863718864:AAFijN65_SbbGQ0WDBggzKJw2SIcZVTVrPw'
|
|
||||||
|
|
||||||
#chatid
|
|
||||||
chat_id = "@cyber4trading"
|
|
||||||
|
|
||||||
url = f'https://api.telegram.org/bot{telegram_bot_key}/sendMessage'
|
|
||||||
formData = {
|
|
||||||
"chat_id" : chat_id,
|
|
||||||
"text" : '12312'
|
|
||||||
}
|
|
||||||
|
|
||||||
requests.post(url, data= formData)
|
|
||||||
43
utils.py
Normal file
43
utils.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
# 获取市值前10的币种
|
||||||
|
def get_top_coins_by_market_cap(top):
|
||||||
|
|
||||||
|
coingecko_url = "https://api.coingecko.com/api/v3/coins/markets"
|
||||||
|
params = {
|
||||||
|
'vs_currency': 'usd',
|
||||||
|
'order': 'market_cap_desc',
|
||||||
|
'per_page': top,
|
||||||
|
'page': 1
|
||||||
|
}
|
||||||
|
response = requests.get(coingecko_url, params=params)
|
||||||
|
coins = response.json()
|
||||||
|
return coins
|
||||||
|
|
||||||
|
# 获取Binance上的USDT交易对信息
|
||||||
|
def get_binance_usdt_pairs():
|
||||||
|
url = "https://api.binance.com/api/v3/exchangeInfo"
|
||||||
|
response = requests.get(url)
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
usdt_pairs = [symbol['symbol'] for symbol in data['symbols'] if (symbol['quoteAsset'] == 'USDT' and symbol['status'] == 'TRADING')]
|
||||||
|
return usdt_pairs
|
||||||
|
|
||||||
|
def get_top_binance_usdt_pairs(top):
|
||||||
|
# 获取市值前10的币种
|
||||||
|
top_coins = get_top_coins_by_market_cap(top)
|
||||||
|
|
||||||
|
# 获取Binance上的USDT交易对
|
||||||
|
usdt_pairs = get_binance_usdt_pairs()
|
||||||
|
|
||||||
|
|
||||||
|
# 筛选出前10币种中与USDT有交易对的币种
|
||||||
|
top_pairs = []
|
||||||
|
for coin in top_coins:
|
||||||
|
coin_symbol = coin['symbol'].upper()
|
||||||
|
pair = f"{coin_symbol}USDT"
|
||||||
|
if pair in usdt_pairs:
|
||||||
|
top_pairs.append(pair)
|
||||||
|
|
||||||
|
return top_pairs
|
||||||
Loading…
Reference in New Issue
Block a user