def data_test_m(self): # 获取试验数据
     class_sql = PostgreSQL('backtest')
     j_data = class_sql.minute_select('m')
     data = pd.DataFrame(j_data, columns=['时间', '开盘价', '最高价', '最低价', '收盘价', '成交量', '持仓量'])
     data.set_index(['时间'], inplace=True)
     class_pro= kline_process()
     spe = 'm'
     begindate = '2014-12-29'
     enddate = '2018-08-21'
     data = class_pro.minute_day(spe, begindate, enddate, data)
     return data
示例#2
0
 def __init__(self):
     # 动图显示的k线根数
     self.kline_num = 100
     sql = PostgreSQL('backtest')
     data = sql.minute_select('j')
     data = pd.DataFrame(data, columns=['时间', '开盘价', '最高价', '最低价', '收盘价', '成交量', '持仓量'])
     data.set_index(['时间'], inplace=True)
     k_p = kline_process()
     spe = 'j'
     begindate = '2014-07-07'
     enddate = '2018-08-28'
     data = k_p.minute_day(spe, begindate, enddate, data)
     self.data = data
     macd = MACD_JW()
     for i in range(0, len(data)):
         macd.macd_loop(data.loc[i, '收盘价'])
     self.macd = macd
     print('数据Done')
示例#3
0
 def kline_combine(self):
     self.time_print('数据正在合成......')
     data = self.data
     periodS = self.periods
     obj_klineprocess = kline_process()
     spe = self.spe
     begindate = self.begintime
     enddate = self.endtime
     if periodS == 'D':
         period_data = obj_klineprocess.minute_day(spe, begindate, enddate,
                                                   data)
         period_data.set_index('时间', inplace=True)
         self.time_print('日线数据合成完毕......')
     else:
         period_data = obj_klineprocess.minute_combine(data,
                                                       periods=periodS)
         self.time_print('分钟数据合成完毕......')
     self.period_data = period_data