1
This commit is contained in:
parent
2cf07ccba9
commit
c19cee123e
3
main.py
3
main.py
@ -5,8 +5,7 @@ import time
|
|||||||
import signals.ma_arrangement as maa
|
import signals.ma_arrangement as maa
|
||||||
import monitors.large_transfer as lt
|
import monitors.large_transfer as lt
|
||||||
|
|
||||||
# 获取交易所交易对
|
symbols = ['BTCUSDT','ETHUSDT','FILUSDT','MASKUSDT','DOGEUSDT','CFXUSDT','LTCUSDT']
|
||||||
symbols = bn.symbols()
|
|
||||||
|
|
||||||
for s in symbols:
|
for s in symbols:
|
||||||
#15m
|
#15m
|
||||||
|
|||||||
@ -18,4 +18,4 @@ oklink_api_headers = {
|
|||||||
#whaleAlert
|
#whaleAlert
|
||||||
whaleAlert_minutes=1
|
whaleAlert_minutes=1
|
||||||
whaleAlert_apikey='gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
whaleAlert_apikey='gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
||||||
whaleAlert_max_limit = os.getenv('TQ_WHALEALERT_MAX_USD_AMOUNT',1000 * 10000)
|
whaleAlert_max_limit = os.getenv('TQ_WHALEALERT_MAX_USD_AMOUNT',5000 * 10000)
|
||||||
@ -5,11 +5,12 @@ import tg
|
|||||||
import datetime
|
import datetime
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
flags = {}
|
||||||
|
|
||||||
def check_ma_arrange(data):
|
def check_ma_arrange(data):
|
||||||
# 提取收盘价
|
# 提取收盘价
|
||||||
close_prices = np.array([float(entry[4]) for entry in data])
|
close_prices = np.array([float(entry[4]) for entry in data])
|
||||||
|
|
||||||
# 计算移动平均线
|
# 计算移动平均线
|
||||||
ema7 = talib.EMA(close_prices, timeperiod=7)
|
ema7 = talib.EMA(close_prices, timeperiod=7)
|
||||||
ema30 = talib.EMA(close_prices, timeperiod=30)
|
ema30 = talib.EMA(close_prices, timeperiod=30)
|
||||||
@ -20,7 +21,7 @@ def check_ma_arrange(data):
|
|||||||
bearish = ema7[-1] < ema30[-1] < ema100[-1] < ema200[-1]
|
bearish = ema7[-1] < ema30[-1] < ema100[-1] < ema200[-1]
|
||||||
|
|
||||||
return bullish, bearish
|
return bullish, bearish
|
||||||
|
|
||||||
|
|
||||||
def run(symbol, interval):
|
def run(symbol, interval):
|
||||||
# 获取kline数据
|
# 获取kline数据
|
||||||
@ -28,12 +29,15 @@ def run(symbol, interval):
|
|||||||
|
|
||||||
bullish, bearish = check_ma_arrange(data)
|
bullish, bearish = check_ma_arrange(data)
|
||||||
|
|
||||||
text=""
|
flag_name = symbol + '_' + interval
|
||||||
if bullish:
|
text = ""
|
||||||
|
if bullish and (flag_name not in flags or flags[flag_name] == False):
|
||||||
|
flags[flag_name] = True
|
||||||
text = f'📶信号预警📶\r\n\r\n品种:【${symbol}】\r\n周期:{interval}\r\n信号:【多头】排列\r\n\r\n{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}'
|
text = f'📶信号预警📶\r\n\r\n品种:【${symbol}】\r\n周期:{interval}\r\n信号:【多头】排列\r\n\r\n{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}'
|
||||||
if bearish:
|
if bearish and (flag_name not in flags or flags[flag_name] == True):
|
||||||
|
flags[flag_name] = False
|
||||||
text = f'📶信号预警📶\r\n\r\n品种:【${symbol}】\r\n周期:{interval}\r\n信号:【空头】排列\r\n\r\n{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}'
|
text = f'📶信号预警📶\r\n\r\n品种:【${symbol}】\r\n周期:{interval}\r\n信号:【空头】排列\r\n\r\n{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}'
|
||||||
|
|
||||||
if text != "":
|
if text != "":
|
||||||
print(text)
|
print(text)
|
||||||
tg.send_message(settings.chat_id, text)
|
tg.send_message(settings.chat_id, text)
|
||||||
12
test.py
12
test.py
@ -3,13 +3,7 @@ import pandas as pd
|
|||||||
import mplfinance as mpf
|
import mplfinance as mpf
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import monitors.large_transfer as lt
|
import monitors.large_transfer as lt
|
||||||
|
from binance.spot import Spot
|
||||||
|
|
||||||
|
symbols = bn.symbols()
|
||||||
klines = bn.klines('BTCUSDT', '1h', limit=10)
|
print(symbols)
|
||||||
|
|
||||||
# print(klines[0])
|
|
||||||
|
|
||||||
# print(klines[0][0])
|
|
||||||
dt = dt.datetime.fromtimestamp((klines[-1][0]/1000))
|
|
||||||
|
|
||||||
print(dt)
|
|
||||||
Loading…
Reference in New Issue
Block a user