update
This commit is contained in:
parent
41cb601203
commit
c68ee8bac2
Binary file not shown.
Binary file not shown.
8
bn.py
8
bn.py
@ -4,8 +4,10 @@ client = Spot()
|
||||
|
||||
|
||||
# Get klines
|
||||
def klines(symbol, interval, limit=300):
|
||||
return client.klines(symbol,interval,limit=limit)
|
||||
def klines(symbol, interval):
|
||||
lines = client.klines(symbol,interval)
|
||||
print(len(lines))
|
||||
return lines
|
||||
|
||||
# Get Symbols
|
||||
def symbols():
|
||||
@ -16,4 +18,4 @@ def symbols():
|
||||
if s['symbol'].endswith('USDT'):
|
||||
symbols.append(s['symbol'])
|
||||
|
||||
return symbols
|
||||
return symbols
|
||||
2
main.py
2
main.py
@ -1,7 +1,7 @@
|
||||
import schedule
|
||||
import bn
|
||||
import time
|
||||
import crossover
|
||||
import strategy.crossover as crossover
|
||||
|
||||
# 获取交易所交易对
|
||||
symbols = bn.symbols()
|
||||
|
||||
6
settings.py
Normal file
6
settings.py
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
# telegram bot key
|
||||
telegram_bot_key='5863718864:AAFijN65_SbbGQ0WDBggzKJw2SIcZVTVrPw'
|
||||
|
||||
#
|
||||
chat_id = "@dragon_invest"
|
||||
@ -1,6 +1,8 @@
|
||||
import talib
|
||||
import numpy as np
|
||||
import bn
|
||||
import tg
|
||||
import settings
|
||||
|
||||
# 检查是否出现多头排列信号
|
||||
def check_bullish_crossover(data):
|
||||
@ -40,9 +42,16 @@ def check_bearish_crossover(data):
|
||||
def strategy_run(symbol, interval):
|
||||
# 获取kline数据
|
||||
data = bn.klines(symbol, interval)
|
||||
print(f'获取Kline数据: [{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)
|
||||
Loading…
Reference in New Issue
Block a user