根据mindgo和vnpy量化金融视频做一个最简单的因子分析。
参考资料:
mindgo 单因子分析链接:http://quant.10jqka.com.cn/platform/html/strategylib.html#/
vnpy量化金融视频链接:https://www.bilibili.com/video/BV1yJ411u7WG?p=2
代码:
price = ts.get_hist_data('000002') price=price.sort_index() # 获取收盘价数据 close = price['close'].values # # sh = ts.get_hist_data('sh') # # sh = sh.sort_index() # # #print sh['close'] # # ma = ta.MA(sh['close'].values,20) #20日均线 # # ma1 = pd.DataFrame(ma) # # ma1.index = sh.index # 计算SMA money=10000 moneylist=[] ma = ta.MA(price['close'].values,20) #20日均线 ma1 = pd.DataFrame(ma) ma1.index = price.index #print ma1 pr