#株価データの読み込み _time,_open,_max,_min,_close,_volume,_keisu,_shihon = md.readfile(filepath) try: iday = _time.index(START_TEST_DAY) except: print 'can not find START_TEST_DAY' continue #model_1 output_list = [] predict_list = [] train, test = md.getTeacherDataMultiTech_label(f,START_TEST_DAY,NEXT_DAY,input_num,stride=1,u_vol=True,u_ema=True) if (train == -1) or (test == -1): print 'skip',f continue for row in test: inputlist = row[:-output_num-2] output = row[-output_num-2] output_list.append(output) inputlist = np.array([inputlist]).astype(np.float32) y = model_1.predict(xp.asarray(inputlist),1) predict_list.append(y.data.argmax()) if y.data.argmax() == 0:#buy point_1.append(1) elif y.data.argmax() == 1:#sell point_1.append(-1)
stocks = [] money = 1000000#所持金 filepath = "./stockdata/%s" % f #株価データの読み込み _time,_open,_max,_min,_close,_volume,_keisu,_shihon = md.readfile(filepath) try: iday = _time.index(START_TEST_DAY) except: print 'can not find START_TEST_DAY' continue train, test = md.getTeacherDataMultiTech_label(f,START_TEST_DAY,NEXT_DAY,input_num,stride=1,u_vol=u_vol,u_ema=u_ema,u_rsi=u_rsi,u_macd=u_macd,u_stoch=u_stoch,u_wil=u_wil) if (train == -1) or (test == -1): print 'skip',f continue for row in test: inputlist = row[:-3] output = row[-3] inputlist = np.array([inputlist]).astype(np.float32) y = model.predict(xp.asarray(inputlist),1) if y.data.argmax() == 0:#buy point.append(1) elif y.data.argmax() == 1:#sell point.append(-1) elif y.data.argmax() == 2:#no_ope point.append(0)