Compare commits
109 Commits
release-v0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afd9820a94 | ||
|
|
959b13e2af | ||
|
|
a5375c2edd | ||
|
|
6829b2a2c8 | ||
|
|
5529278254 | ||
|
|
150d25e7a2 | ||
|
|
44ffcfdcca | ||
|
|
cd5fcc2882 | ||
|
|
5f9788ba90 | ||
|
|
1d0e259a3d | ||
|
|
09e524fd18 | ||
|
|
e7ccad634c | ||
|
|
671d8d956a | ||
|
|
594750273e | ||
|
|
c619cf3275 | ||
|
|
192454d476 | ||
|
|
99b8d07c81 | ||
|
|
d467c9be90 | ||
|
|
d69261446e | ||
|
|
e93ec6516c | ||
|
|
fdb3423f29 | ||
|
|
2c359e42a8 | ||
|
|
a9477ea187 | ||
|
|
0b34231b54 | ||
|
|
f6bc443785 | ||
|
|
90b7bea4e8 | ||
|
|
f575c665af | ||
|
|
14e943cf2a | ||
|
|
5c7103fe03 | ||
|
|
26153a8341 | ||
|
|
ee7d8f6a58 | ||
|
|
2e1f709fd0 | ||
|
|
9e8bb4387c | ||
|
|
736f3bf59b | ||
|
|
830b9f93d3 | ||
|
|
16808eceba | ||
|
|
d385863e12 | ||
|
|
c16a54fb0d | ||
|
|
d45d415eac | ||
|
|
9d309a38d2 | ||
|
|
da3c2836c0 | ||
|
|
f7cac309fc | ||
|
|
9b6e0931cb | ||
|
|
85a7b73f36 | ||
|
|
7b34e6cd4a | ||
|
|
fbbf48b8f1 | ||
|
|
ee14d2249f | ||
|
|
2a6ee8a6b9 | ||
|
|
74f782454f | ||
|
|
c1f2b1727a | ||
|
|
3552dd8918 | ||
|
|
39e3814c69 | ||
|
|
47aba3bc64 | ||
|
|
44b18a33aa | ||
|
|
89fb681d02 | ||
|
|
9a23417e84 | ||
|
|
b3826f99a5 | ||
|
|
16ee95d585 | ||
|
|
48668406f2 | ||
|
|
69dac8e5c2 | ||
|
|
56679a2b81 | ||
|
|
471cf10a02 | ||
|
|
1629c4e943 | ||
|
|
51d5ebb450 | ||
|
|
373f8c96ff | ||
|
|
73caaffef8 | ||
|
|
6a7d1253c3 | ||
|
|
645318bfc6 | ||
|
|
7a544b3bed | ||
|
|
8e058603ff | ||
|
|
94ca608033 | ||
|
|
e2c8ee1594 | ||
|
|
b8180a843b | ||
|
|
8995266ee1 | ||
|
|
721968b85d | ||
|
|
6decd1b4db | ||
|
|
7b1a20567f | ||
|
|
0dd5ca80a3 | ||
|
|
66ce3a5e36 | ||
|
|
1e607675d3 | ||
|
|
d4857350c9 | ||
|
|
bf63933285 | ||
|
|
89d274e1c5 | ||
|
|
c16615ee87 | ||
|
|
876eb90190 | ||
|
|
9ed369fdcf | ||
|
|
a790c459ee | ||
|
|
d356bf86c0 | ||
|
|
5ebde1e8f4 | ||
|
|
4efcbb95e9 | ||
|
|
53f1dcef4b | ||
|
|
4f65909ff2 | ||
|
|
69387a5d40 | ||
|
|
c46aafe88e | ||
|
|
4742dcabce | ||
|
|
12eb33b892 | ||
|
|
8436a79841 | ||
|
|
4a9ed156b6 | ||
|
|
2412a633bd | ||
|
|
2166764cae | ||
|
|
3ea7247f53 | ||
|
|
c50f10db53 | ||
|
|
d687d72ae9 | ||
|
|
fe3a0f3e07 | ||
|
|
255bcb3a25 | ||
|
|
c19cee123e | ||
|
|
2cf07ccba9 | ||
|
|
6dbfa2646c | ||
|
|
dbc0f96e7c |
43
Dockerfile
43
Dockerfile
@ -1,43 +1,10 @@
|
||||
FROM veejar/python-ta-lib
|
||||
FROM dockerproxy.com/veejar/python-ta-lib
|
||||
ENV PYTHONIOENCODING=utf-8
|
||||
ENV TIME_ZONE Asia/Shanghai
|
||||
|
||||
# # 更新apt-get源
|
||||
# RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
|
||||
# echo > /etc/apt/sources.list && \
|
||||
# cat /etc/apt/sources.list && \
|
||||
# echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list && \
|
||||
# echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list && \
|
||||
# echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list && \
|
||||
# echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list
|
||||
|
||||
# RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
# ENV APT_PKG_TEMPORARY="build-essential autoconf automake autotools-dev libopenblas-dev python3-dev"
|
||||
# ENV APT_PKG="python3 python3-pip python3-scipy python3-numpy python3-pandas python-is-python3"
|
||||
# ENV PYPI_PKG="TA-Lib numpy pandas"
|
||||
# ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# COPY ta-lib ./ta-lib
|
||||
|
||||
# RUN apt-get update && apt-get upgrade -y && \
|
||||
# apt-get install -y ${APT_PKG_TEMPORARY} ${APT_PKG} && \
|
||||
# ln -s /usr/include/locale.h /usr/include/xlocale.h && \
|
||||
# # compile TA-Lib library
|
||||
# cd ta-lib && \
|
||||
# ./configure --prefix=/usr; \
|
||||
# make && \
|
||||
# make install && \
|
||||
# cd .. && \
|
||||
# rm -rf ta-lib && \
|
||||
# \
|
||||
# pip3 install --no-cache-dir $PYPI_PKG && \
|
||||
# apt-get autoremove -y ${APT_PKG_TEMPORARY} && \
|
||||
# rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ binance binance_connector numpy requests schedule TA_Lib
|
||||
# RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ binance binance_connector requests schedule
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
WORKDIR /opt/
|
||||
COPY ["./", "/opt/"]
|
||||
|
||||
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
|
||||
|
||||
CMD python3 -u main.py
|
||||
19
bn.py
19
bn.py
@ -1,19 +0,0 @@
|
||||
from binance.spot import Spot
|
||||
|
||||
client = Spot()
|
||||
|
||||
# Get klines
|
||||
def klines(symbol, interval):
|
||||
lines = client.klines(symbol,interval)
|
||||
return lines
|
||||
|
||||
# Get Symbols
|
||||
def symbols():
|
||||
info = client.exchange_info()
|
||||
|
||||
symbols = []
|
||||
for s in info['symbols']:
|
||||
if s['symbol'].endswith('USDT'):
|
||||
symbols.append(s['symbol'])
|
||||
|
||||
return symbols
|
||||
106
datasource/crypto.py
Normal file
106
datasource/crypto.py
Normal file
@ -0,0 +1,106 @@
|
||||
import requests
|
||||
from binance.spot import Spot
|
||||
import pandas as pd
|
||||
from binance.um_futures import UMFutures
|
||||
|
||||
import urllib3
|
||||
|
||||
api_key = "HCpeel8g6fsTK2630b7BvGBcS09Z3qfXkLVcAY2JkpaiMm1J6DWRvoQZBQlElDJg"
|
||||
api_secret= "TySs6onlHOTrGzV8fMdDxLKTWWYnQ4rCHVAmjrcHby17acKflmo7xVTWVsbqtxe7"
|
||||
|
||||
client = Spot(api_key, api_secret)
|
||||
future_client = UMFutures(api_key, api_secret)
|
||||
|
||||
# 获取市值前top的币种
|
||||
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
|
||||
}
|
||||
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
|
||||
response = requests.get(coingecko_url, params=params, verify=False)
|
||||
coins = response.json()
|
||||
return coins
|
||||
|
||||
# 获取Binance上的USDT交易对信息
|
||||
def _get_binance_usdt_pairs():
|
||||
url = "https://api.binance.com/api/v3/exchangeInfo"
|
||||
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
|
||||
response = requests.get(url, verify=False)
|
||||
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
|
||||
|
||||
## 获取所有现货交易对
|
||||
def get_symbols():
|
||||
data = client.exchange_info()["symbols"]
|
||||
|
||||
# 创建DataFrame
|
||||
columns = ['symbol', 'status', 'baseAsset', 'quoteAsset']
|
||||
df = pd.DataFrame(data, columns=columns)
|
||||
df = df[(df['status'] == 'TRADING') & (df['quoteAsset'] == 'USDT')]
|
||||
|
||||
return df['symbol']
|
||||
|
||||
def get_future_symbols():
|
||||
data = future_client.exchange_info()["symbols"]
|
||||
|
||||
# 创建DataFrame
|
||||
columns = ['symbol', 'status','contractType', 'baseAsset', 'quoteAsset']
|
||||
df = pd.DataFrame(data, columns=columns)
|
||||
# 过滤出交易对
|
||||
df = df[(df['status'] == 'TRADING') & (df['contractType'] == 'PERPETUAL')]
|
||||
|
||||
return df['symbol']
|
||||
|
||||
## 根据交易对和周期获取数据集
|
||||
def get_klines(symbol,interval, future = False,limit=1000):
|
||||
# 获取 k 线数据
|
||||
data = {}
|
||||
if future == True:
|
||||
data = future_client.klines(symbol, interval, limit=limit)
|
||||
else:
|
||||
data = client.klines(symbol, interval,limit=limit)
|
||||
|
||||
# 将数据转换为DataFrame
|
||||
columns = ['timestamp', 'open', 'high', 'low', 'close', 'volume',
|
||||
'close_time', 'quote_asset_volume', 'number_of_trades',
|
||||
'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume', 'ignore']
|
||||
|
||||
df = pd.DataFrame(data, columns=columns)
|
||||
|
||||
# 转化成 float
|
||||
df['open'] = df['open'].astype('float64')
|
||||
df['high'] = df['high'].astype('float64')
|
||||
df['low'] = df['low'].astype('float64')
|
||||
df['close'] = df['close'].astype('float64')
|
||||
df['volume'] = df['volume'].astype('float64')
|
||||
|
||||
# 将时间戳转换为日期时间格式
|
||||
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms', utc=True).map(lambda x: x.tz_convert('Asia/Shanghai'))
|
||||
df['close_time'] = pd.to_datetime(df['close_time'], unit='ms', utc=True).map(lambda x: x.tz_convert('Asia/Shanghai'))
|
||||
|
||||
return df
|
||||
19
dingding.py
Normal file
19
dingding.py
Normal file
@ -0,0 +1,19 @@
|
||||
import requests
|
||||
import setting
|
||||
import urllib3
|
||||
|
||||
url = 'https://oapi.dingtalk.com/robot/send?access_token=2278b723cd363bb6f85592c743b59b166e70b9e02a275bb5cedbc33b53a5cbdc'
|
||||
|
||||
# 发送消息
|
||||
def send_message(text, isAtAll = False):
|
||||
formData = {
|
||||
"msgtype": "text",
|
||||
"text": {
|
||||
"content": text
|
||||
},
|
||||
"at": {
|
||||
"isAtAll": isAtAll
|
||||
}
|
||||
}
|
||||
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
|
||||
print(requests.post(url, json=formData, verify=False).json())
|
||||
10
discord_sender.py
Normal file
10
discord_sender.py
Normal file
@ -0,0 +1,10 @@
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
|
||||
def send_message(url,title,content):
|
||||
webhook = DiscordWebhook(url)
|
||||
|
||||
embed = DiscordEmbed(title=title, description=content, color="03b2f8")
|
||||
|
||||
webhook.add_embed(embed)
|
||||
|
||||
response = webhook.execute()
|
||||
69
main.py
69
main.py
@ -1,35 +1,58 @@
|
||||
import schedule
|
||||
import bn
|
||||
import settings
|
||||
import time
|
||||
import strategy.crossover as crossover
|
||||
import strategy.large_trans as lt
|
||||
import dingding
|
||||
import monitors.jin10_cal as jin10
|
||||
|
||||
# 获取交易所交易对
|
||||
# symbols = bn.symbols()
|
||||
|
||||
# for s in symbols:
|
||||
# 5m
|
||||
# schedule.every(settings.whaleAlert_minutes).minutes.do(lt.strategy_run)
|
||||
from monitors import macd_boll,vol_up
|
||||
# from plombery import task, get_logger, Trigger, register_pipeline
|
||||
|
||||
|
||||
# 5m
|
||||
# schedule.every(5).minutes.do(crossover.strategy_run, symbol=s, interval='5m')
|
||||
#vegas
|
||||
# schedule.every().hour.at(":00").do(vegas.run_crypto, interval = '1h')
|
||||
# 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')
|
||||
|
||||
# 30m
|
||||
# schedule.every(30).minutes.do(crossover.strategy_run, symbol=s, interval='30m')
|
||||
|
||||
# 1h
|
||||
# schedule.every(1).hours.do(crossover.strategy_run, symbol=s, interval='1h')
|
||||
|
||||
# 4h
|
||||
# schedule.every(4).hours.do(crossover.strategy_run, symbol=s, interval='4h')
|
||||
#vegas_cross
|
||||
# schedule.every().hour.at(":00").do(vegas_cross.run_crypto, interval = '1h')
|
||||
# times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
|
||||
# for t in times:
|
||||
# schedule.every().day.at(t).do(vegas_cross.run_crypto, interval = '4h')
|
||||
|
||||
|
||||
# 监控
|
||||
schedule.every(settings.whaleAlert_minutes).minutes.do(lt.strategy_run)
|
||||
# register_pipeline(tasks=[vol_up.run_crypto('15')], triggers=[Trigger()])
|
||||
|
||||
print(f'Running... ChatID: {settings.chat_id}')
|
||||
|
||||
|
||||
#vol
|
||||
schedule.every(5).minutes.do(vol_up.run_crypto, interval = '5m')
|
||||
|
||||
schedule.every().hour.at(":00").do(vol_up.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":15").do(vol_up.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":30").do(vol_up.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":45").do(vol_up.run_crypto, interval = '15m')
|
||||
|
||||
schedule.every().hour.at(":00").do(vol_up.run_crypto, interval = '1h')
|
||||
|
||||
|
||||
#macd_boll
|
||||
schedule.every().hour.at(":00").do(macd_boll.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":15").do(macd_boll.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":30").do(macd_boll.run_crypto, interval = '15m')
|
||||
schedule.every().hour.at(":45").do(macd_boll.run_crypto, interval = '15m')
|
||||
|
||||
schedule.every().hour.at(":00").do(macd_boll.run_crypto, interval = '1h')
|
||||
times = ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"]
|
||||
for t in times:
|
||||
schedule.every().day.at(t).do(macd_boll.run_crypto, interval = '4h')
|
||||
|
||||
#jin10
|
||||
schedule.every().day.at("09:00").do(jin10.run)
|
||||
|
||||
version = 'V1.4'
|
||||
text = f'☕️ Signals running... {version} !'
|
||||
print(text)
|
||||
dingding.send_message(text)
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(1)
|
||||
72
monitors/jin10_cal.py
Normal file
72
monitors/jin10_cal.py
Normal file
@ -0,0 +1,72 @@
|
||||
import requests
|
||||
import datetime
|
||||
import time
|
||||
import discord_sender,dingding
|
||||
|
||||
|
||||
def run():
|
||||
print('金 10 数据数据日历数据抓取...')
|
||||
|
||||
addtion_day = 1
|
||||
|
||||
items = []
|
||||
|
||||
while(addtion_day <= 7):
|
||||
data_day = datetime.datetime.now() + datetime.timedelta(days=addtion_day)
|
||||
addtion_day = addtion_day + 1
|
||||
|
||||
result = _get_jin10_cal_by_day(data_day.year, data_day.month, data_day.day)
|
||||
items.extend(result)
|
||||
time.sleep(1)
|
||||
|
||||
if len(items) > 0:
|
||||
content = ""
|
||||
|
||||
for item in items:
|
||||
print(item)
|
||||
content += _build_content(item)
|
||||
|
||||
print(content)
|
||||
|
||||
dingding.send_message(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"
|
||||
|
||||
if item['previous'] != None:
|
||||
content += f"前值: {item['previous']}\r\n"
|
||||
|
||||
if item['consensus'] != None:
|
||||
content += f"预测值: {item['consensus']}\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"
|
||||
print(url)
|
||||
data = requests.get(url).json()
|
||||
|
||||
items = []
|
||||
for item in data:
|
||||
if item['star'] >= 4:
|
||||
items.append(item)
|
||||
|
||||
return items
|
||||
79
monitors/macd_boll.py
Normal file
79
monitors/macd_boll.py
Normal file
@ -0,0 +1,79 @@
|
||||
import talib
|
||||
import numpy as np
|
||||
import time,setting
|
||||
import telegram_sender
|
||||
from datasource import crypto
|
||||
import dingding
|
||||
import discord_sender
|
||||
|
||||
|
||||
# crossover 函数:检测上穿信号
|
||||
def crossover(series1, series2):
|
||||
return (series1 > series2) & (series1.shift(1) <= series2.shift(1))
|
||||
|
||||
# crossunder 函数:检测下穿信号
|
||||
def crossunder(series1, series2):
|
||||
return (series1 < series2) & (series1.shift(1) >= series2.shift(1))
|
||||
|
||||
## 检查信号
|
||||
def stratergy_run(symbol, interval, df, debug):
|
||||
|
||||
macd_fast_length = 12
|
||||
macd_slow_length = 26
|
||||
macd_signal_length = 9
|
||||
bollinger_length = 20
|
||||
bollinger_mult = 2.0
|
||||
|
||||
# 计算EMA 144, 200
|
||||
fast_ema = talib.EMA(df['close'], timeperiod=144)
|
||||
slow_ema = talib.EMA(df['close'], timeperiod=200)
|
||||
|
||||
# 计算 MACD
|
||||
macd, macd_signal, macd_hist = talib.MACD(df['close'], fastperiod=macd_fast_length, slowperiod=macd_slow_length, signalperiod=macd_signal_length)
|
||||
|
||||
# 计算布林带
|
||||
upperband, middleband, lowerband = talib.BBANDS(df['close'], timeperiod=bollinger_length, nbdevup=bollinger_mult, nbdevdn=bollinger_mult, matype=0)
|
||||
|
||||
# 生成交易信号
|
||||
long_condition = (macd.shift(1) <= 0) & (macd > 0) & (df['high'] < upperband) & ((df['close'] > fast_ema) | (df['close'] > slow_ema))
|
||||
short_condition = (macd.shift(1) >= 0) & (macd < 0) & (df['low'] > lowerband) & ((df['close'] < fast_ema) | (df['close'] < slow_ema))
|
||||
|
||||
|
||||
df['Long_Signal'] = np.where(long_condition, True, False)
|
||||
df['Short_Signal'] = np.where(short_condition,True, False)
|
||||
|
||||
latest = df.iloc[-2]
|
||||
print(f"【{symbol} - {interval}】 is checked!")
|
||||
|
||||
direction = ""
|
||||
if latest['Short_Signal'] == True:
|
||||
direction = '空'
|
||||
if latest['Long_Signal'] == True:
|
||||
direction = '多'
|
||||
if direction != "":
|
||||
message = '🦄Signals Notificaiton🦄\r\n\r\n'
|
||||
message += f"策略:【MACD+BOLL策略V1.1】\r\n"
|
||||
message += f"品种: {symbol}\r\n"
|
||||
message += f"周期: {interval}\r\n"
|
||||
message += f"信号: 【{direction}】\r\n"
|
||||
message += f"收盘价: {latest['close']}\r\n"
|
||||
|
||||
if debug == False:
|
||||
# url = 'https://discordapp.com/api/webhooks/1286585288986198048/iQ-yr26ViW45GM48ql8rPu70Iumqcmn_XXAmxAcKGeiQBmTQoDPeq-TmlChvIHkw_HJ-'
|
||||
# discord_sender.send_message(url,'🦄信号提醒🦄',message)
|
||||
|
||||
dingding.send_message(message)
|
||||
|
||||
print(f"【{symbol} - {interval}】 is singal fired!")
|
||||
else:
|
||||
print(message)
|
||||
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
print('MACD+BOLL is running...')
|
||||
time.sleep(5)
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval, True)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
time.sleep(1)
|
||||
63
monitors/move.py
Normal file
63
monitors/move.py
Normal file
@ -0,0 +1,63 @@
|
||||
import talib
|
||||
import time,setting
|
||||
import telegram_sender
|
||||
from datasource import crypto
|
||||
import dingding
|
||||
import discord_sender
|
||||
import setting
|
||||
|
||||
|
||||
# crossover 函数:检测上穿信号
|
||||
def crossover(series1, series2):
|
||||
return (series1 > series2) and (series1.shift(1) <= series2.shift(1))
|
||||
|
||||
# crossunder 函数:检测下穿信号
|
||||
def crossunder(series1, series2):
|
||||
return (series1 < series2) and (series1.shift(1) >= series2.shift(1))
|
||||
|
||||
## 检查信号
|
||||
def stratergy_run(symbol, interval, df, debug):
|
||||
maxDifference = 0.005
|
||||
|
||||
## 计算 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['priceCheck'] = ((df['longDiff'] <= maxDifference) & (df['midDiff'] <= maxDifference) & (df['shortDiff'] <= maxDifference))
|
||||
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]
|
||||
|
||||
maxDiff = max(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
minDiff = min(d1['shortDiff'], d1['midDiff'], d1['longDiff'])
|
||||
|
||||
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):
|
||||
message = f"策略:【均线排列信号】\r\n"
|
||||
message += f"品种: {symbol}\r\n"
|
||||
message += f"周期: {interval}\r\n"
|
||||
message += f"信号: 【{'多' if isbullish else '空'}】\r\n"
|
||||
message += f"收盘价: {d1['close']}\r\n"
|
||||
|
||||
url = 'https://discordapp.com/api/webhooks/1285867836454998077/JNAFUyur_ygOJIh6C4beUAVYMpm1TZf4IEeMn8Q1p0TglO1Hjyiu2LQqiU5AxVovWyiO'
|
||||
discord_sender.send_message(url,'🦄信号提醒🦄',message)
|
||||
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
time.sleep(1)
|
||||
73
monitors/vegas.py
Normal file
73
monitors/vegas.py
Normal file
@ -0,0 +1,73 @@
|
||||
import talib
|
||||
import numpy as np
|
||||
import time,setting
|
||||
import telegram_sender
|
||||
from datasource import crypto
|
||||
import dingding
|
||||
import discord_sender
|
||||
|
||||
|
||||
# crossover 函数:检测上穿信号
|
||||
def crossover(series1, series2):
|
||||
return (series1 > series2) & (series1.shift(1) <= series2.shift(1))
|
||||
|
||||
# crossunder 函数:检测下穿信号
|
||||
def crossunder(series1, series2):
|
||||
return (series1 < series2) & (series1.shift(1) >= series2.shift(1))
|
||||
|
||||
## 检查信号
|
||||
def stratergy_run(symbol, interval, df, debug):
|
||||
## 计算 ema
|
||||
df['ema13'] = talib.EMA(df['close'], timeperiod=13)
|
||||
df['ema144'] = talib.EMA(df['close'], timeperiod=144)
|
||||
df['ema169'] = talib.EMA(df['close'], timeperiod=169)
|
||||
df['ema576'] = talib.EMA(df['close'], timeperiod=576)
|
||||
df['ema676'] = talib.EMA(df['close'], timeperiod=676)
|
||||
|
||||
maxline = np.maximum(df['ema144'], df['ema169'])
|
||||
minline = np.minimum(df['ema144'], df['ema169'])
|
||||
|
||||
shortArragement = df['ema13'] < minline
|
||||
longArrangement = df['ema13'] > maxline
|
||||
confuse = (df['ema13'] >= minline) & (df['ema13'] <= maxline)
|
||||
crossRatio = 0.2
|
||||
|
||||
shortA = crossunder(df['ema13'], minline)
|
||||
shortB = shortArragement & crossunder(df['close'], minline) & (((minline - df['close']) / df.apply(lambda x: abs(x['open'] - x['close']), axis=1)) > crossRatio)
|
||||
df['shortResut'] = (shortA | shortB) & (confuse == False)
|
||||
|
||||
longA = crossover(df['ema13'], maxline)
|
||||
longB = longArrangement & crossover(df['close'], maxline) & (((df['close'] - maxline) / df.apply(lambda x: abs(x['open'] - x['close']), axis=1)) > crossRatio)
|
||||
df['longResut'] = (longA | longB) & (confuse == False)
|
||||
|
||||
latest = df.iloc[-1]
|
||||
|
||||
direction = ""
|
||||
if latest['shortResut']==True:
|
||||
direction = '空'
|
||||
if latest['longResut']==True:
|
||||
direction = '多'
|
||||
|
||||
message = f"策略:【Vegas反转策略】\r\n"
|
||||
message += f"品种: {symbol}\r\n"
|
||||
message += f"周期: {interval}\r\n"
|
||||
message += f"信号: 【{direction}】\r\n"
|
||||
message += f"收盘价: {latest['close']}\r\n"
|
||||
|
||||
print(f"【{symbol} - {interval}】 is checked!")
|
||||
if direction != "":
|
||||
if debug == False:
|
||||
url = 'https://discordapp.com/api/webhooks/1285867836454998077/JNAFUyur_ygOJIh6C4beUAVYMpm1TZf4IEeMn8Q1p0TglO1Hjyiu2LQqiU5AxVovWyiO'
|
||||
discord_sender.send_message(url,'🦄信号提醒🦄',message)
|
||||
|
||||
print(f"【{symbol} - {interval}】 is singal fired!")
|
||||
else:
|
||||
print(message)
|
||||
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
time.sleep(1)
|
||||
65
monitors/vegas_cross.py
Normal file
65
monitors/vegas_cross.py
Normal file
@ -0,0 +1,65 @@
|
||||
import talib
|
||||
import numpy as np
|
||||
import time,setting
|
||||
import telegram_sender
|
||||
from datasource import crypto
|
||||
import dingding
|
||||
import discord_sender
|
||||
import setting
|
||||
|
||||
|
||||
# crossover 函数:检测上穿信号
|
||||
def crossover(series1, series2):
|
||||
return (series1 > series2) & (series1.shift(1) <= series2.shift(1))
|
||||
|
||||
# crossunder 函数:检测下穿信号
|
||||
def crossunder(series1, series2):
|
||||
return (series1 < series2) & (series1.shift(1) >= series2.shift(1))
|
||||
|
||||
## 检查信号
|
||||
def stratergy_run(symbol, interval, df, debug):
|
||||
## 计算 ema
|
||||
df['ema144'] = talib.EMA(df['close'], timeperiod=144)
|
||||
df['ema169'] = talib.EMA(df['close'], timeperiod=169)
|
||||
df['ema576'] = talib.EMA(df['close'], timeperiod=576)
|
||||
df['ema676'] = talib.EMA(df['close'], timeperiod=676)
|
||||
|
||||
max_low_line = np.maximum(df['ema144'], df['ema169'])
|
||||
min_low_line = np.minimum(df['ema144'], df['ema169'])
|
||||
|
||||
max_high_line = np.maximum(df['ema576'], df['ema676'])
|
||||
min_high_line = np.minimum(df['ema576'], df['ema676'])
|
||||
|
||||
df['longSignal'] = crossover(min_low_line, max_high_line)
|
||||
df['shortSignal'] = crossunder(max_low_line, min_high_line)
|
||||
|
||||
latest = df.iloc[-1]
|
||||
direction = ""
|
||||
if latest['shortSignal']==True:
|
||||
direction = '空'
|
||||
if latest['longSignal']==True:
|
||||
direction = '多'
|
||||
|
||||
message = f"策略:【Vegas金叉死叉策略】\r\n"
|
||||
message += f"品种: {symbol}\r\n"
|
||||
message += f"周期: {interval}\r\n"
|
||||
message += f"信号: 【{direction}】\r\n"
|
||||
message += f"收盘价: {latest['close']}\r\n"
|
||||
|
||||
print(f"【{symbol} - {interval}】 is checked!")
|
||||
if direction != "":
|
||||
if debug == False:
|
||||
url = 'https://discordapp.com/api/webhooks/1285867836454998077/JNAFUyur_ygOJIh6C4beUAVYMpm1TZf4IEeMn8Q1p0TglO1Hjyiu2LQqiU5AxVovWyiO'
|
||||
discord_sender.send_message(url,'🦄信号提醒🦄',message)
|
||||
|
||||
print(f"【{symbol} - {interval}】 is singal fired!")
|
||||
else:
|
||||
print(message)
|
||||
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval,True)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
time.sleep(1)
|
||||
37
monitors/vol_up.py
Normal file
37
monitors/vol_up.py
Normal file
@ -0,0 +1,37 @@
|
||||
# 突然放量策略
|
||||
import numpy as np
|
||||
from datasource import crypto
|
||||
import time, dingding
|
||||
|
||||
def stratergy_run(symbol, interval, df, debug):
|
||||
# 计算过去 30 根 K 线的平均交易量
|
||||
average_volume = df["volume"].iloc[-31:-1].mean() # 倒数第 31 到倒数第 2 根的平均
|
||||
|
||||
# 获取当前(最后一根,即第 500 根)交易量
|
||||
current_volume = df["volume"].iloc[-1]
|
||||
|
||||
timestamp = df['timestamp'].iloc[-1]
|
||||
|
||||
rate = current_volume / average_volume
|
||||
|
||||
rate_limit = 10
|
||||
if rate > rate_limit:
|
||||
message = "📢Signals Notificaiton📢\r\n\r\n"
|
||||
message += f"{symbol} 在 {interval} 出现放量 {round(rate, 2)}倍 !\r\n\r\n"
|
||||
message += f"{timestamp}"
|
||||
|
||||
if debug == False:
|
||||
dingding.send_message(message)
|
||||
print(f"【{symbol} - {interval}】 is singal fired!")
|
||||
else:
|
||||
print(message)
|
||||
|
||||
def run_crypto(interval, debug=False):
|
||||
print(f"Vols-up strategy {interval} is running...")
|
||||
|
||||
symbols = crypto.get_future_symbols()
|
||||
for s in symbols:
|
||||
df = crypto.get_klines(s, interval, True,limit=50)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
time.sleep(1)
|
||||
@ -1,6 +1,10 @@
|
||||
binance==0.3
|
||||
binance_connector==3.1.0
|
||||
numpy==1.23.4
|
||||
requests==2.28.1
|
||||
schedule==1.1.0
|
||||
TA_Lib==0.4.26
|
||||
binance
|
||||
binance_connector
|
||||
binance-futures-connector
|
||||
numpy==1.26.4
|
||||
pandas
|
||||
requests
|
||||
schedule
|
||||
tweepy
|
||||
discord_webhook
|
||||
redis
|
||||
14
setting.py
Normal file
14
setting.py
Normal file
@ -0,0 +1,14 @@
|
||||
import os
|
||||
|
||||
# telegram bot key
|
||||
telegram_bot_key='5863718864:AAFijN65_SbbGQ0WDBggzKJw2SIcZVTVrPw'
|
||||
|
||||
#
|
||||
chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading")
|
||||
|
||||
|
||||
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT',"REEFUSDT","BONDUSDT","VIDTUSDT","UNFIUSDT","PEOPLEUSDT","ORDIUSDT"]
|
||||
|
||||
|
||||
#dingding bot
|
||||
singal_bot_url = 'https://oapi.dingtalk.com/robot/send?access_token=2278b723cd363bb6f85592c743b59b166e70b9e02a275bb5cedbc33b53a5cbdc'
|
||||
21
settings.py
21
settings.py
@ -1,21 +0,0 @@
|
||||
import os
|
||||
|
||||
# telegram bot key
|
||||
telegram_bot_key='5863718864:AAFijN65_SbbGQ0WDBggzKJw2SIcZVTVrPw'
|
||||
|
||||
#
|
||||
chat_id = os.getenv("TQ_CHAT_ID", "@cyber4trading")
|
||||
|
||||
|
||||
#oklink
|
||||
oklink_host = 'https://www.oklink.com'
|
||||
oklink_apikey='ca822b3f-2e1e-479c-8649-c1f9b62a740d'
|
||||
oklink_api_headers = {
|
||||
'Ok-Access-Key' : oklink_apikey
|
||||
}
|
||||
|
||||
|
||||
#whaleAlert
|
||||
whaleAlert_minutes=1
|
||||
whaleAlert_apikey='gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
||||
whaleAlert_max_limit = os.getenv('TQ_WHALEALERT_MAX_USD_AMOUNT',1000 * 10000)
|
||||
5
signals/signal_builder.py
Normal file
5
signals/signal_builder.py
Normal file
@ -0,0 +1,5 @@
|
||||
import datetime
|
||||
|
||||
|
||||
def signal_text(symbol, interval, signal_type ,signal):
|
||||
return f'📶信号预警📶\r\n\r\n品种:【${symbol}】\r\n周期:{interval}\r\n信号类型:{signal_type}\r\n信号:{signal}\r\n\r\n{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}'
|
||||
@ -1,59 +0,0 @@
|
||||
import talib
|
||||
import numpy as np
|
||||
import bn
|
||||
import tg
|
||||
import settings
|
||||
|
||||
# 检查是否出现多头排列信号
|
||||
def check_bullish_crossover(data):
|
||||
# 提取收盘价
|
||||
close_prices = np.array([float(entry[4]) for entry in data])
|
||||
|
||||
# 计算移动平均线
|
||||
ema7 = talib.EMA(close_prices, timeperiod=7)
|
||||
ema30 = talib.EMA(close_prices, timeperiod=30)
|
||||
ema100 = talib.EMA(close_prices, timeperiod=100)
|
||||
ema200 = talib.EMA(close_prices, timeperiod=200)
|
||||
|
||||
# 判断是否出现多头排列信号
|
||||
# if ema7[-1] > ema30[-1] > ema100[-1] > ema200[-1] and ema7[-2] <= ema30[-2] <= ema100[-2] <= ema200[-2]:
|
||||
if ema7[-1] > ema30[-1] > ema100[-1] and ema7[-2] <= ema30[-2] <= ema100[-2]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# 检查是否出现空头排列信号
|
||||
def check_bearish_crossover(data):
|
||||
# 提取收盘价
|
||||
close_prices = np.array([float(entry[4]) for entry in data])
|
||||
|
||||
# 计算移动平均线
|
||||
ema7 = talib.EMA(close_prices, timeperiod=7)
|
||||
ema30 = talib.EMA(close_prices, timeperiod=30)
|
||||
ema100 = talib.EMA(close_prices, timeperiod=100)
|
||||
ema200 = talib.EMA(close_prices, timeperiod=200)
|
||||
|
||||
# 判断是否出现空头排列信号
|
||||
if ema7[-1] < ema30[-1] < ema100[-1] < ema200[-1] >= ema30[-2] >= ema100[-2]:
|
||||
# if ema7[-1] < ema30[-1] < ema100[-1] < ema200[-1] and ema7[-2] >= ema30[-2] >= ema100[-2] >= ema200[-2]:
|
||||
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def strategy_run(symbol, interval):
|
||||
# 获取kline数据
|
||||
data = bn.klines(symbol, interval)
|
||||
|
||||
if check_bullish_crossover(data):
|
||||
print('多头排列信号出现!')
|
||||
|
||||
text = f'${symbol} - {interval}\r\n\r\n出现【多头排列】信号'
|
||||
tg.send_message(settings.chat_id, text)
|
||||
|
||||
|
||||
if check_bearish_crossover(data):
|
||||
print("空头排列信号出现!")
|
||||
text = f'${symbol} - {interval}\r\n\r\n出现【空头排列】信号'
|
||||
tg.send_message(settings.chat_id, text)
|
||||
@ -1,39 +0,0 @@
|
||||
|
||||
import requests
|
||||
import settings
|
||||
from datetime import datetime, timedelta
|
||||
import time
|
||||
import tg
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
|
||||
def strategy_run():
|
||||
start_time = datetime.now() - timedelta(minutes=settings.whaleAlert_minutes)
|
||||
start_ts = int(start_time.timestamp())
|
||||
|
||||
url = f'https://api.whale-alert.io/v1/transactions?api_key={settings.whaleAlert_apikey}&start={start_ts}&min_value={settings.whaleAlert_max_limit}'
|
||||
headers = {'Accept': 'application/json'}
|
||||
|
||||
resp = requests.get(url, headers=headers).json()
|
||||
|
||||
print(resp)
|
||||
if resp['result'] == "success":
|
||||
cursor = resp['cursor']
|
||||
try:
|
||||
if 'transactions' in resp:
|
||||
data = resp['transactions']
|
||||
|
||||
for ts in data:
|
||||
if ts['to']['owner_type'] == 'exchange':
|
||||
from_text = 'unknown wallet'
|
||||
content = f"🚨 {ts['amount']} #{ts['symbol']} ({ts['amount_usd']} USD) 从 {from_text} 转入 #{ts['to']['owner']}"
|
||||
|
||||
print(content)
|
||||
tg.send_message(settings.chat_id, content)
|
||||
except Exception as e:
|
||||
logging.error(traceback.format_exc())
|
||||
tg.send_message(settings.chat_id, traceback.format_exc())
|
||||
else:
|
||||
print(resp['message'])
|
||||
tg.send_message(settings.chat_id, traceback.format_exc())
|
||||
@ -1,3 +0,0 @@
|
||||
import strategy.large_trans as lt
|
||||
|
||||
lt.strategy_run()
|
||||
6
strategy_vol.py
Normal file
6
strategy_vol.py
Normal file
@ -0,0 +1,6 @@
|
||||
import sys
|
||||
from monitors import vol_up
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv
|
||||
vol_up.run_crypto(args[1])
|
||||
13
telegram_sender.py
Normal file
13
telegram_sender.py
Normal file
@ -0,0 +1,13 @@
|
||||
import requests
|
||||
import setting
|
||||
import urllib3
|
||||
|
||||
# 发送消息
|
||||
def send_message(chat_id, text):
|
||||
url = f'https://api.telegram.org/bot{setting.telegram_bot_key}/sendMessage'
|
||||
formData = {
|
||||
"chat_id" : chat_id,
|
||||
"text" : text
|
||||
}
|
||||
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
|
||||
requests.post(url, data= formData, verify=False)
|
||||
80
test.py
80
test.py
@ -1,42 +1,54 @@
|
||||
import bn
|
||||
import pandas as pd
|
||||
import mplfinance as mpf
|
||||
import datetime as dt
|
||||
import strategy.large_trans as lt
|
||||
|
||||
# def binanceDataFrame(klines):
|
||||
# df = pd.DataFrame(klines.reshape(-1,12),dtype=float, columns = ('Open Time',
|
||||
# 'Open',
|
||||
# 'High',
|
||||
# 'Low',
|
||||
# 'Close',
|
||||
# 'Volume',
|
||||
# 'Close time',
|
||||
# 'Quote asset volume',
|
||||
# 'Number of trades',
|
||||
# 'Taker buy base asset volume',
|
||||
# 'Taker buy quote asset volume',
|
||||
# 'Ignore'))
|
||||
|
||||
# df['Open Time'] = pd.to_datetime(df['Open Time'], unit='ms')
|
||||
import requests
|
||||
import datasource.crypto
|
||||
from monitors import move
|
||||
from datasource import crypto
|
||||
import talib
|
||||
import discord_sender
|
||||
from monitors import vegas_cross, jin10_cal,vol_up
|
||||
from datasource import crypto
|
||||
from monitors import macd_boll
|
||||
import datasource
|
||||
from binance.um_futures import UMFutures
|
||||
import redis,dingding
|
||||
|
||||
|
||||
# return df
|
||||
# vol_up.run_crypto('1h')
|
||||
|
||||
|
||||
# klines = bn.klines('BTCUSDT', '1h')
|
||||
# r = redis.Redis(host='45.76.104.85', port=6379, db=0 ,password="redis_ihkXTj")
|
||||
# r.set('r_symbols', "test")
|
||||
|
||||
# df = pd.DataFrame(klines,dtype=float)
|
||||
# df.columns = ['Open time', 'Open', 'High', 'Low', 'Close', 'Volume', 'ctime', 'Quote asset volume', 'Number of trades', 'Taker buy base asset volume', 'Taker buy quote asset volume', 'Can be ignored']
|
||||
# df.index = [dt.datetime.fromtimestamp(x/1000.0) for x in df.ctime]
|
||||
# mpf.plot(df, type='line')
|
||||
# print(r.get('r_symbols'))
|
||||
|
||||
print(datasource.crypto.get_future_symbols())
|
||||
|
||||
# macd_boll.run_crypto('15m', debug=True)
|
||||
|
||||
# jin10_cal.run()
|
||||
|
||||
# print(crypto._get_top_coins_by_market_cap(20))
|
||||
# vegas_cross.run_crypto('1h')
|
||||
|
||||
|
||||
# lt.strategy_run()
|
||||
from datetime import datetime, timedelta
|
||||
import time,settings
|
||||
|
||||
last_min = datetime.now() - timedelta(minutes=settings.whaleAlert_minutes)
|
||||
print(last_min)
|
||||
print(time.mktime(last_min.timetuple()))
|
||||
print(last_min.timestamp())
|
||||
# key = 'QSZvYevTytwi8CJEkiUqqlZRQBOjIa23BoB8wFwTSY26GBAFkViTExex2mFNJ0ij'
|
||||
# secret = '1eGO4aeICAxPRXQzw2lQBc0QAkIKn6WiCV4cRLnUwnJulzixYFkoBeho5ZzsKTbn'
|
||||
|
||||
# client = UMFutures(key=key, secret=secret)
|
||||
# # print(client.exchange_info())
|
||||
# # data = client.funding_rate('BTCUSD_PERP', limit=1)
|
||||
|
||||
# print(client.balance())
|
||||
|
||||
# fundingRate = float(data[0]['fundingRate']) * 100
|
||||
|
||||
# text = f"币种: {data[0]['symbol']}\r\n资金费率: {fundingRate} %"
|
||||
|
||||
|
||||
# mUrl = "https://discordapp.com/api/webhooks/1285898004641091605/DwIh9yZvrU6TwelVmJr96XBdpFTEEpeFD8GsZpH7rBdwT4UwVyZTrtdmBzS4ae0Ta7PH"
|
||||
|
||||
# discord_sender.send_message(mUrl, '消息内容',text)
|
||||
|
||||
|
||||
|
||||
# dingding.send_message('信号 测试')
|
||||
Loading…
Reference in New Issue
Block a user