|
@@ -134,7 +134,7 @@ class TestStrategy(bt.Strategy):
|
|
|
|
|
|
def backtrader(table_list, num, Volatility, rate, ns):
|
|
def backtrader(table_list, num, Volatility, rate, ns):
|
|
stattime = dt.now()
|
|
stattime = dt.now()
|
|
- print(type(ns.df), ns.df)
|
|
|
|
|
|
+ # print(type(ns.df), ns.df)
|
|
engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/stocks_data?charset=utf8')
|
|
engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/stocks_data?charset=utf8')
|
|
result = mp.Manager().list()
|
|
result = mp.Manager().list()
|
|
result_change = mp.Manager().list()
|
|
result_change = mp.Manager().list()
|
|
@@ -246,9 +246,9 @@ if __name__ == '__main__':
|
|
ns.df = df
|
|
ns.df = df
|
|
sttime = dt.now()
|
|
sttime = dt.now()
|
|
thread_list = []
|
|
thread_list = []
|
|
- for num in range(20, 40, 10):
|
|
|
|
- for Volatility in range(10, 12, 1):
|
|
|
|
- for rate in range(5, 7, 1):
|
|
|
|
|
|
+ for num in range(30, 120, 10):
|
|
|
|
+ for Volatility in range(3, 21, 1):
|
|
|
|
+ for rate in range(5, 15, 1):
|
|
#获得cpu数量,计算进程数
|
|
#获得cpu数量,计算进程数
|
|
# step = math.ceil(len(table_list)/cpu_count/100)*100
|
|
# step = math.ceil(len(table_list)/cpu_count/100)*100
|
|
print(f'{num}天波动率为{Volatility}% 乖离率为{rate}%')
|
|
print(f'{num}天波动率为{Volatility}% 乖离率为{rate}%')
|
|
@@ -260,7 +260,7 @@ if __name__ == '__main__':
|
|
thread_list.append(p)
|
|
thread_list.append(p)
|
|
# p.start()
|
|
# p.start()
|
|
# p.join()
|
|
# p.join()
|
|
- print(len(thread_list))
|
|
|
|
|
|
+ print(len(thread_list))
|
|
print('开始轮循!')
|
|
print('开始轮循!')
|
|
for thread in thread_list:
|
|
for thread in thread_list:
|
|
thread.start()
|
|
thread.start()
|