700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python 策略回测_python策略怎么进行全市场回测-金字塔知识 -程序化交易(CXH99.COM)...

python 策略回测_python策略怎么进行全市场回测-金字塔知识 -程序化交易(CXH99.COM)...

时间:2022-09-07 05:18:25

相关推荐

python 策略回测_python策略怎么进行全市场回测-金字塔知识 -程序化交易(CXH99.COM)...

金字塔客服:

#筛选非停牌且eps大于0的票

for i in context.code:

close = history_bars(i, 1, '1d','close')

temp = fin_indicator(i,'EPS',1,0,0)

if len(close)>0 and temp[-1]>0:

code.append(i)

#转换成市盈率

for j in code:

close = history_bars(j, 1, '1d','close')

temp = fin_indicator(j,'EPS',1,0,0)

pe.append(close[-1]/temp[-1])

pe_ra = np.array(pe)

#对pe进行排序,buy_list是排名前几的股票列表

sort = np.argsort(pe_ra)

code = np.array(code)

buy_list = code[[sort[:context.num]]]

sell_num = 0

历史数据和深度财务数据是否有补充,如果没有数据那么是测不到的。另外代码里你可以加入一些print看下筛选非停牌且eps大于0的票这个动作后的code列表是有哪些品种

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。