1
This commit is contained in:
parent
a9477ea187
commit
2c359e42a8
@ -103,6 +103,4 @@ def get_klines(symbol,interval, future = False,limit=1000):
|
||||
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'))
|
||||
|
||||
print(df)
|
||||
|
||||
return df
|
||||
@ -4,6 +4,7 @@ import time,setting
|
||||
import telegram_sender
|
||||
from datasource import crypto
|
||||
import dingding
|
||||
import redis_helper
|
||||
import discord_sender
|
||||
|
||||
|
||||
@ -41,6 +42,7 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
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:
|
||||
@ -66,7 +68,7 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
def run_crypto(interval, debug=False):
|
||||
print('Vegas策略运行.')
|
||||
time.sleep(5)
|
||||
for s in setting.symbols:
|
||||
for s in redis_helper.get_symbols():
|
||||
df = crypto.get_klines(s, interval, True)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
df['shortSignal'] = crossunder(max_low_line, min_high_line)
|
||||
|
||||
latest = df.iloc[-1]
|
||||
print(df)
|
||||
direction = ""
|
||||
if latest['shortSignal']==True:
|
||||
direction = '空'
|
||||
@ -61,7 +60,7 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
def run_crypto(interval, debug=False):
|
||||
print('Vegas策略运行.')
|
||||
|
||||
for s in crypto.get_future_symbols():
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval,True)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
|
||||
10
redis_helper.py
Normal file
10
redis_helper.py
Normal file
@ -0,0 +1,10 @@
|
||||
import redis
|
||||
import json
|
||||
|
||||
r = redis.Redis(host='45.76.104.85', port=6379, db=0 ,password="redis_ihkXTj")
|
||||
|
||||
def get_symbols():
|
||||
data = json.loads(r.get('t_symbols'))
|
||||
print(f'symbols: \r\n{data}')
|
||||
|
||||
return data
|
||||
@ -6,4 +6,5 @@ requests
|
||||
schedule
|
||||
TA_Lib
|
||||
tweepy
|
||||
discord_webhook
|
||||
discord_webhook
|
||||
redis
|
||||
6
test.py
6
test.py
@ -9,6 +9,12 @@ from datasource import crypto
|
||||
from monitors import macd_boll
|
||||
import datasource
|
||||
from binance.um_futures import UMFutures
|
||||
import redis
|
||||
|
||||
# r = redis.Redis(host='45.76.104.85', port=6379, db=0 ,password="redis_ihkXTj")
|
||||
# r.set('r_symbols', "test")
|
||||
|
||||
# print(r.get('r_symbols'))
|
||||
|
||||
# print(datasource.crypto.get_future_symbols())
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user