This commit is contained in:
aaron 2024-09-22 22:42:12 +08:00
parent a9477ea187
commit 2c359e42a8
6 changed files with 22 additions and 6 deletions

View File

@ -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['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')) 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 return df

View File

@ -4,6 +4,7 @@ import time,setting
import telegram_sender import telegram_sender
from datasource import crypto from datasource import crypto
import dingding import dingding
import redis_helper
import discord_sender import discord_sender
@ -41,6 +42,7 @@ def stratergy_run(symbol, interval, df, debug):
df['Short_Signal'] = np.where(short_condition,True, False) df['Short_Signal'] = np.where(short_condition,True, False)
latest = df.iloc[-2] latest = df.iloc[-2]
print(f"{symbol} - {interval}】 is checked!")
direction = "" direction = ""
if latest['Short_Signal'] == True: if latest['Short_Signal'] == True:
@ -66,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 setting.symbols: for s in redis_helper.get_symbols():
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)

View File

@ -34,7 +34,6 @@ def stratergy_run(symbol, interval, df, debug):
df['shortSignal'] = crossunder(max_low_line, min_high_line) df['shortSignal'] = crossunder(max_low_line, min_high_line)
latest = df.iloc[-1] latest = df.iloc[-1]
print(df)
direction = "" direction = ""
if latest['shortSignal']==True: if latest['shortSignal']==True:
direction = '' direction = ''
@ -61,7 +60,7 @@ def stratergy_run(symbol, interval, df, debug):
def run_crypto(interval, debug=False): def run_crypto(interval, debug=False):
print('Vegas策略运行.') print('Vegas策略运行.')
for s in crypto.get_future_symbols(): for s in setting.symbols:
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)

10
redis_helper.py Normal file
View 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

View File

@ -6,4 +6,5 @@ requests
schedule schedule
TA_Lib TA_Lib
tweepy tweepy
discord_webhook discord_webhook
redis

View File

@ -9,6 +9,12 @@ from datasource import crypto
from monitors import macd_boll from monitors import macd_boll
import datasource import datasource
from binance.um_futures import UMFutures 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()) # print(datasource.crypto.get_future_symbols())