1
This commit is contained in:
parent
5c7103fe03
commit
14e943cf2a
7
main.py
7
main.py
@ -5,6 +5,8 @@ import telegram_sender,setting
|
|||||||
import dingding
|
import dingding
|
||||||
import monitors.move as move
|
import monitors.move as move
|
||||||
|
|
||||||
|
import monitors.jin10_cal as jin10
|
||||||
|
|
||||||
from monitors import vegas, vegas_cross, macd_boll
|
from monitors import vegas, vegas_cross, macd_boll
|
||||||
|
|
||||||
#vegas
|
#vegas
|
||||||
@ -30,7 +32,10 @@ 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(macd_boll.run_crypto, interval = '4h')
|
schedule.every().day.at(t).do(macd_boll.run_crypto, interval = '4h')
|
||||||
|
|
||||||
version = 'V1.15'
|
#jin10
|
||||||
|
schedule.every().day.at("08:00").do(jin10.run)
|
||||||
|
|
||||||
|
version = 'V1.20'
|
||||||
print(f'Running... {version}')
|
print(f'Running... {version}')
|
||||||
while True:
|
while True:
|
||||||
schedule.run_pending()
|
schedule.run_pending()
|
||||||
|
|||||||
64
monitors/jin10_cal.py
Normal file
64
monitors/jin10_cal.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import requests
|
||||||
|
import datetime
|
||||||
|
import time
|
||||||
|
import discord_sender
|
||||||
|
|
||||||
|
|
||||||
|
def run():
|
||||||
|
now = datetime.date.today()
|
||||||
|
year = now.year
|
||||||
|
month = now.month
|
||||||
|
day = now.day
|
||||||
|
addtion_day = 1
|
||||||
|
|
||||||
|
items = []
|
||||||
|
|
||||||
|
while(addtion_day <= 7):
|
||||||
|
print(f'addtion_day:{addtion_day}')
|
||||||
|
day += addtion_day
|
||||||
|
addtion_day+=1
|
||||||
|
|
||||||
|
result = _get_jin10_cal_by_day(year, month, day)
|
||||||
|
items.extend(result)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
if len(items) > 0:
|
||||||
|
content = ""
|
||||||
|
|
||||||
|
for item in items:
|
||||||
|
print(item)
|
||||||
|
content += _build_content(item)
|
||||||
|
|
||||||
|
# print(content)
|
||||||
|
url = 'https://discord.com/api/webhooks/1287027684370681939/fzinKKoNK6KXoLNdj1wttSDtIGio-VHijaYzZInoajHHu-PZyZXVpWDxM6_XrxCtPrPY'
|
||||||
|
discord_sender.send_message(url, '【最近一周数据公布】',content)
|
||||||
|
|
||||||
|
|
||||||
|
def _build_content(item):
|
||||||
|
content = f"{item['name']} {item['country']} {item['time_period']}\r\n"
|
||||||
|
content += f"重要星级:"
|
||||||
|
|
||||||
|
for s in range(item['star']):
|
||||||
|
content+="★"
|
||||||
|
|
||||||
|
pub_date = datetime.datetime.strptime(item['pub_time'],'%Y-%m-%dT%H:%M:%S.%fZ') + datetime.timedelta(hours=8)
|
||||||
|
|
||||||
|
content += f"\r\n公布时间: {pub_date.strftime('%Y-%m-%d %H:%M:%S')}\r\n\r\n"
|
||||||
|
return content
|
||||||
|
|
||||||
|
def _fill_number(number):
|
||||||
|
if number<10:
|
||||||
|
return "0" + str(number)
|
||||||
|
return number
|
||||||
|
|
||||||
|
def _get_jin10_cal_by_day(year,month, day):
|
||||||
|
url = f"https://cdn-rili.jin10.com/data/{year}/{_fill_number(month)}{_fill_number(day)}/economics.json"
|
||||||
|
|
||||||
|
data = requests.get(url).json()
|
||||||
|
|
||||||
|
items = []
|
||||||
|
for item in data:
|
||||||
|
if item['star'] >= 4:
|
||||||
|
items.append(item)
|
||||||
|
|
||||||
|
return items
|
||||||
@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
import requests
|
|
||||||
import setting
|
|
||||||
import telegram_sender
|
|
||||||
|
|
||||||
|
|
||||||
# 你的Whale Alert API密钥
|
|
||||||
api_key = 'gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
|
||||||
base_url = 'https://api.whale-alert.io/v1/transactions'
|
|
||||||
|
|
||||||
def get_large_transactions(min_value=50000000):
|
|
||||||
params = {
|
|
||||||
'api_key': api_key,
|
|
||||||
'min_value': min_value
|
|
||||||
}
|
|
||||||
response = requests.get(base_url, params=params)
|
|
||||||
return response.json()
|
|
||||||
|
|
||||||
def run():
|
|
||||||
transactions = get_large_transactions()
|
|
||||||
if transactions and 'transactions' in transactions:
|
|
||||||
for ts in transactions['transactions']:
|
|
||||||
if ts['to']['owner_type'] == 'exchange':
|
|
||||||
amount = int(ts['amount'])
|
|
||||||
amount_usd = int(ts['amount_usd'])
|
|
||||||
|
|
||||||
amount_format = f'{int(amount_usd):,d}'
|
|
||||||
amount_usd_format = f'{int(amount_usd):,d}'
|
|
||||||
|
|
||||||
content = f"🚨大额链上交易提醒🚨\r\n\r\n{amount_format} #{ts['symbol']} (价值: {amount_usd_format} USD) 从 {ts['from']['owner']} 转入 {ts['to']['owner']}"
|
|
||||||
|
|
||||||
print(content)
|
|
||||||
telegram_sender.send_message(setting.chat_id, content)
|
|
||||||
@ -68,7 +68,7 @@ def stratergy_run(symbol, interval, df, debug):
|
|||||||
def run_crypto(interval, debug=False):
|
def run_crypto(interval, debug=False):
|
||||||
print('Vegas策略运行.')
|
print('Vegas策略运行.')
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
for s in crypto.get_future_symbols():
|
for s in setting.future_sysmbols:
|
||||||
df = crypto.get_klines(s, interval, True)
|
df = crypto.get_klines(s, interval, True)
|
||||||
stratergy_run(s,interval, df, debug)
|
stratergy_run(s,interval, df, debug)
|
||||||
|
|
||||||
|
|||||||
@ -9,3 +9,4 @@ chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading")
|
|||||||
|
|
||||||
#
|
#
|
||||||
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT']
|
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT']
|
||||||
|
future_sysmbols = ["BTCUSD_PERP","ETHUSD_PERP","BNBUSD_PERP","BCHUSD_PERP","DOGEUSD_PERP","UNIUSD_PERP","SOLUSD_PERP","FTMUSD_PERP"]
|
||||||
6
test.py
6
test.py
@ -5,19 +5,21 @@ 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 monitors import vegas_cross, jin10_cal
|
||||||
from datasource import crypto
|
from datasource import crypto
|
||||||
from monitors import macd_boll
|
from monitors import macd_boll
|
||||||
import datasource
|
import datasource
|
||||||
from binance.cm_futures import CMFutures
|
from binance.cm_futures import CMFutures
|
||||||
|
|
||||||
|
|
||||||
# client = CMFutures()
|
# client = CMFutures()
|
||||||
# print(client.exchange_info()['symbols'])
|
# print(client.exchange_info()['symbols'])
|
||||||
|
|
||||||
# print(datasource.crypto.get_future_symbols())
|
# print(datasource.crypto.get_future_symbols())
|
||||||
|
|
||||||
macd_boll.run_crypto('15m', debug=True)
|
# macd_boll.run_crypto('15m', debug=True)
|
||||||
|
|
||||||
|
jin10_cal.run()
|
||||||
|
|
||||||
# print(crypto._get_top_coins_by_market_cap(20))
|
# print(crypto._get_top_coins_by_market_cap(20))
|
||||||
# vegas_cross.run_crypto('1h')
|
# vegas_cross.run_crypto('1h')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user