1
This commit is contained in:
parent
0b34231b54
commit
a9477ea187
@ -1,7 +1,7 @@
|
||||
import requests
|
||||
from binance.spot import Spot
|
||||
import pandas as pd
|
||||
from binance.cm_futures import CMFutures
|
||||
from binance.um_futures import UMFutures
|
||||
|
||||
import urllib3
|
||||
|
||||
@ -9,7 +9,7 @@ api_key = "HCpeel8g6fsTK2630b7BvGBcS09Z3qfXkLVcAY2JkpaiMm1J6DWRvoQZBQlElDJg"
|
||||
api_secret= "TySs6onlHOTrGzV8fMdDxLKTWWYnQ4rCHVAmjrcHby17acKflmo7xVTWVsbqtxe7"
|
||||
|
||||
client = Spot(api_key, api_secret)
|
||||
future_client = CMFutures(api_key, api_secret)
|
||||
future_client = UMFutures(api_key, api_secret)
|
||||
|
||||
# 获取市值前top的币种
|
||||
def _get_top_coins_by_market_cap(top):
|
||||
@ -69,10 +69,10 @@ def get_future_symbols():
|
||||
data = future_client.exchange_info()["symbols"]
|
||||
|
||||
# 创建DataFrame
|
||||
columns = ['symbol', 'contractStatus','contractType', 'baseAsset', 'quoteAsset']
|
||||
columns = ['symbol', 'status','contractType', 'baseAsset', 'quoteAsset']
|
||||
df = pd.DataFrame(data, columns=columns)
|
||||
# 过滤出交易对
|
||||
df = df[(df['contractStatus'] == 'TRADING') & (df['quoteAsset'] == 'USD') & (df['contractType'] == 'PERPETUAL')]
|
||||
df = df[(df['status'] == 'TRADING') & (df['contractType'] == 'PERPETUAL')]
|
||||
|
||||
return df['symbol']
|
||||
|
||||
@ -103,4 +103,6 @@ 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
|
||||
2
main.py
2
main.py
@ -31,7 +31,7 @@ for t in times:
|
||||
#jin10
|
||||
schedule.every().day.at("00:00").do(jin10.run)
|
||||
|
||||
version = 'V1.21'
|
||||
version = 'V1.22'
|
||||
print(f'Running... {version}')
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
|
||||
@ -66,7 +66,7 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
def run_crypto(interval, debug=False):
|
||||
print('Vegas策略运行.')
|
||||
time.sleep(5)
|
||||
for s in setting.future_sysmbols:
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval, True)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
|
||||
@ -68,8 +68,6 @@ def stratergy_run(symbol, interval, df, debug):
|
||||
def run_crypto(interval, debug=False):
|
||||
print('Vegas策略运行.')
|
||||
|
||||
# symbols = crypto.get_symbols()
|
||||
# symbols = crypto.get_top_binance_usdt_pairs(10)
|
||||
for s in setting.symbols:
|
||||
df = crypto.get_klines(s, interval)
|
||||
stratergy_run(s,interval, df, debug)
|
||||
|
||||
@ -7,6 +7,4 @@ 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']
|
||||
future_sysmbols = ["BTCUSD_PERP","ETHUSD_PERP","BNBUSD_PERP","BCHUSD_PERP","DOGEUSD_PERP","UNIUSD_PERP","SOLUSD_PERP","FTMUSD_PERP"]
|
||||
symbols = ['BTCUSDT',"ETHUSDT",'LTCUSDT','DOGEUSDT','FTMUSDT','FILUSDT','OPUSDT','SOLUSDT','BNBUSDT','BCHUSDT','ETCUSDT','ARUSDT',"REEFUSDT","BONDUSDT","VIDTUSDT","UNFIUSDT"]
|
||||
|
||||
15
test.py
15
test.py
@ -4,29 +4,26 @@ from monitors import move
|
||||
from datasource import crypto
|
||||
import talib
|
||||
import discord_sender
|
||||
from binance.cm_futures import CMFutures
|
||||
from monitors import vegas_cross, jin10_cal
|
||||
from datasource import crypto
|
||||
from monitors import macd_boll
|
||||
import datasource
|
||||
from binance.cm_futures import CMFutures
|
||||
|
||||
|
||||
# client = CMFutures()
|
||||
# print(client.exchange_info()['symbols'])
|
||||
from binance.um_futures import UMFutures
|
||||
|
||||
# print(datasource.crypto.get_future_symbols())
|
||||
|
||||
# macd_boll.run_crypto('15m', debug=True)
|
||||
macd_boll.run_crypto('15m', debug=True)
|
||||
|
||||
jin10_cal.run()
|
||||
# jin10_cal.run()
|
||||
|
||||
# print(crypto._get_top_coins_by_market_cap(20))
|
||||
# vegas_cross.run_crypto('1h')
|
||||
|
||||
|
||||
|
||||
# client = CMFutures()
|
||||
|
||||
# client = UMFutures()
|
||||
# print(client.exchange_info())
|
||||
# data = client.funding_rate('BTCUSD_PERP', limit=1)
|
||||
|
||||
# fundingRate = float(data[0]['fundingRate']) * 100
|
||||
|
||||
Loading…
Reference in New Issue
Block a user