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
Exemple #2
0
def main():
    sql = PostgreSQL('backtest')
    data = sql.minute_select('j')
    data = pd.DataFrame(
        data, columns=['时间', '开盘价', '最高价', '最低价', '收盘价', '成交量', '持仓量'])
    data.set_index(['时间'], inplace=True)
    self = kline_process()
    spe = 'j'
    begindate = '2014-07-07'
    enddate = '2018-08-28'
    data = self.minute_day(spe, begindate, enddate, data)
    pass
Exemple #3
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')