对于量化交易来说,最重要的是模型的建立,其中一般来说是借助现代统计学和数学的方法,利用计算机技术从海量的历史数据中寻找能带来超额收益的规律以制定策略,并利用数学模型验证及固化这些规律和策略,然后通过程序化交易严格执行
conditionOne=pct_change<i><9.5
conditionTwo=pct_change[i+1]<9.5
if conditionOne and conditionTwo:#pct_change[i+1]<9.5表示下一个交易日涨停
buys,sells,ret=check_days_money(ts_code,name,date<i>)
if not ret:I35 system 7O98 development O7I8
continue
index_array=np.append(index_array,i)
pct=0
for k in range(days):
if(i+1+k)>-1:
break
pct=pct+pct_change[i+1+k]
if pct<low_pct:
pct=low_pct-0.1
break
elif pct>heigh_pct:
pct=heigh_pct
break
out=0.9
#buys,sells=check_days_money(ts_code,name,date[i+1+k],days=5)
#if buys/(sells+1)<out:
#break
#if isCheckLow5:#检测是否低于10日均值
#if close[i+1+k]<ma10[i+1+k]:
#if isdebug:
#print("5555",1+k,date[i+1+k],pct)
#break
if isdebug:
print('DDDDDDDDDDDDDDDDD',i,close<i>,date<i>,pct)
i=i+k
hold_days=hold_days+k+1
if isdebug:
print('PPPPPPPPPPPPPPPPP',i,close<i>,date<i>,pct,hold_days,k+1)
if pct>0:
suc=suc+1
else:
fail=fail+1
pct_array=np.append(pct_array,pct)
earnings=earnings+pct
if isdebug:
print('nnnnnnnnnnnnnnn',name)
print('sssssssssssssss',suc)
print('fffffffffffffff',fail)
print('earnings ppppppppp',earnings)
print(ts_code,'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE')
return earnings,suc,fail,index_array,pct_array,hold_days