网络交易在期间比较好,网络交易的教程很多可以百度了
声明:本人提供的代码仅用于交流学习,不适用于商业用途,高风险事件,本人对代码概不负责
运行程序前完成完整的看完成教程,路向
{
'测试':'股票',
'自动网格':'真',
'运行策略':'可转债',
'股票名称':['三一重工','北方稀土'],
'股票代码':['600031','600111'],
'ETF名称':['传媒ETF','光伏ETF'],
'ETF代码':['159805','515790'],
'可转债名称':['小康转债','莱克转债'],
'可转债代码':['113016','113659'],
'期间天数':20,
'期间上限':20,
'期间下限':16,
'价格中枢':18,
'格子总数':8,
'单位格子':0.5,
'buy_1_price':17.5,
'buy_1_volume':100,
'buy_2_price':17,
'buy_2_volume':100,
'buy_3_price':16.5,
'buy_3_volume':100,
'buy_4_price':16,
'buy_4_volume':100,
'sell_1_price':18.5,
'sell_1_volume':100,
'sell_2_price':19,
'sell_2_volume':100,
'sell_3_price':19.5,
'sell_3_volume':100,
'sell_4_price':20,
'sell_4_volume':100,
'同花顺下单路径':'C:/同花顺软件/同花顺/xiadan.exe',
'qq':'65133625@qq.com',
'定时运行':'09:40',
'配置声明':'如果自动网格采用为真,自己配置的网格无效,程序会自动生产网格区间,用最近20日的最高点最为价格上限,最低点最为价格下限,期间平均分为8份,买卖各4份',
'测试声明':'需要测试为是进行测试,不然直接运行程序交易,测试类型支持全部,股票,ETF,可转债,无',
'其他声明':'如果自动网格为假,代码列表智能输入一个代码,在推其他参数进行配置',
'运行策略说明':'可以选择全部/股票/ETF/可转债/无'
}
def cacal_stock_grid_data(self,stock='600031',start_date='20210101',end_date='20500101',data_type='D',n=20):
'''
计算股票网格策略
'''
df=self.get_stock_hist_data_em(stock=stock,start_date=start_date,end_date=end_date,data_type=data_type)
df['最高价']=df['close'].rolling(window=n).max()
df['最低价']=df['close'].rolling(window=n).min()
data_dict={}
data_dict['股票代码']=stock
data_dict['期间天数']=n
data_dict['期间上限']=df['最高价'].tolist()[-1]
data_dict['期间下限']=df['最低价'].tolist()[-1]
data_dict['价格中枢']=(df['最高价'].tolist()[-1]+df['最低价'].tolist()[-1])/2
data_dict['格子总数']=8
data_dict['单位格子']=(df['最高价'].tolist()[-1]-df['最低价'].tolist()[-1])/8
for i in range(1,5):
data_dict['buy_{}_price'.format(i)]=data_dict['价格中枢']-i*data_dict['单位格子']
data_dict['buy_{}_volume'.format(i)]=100
for i in range(1,5):
data_dict['sell_{}_price'.format(i)]=data_dict['价格中枢']+i*data_dict['单位格子']
data_dict['sell_{}_volume'.format(i)]=100
print(data_dict)
with open(r'股票分析数据\{}.txt'.format(stock),'w+',encoding='utf-8') as f:
f.write(str(data_dict))
return data_dict
import time
from datetime import datetime
import schedule
#核心数据
from stock_data import stock_data
import pandas as pd
#easytrader交易,改进
from easytrader_trader import trader_frame
import numpy as np
#可转债数据
from bond_cov_data import bond_cov_data
import json
#import tarder_bound
class trader_strategy:
def __init__(self,qq='1029762153@qq.com',path=r'C:\同花顺软件\同花顺\xiadan.exe'):
self.qq=qq
self.exe=path
self.tarder=''
self.stock_data=stock_data(qq=qq)
#可转债数据
self.bond_cov_data=bond_cov_data()
def connect(self):
'''
连接同花顺
'''
try:
a=trader_frame(exe=self.exe)
a.connect()
self.tarder=a
print('连接同花顺成功')
return True
except:
print('连接同花顺失败')
return False
def run_stock_trader_strategy(self):
'''
运行交易策略 股票
'''
if self.stock_data.check_is_trader_date()==True:
with open(r'交易配置.json','r+',encoding='utf-8') as f:
text=f.read()
trader_set=json.loads(text)
if trader_set['自动网格']=='真':
for stock in trader_set['股票代码']:
trader_set=self.stock_data.cacal_stock_grid_data(stock=stock,start_date='20210101',end_date='20500101')
price=self.stock_data.get_stock_now_data(code=stock)['最新价'].tolist()[-1]
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_volume']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_volume']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_volume']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_volume']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
pass
else:
stock=trader_set['股票代码'][0]
price=self.stock_data.get_stock_now_data(code=stock)['最新价'].tolist()[-1]
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_price']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_price']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_price']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_price']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
pass
else:
print('目前不是交易时间')
def run_ETF_trader_strategy(self):
'''
运行交易策略,ETF基金
'''
if self.stock_data.check_is_trader_date()==True:
with open(r'交易配置.json','r+',encoding='utf-8') as f:
text=f.read()
trader_set=json.loads(text)
if trader_set['自动网格']=='真':
for stock in trader_set['ETF代码']:
trader_set=self.stock_data.cacal_ETF_grid_data(stock=stock,end_date='20500101',limit=10000,data_type='D')
price=self.stock_data.get_ETF_spot_em(stock=stock)['最新价'].tolist()[-1]
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_price']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_volume']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_volumee']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_volume']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
pass
else:
stock=trader_set['ETF代码'][0]
price=price=self.stock_data.get_ETF_spot_em(stock=stock)['最新价'].tolist()[-1]
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_volume']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_volume']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_volume']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_volume']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
pass
else:
print('目前不是交易时间')
def run_cov_bond_trader_strategy(self):
'''
运行交易策略,可转债
'''
if self.stock_data.check_is_trader_date()==True:
with open(r'交易配置.json','r+',encoding='utf-8') as f:
text=f.read()
trader_set=json.loads(text)
if trader_set['自动网格']=='真':
for stock in trader_set['可转债代码']:
trader_set=self.stock_data.cacal_bond_cov_grid_data(stock=stock,end_date='20500101',limit=10000,data_type='D')
price=self.stock_data.get_cov_bond_spot(stock=stock)['最新价']
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_volume']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_volume']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_volume']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_volume']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
pass
else:
stock=trader_set['可转债代码'][0]
price=self.stock_data.get_cov_bond_spot(stock=stock)['最新价']
#买入的情况
if price<trader_set['价格中枢'] and price>=trader_set['buy_1_price']:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_1_price'] and price>=trader_set['buy_2_price']:
amount=trader_set['buy_2_volume']
text='买入二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_2_price'] and price>=trader_set['buy_3_price']:
amount=trader_set['buy_3_volume']
text='买入三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
elif price<trader_set['buy_3_price'] and price>=trader_set['buy_4_price']:
amount=trader_set['buy_4_volume']
text='买入四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
#卖出的情况
elif price>trader_set['价格中枢'] and price<=trader_set['sell_1_price']:
amount=trader_set['sell_1_volume']
text='卖出一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_1_price'] and price<=trader_set['sell_2_price']:
amount=trader_set['sell_2_volume']
text='卖出二档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_2_price'] and price<=trader_set['sell_3_price']:
amount=trader_set['sell_3_volume']
text='卖出三档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
elif price>trader_set['sell_3_price'] and price<=trader_set['sell_4_price']:
amount=trader_set['sell_4_volume']
text='卖出四档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.sell(security=stock,price=price,amount=amount)
else:
amount=trader_set['buy_1_volume']
text='买入一档 时间{} 代码{} 价格{} 数量{}'.format(str(datetime.now()),stock,price,amount)
print(text)
self.tarder.buy(security=stock,price=price,amount=amount)
else:
print('目前不是交易时间')
def seed_qq_email(self):
if self.stock_data.check_is_trader_date()==True:
if self.connect()==True:
now=str(datetime.now())
text=now+'程序连接正常'
print(text)
else:
self.connect()
else:
print('目前不是交易时间')
print(datetime.now())
if __name__=='__main__':
'''
交易策略
'''
print('程序准备运行')
time.sleep(5)
with open(r'交易配置.json','r+',encoding='utf-8') as f:
text=f.read()
trader_set=json.loads(text)
qq=trader_set['qq']
path=trader_set['同花顺下单路径']
run_date=trader_set['定时运行']
test=trader_set['测试']
run=trader_set['运行策略']
strategy=trader_strategy(qq=qq,path=r'{}'.format(path))
strategy.connect()
#下面2个测试用,去调#就可以运行,用在调试
if test=='全部':
strategy.run_stock_trader_strategy()
strategy.run_ETF_trader_strategy()
strategy.run_cov_bond_trader_strategy()
elif test=='股票':
strategy.run_stock_trader_strategy()
elif test=='ETF':
strategy.run_ETF_trader_strategy()
elif test=='可转债':
strategy.run_cov_bond_trader_strategy()
else:
pass
#strategy.seed_qq_email()
#strategy.get_hold_stock()
#strategy.adjust_position()
#strategy.run_hold_stock_T_stategy()
#保存持股
if run=='全部':
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_ETF_trader_strategy)
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_stock_trader_strategy)
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_cov_bond_trader_strategy)
elif run=='股票':
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_ETF_trader_strategy)
elif run=='ETF':
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_stock_trader_strategy)
elif run=='可转债':
schedule.every().day.at('{}'.format(run_date)).do(strategy.run_cov_bond_trader_strategy)
else:
pass
#schedule.every().day.at('14:40').do(tarder_bound.tarder_bound)
#schedule.every().day.at('14:50').do(tarder_bound.tarder_bound)
schedule.every(10).minutes.do(strategy.seed_qq_email)
while True:
schedule.run_pending()
time.sleep(60)
#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package opencv-python
联系客服