def get_data( begin_time, end_time, period ): """ :param from_time: :param to_time: :return: """ # df = ts.get_hist_data(code, start=begin_time, end=end_time) # df = ts.get_hist_data('600848') #ret = md.init( "13601380996", "it@iZ23psatkqsZ" ) """ 下面的tt.get_bars() 可以不用 md.init(); 在myquant.py中,已经有 md.init(); """ # df4 = tt.get_bars( "SHFE.ru1709", 60, "2016-09-05 09:00:00", "2016-11-04 23:30:00" ) # df5 = tt.get_bars( "SHFE.ru1709", 60, "2016-11-05 09:00:00", "2017-01-04 23:30:00" ) # df6 = tt.get_bars( "SHFE.ru1709", 60, "2017-01-05 09:00:00", "2017-03-04 23:30:00" ) # df7 = tt.get_bars( "SHFE.ru1709", 60, "2017-03-05 09:00:00", "2017-05-04 23:30:00" ) # df8 = tt.get_bars( "SHFE.ru1709", 60, "2017-05-25 09:00:00", "2017-07-06 23:30:00" ) df8 = tt.get_bars( "SHFE.ru1801", 1*60, "2017-02-25 09:00:00", "2017-07-06 23:30:00" ) # df8 = tt.get_bars( "CZCE.CF709", 600, "2017-03-25 09:00:00", "2017-07-06 23:30:00" ) #df8 = tt.get_bars( "CZCE.ZC709", 15*60, "2017-02-25 09:00:00", "2017-07-06 23:30:00" ) #df8 = tt.get_bars( "CZCE.OI709", 3*60, "2017-02-25 09:00:00", "2017-07-06 23:30:00" ) # df = pd.concat( [df4, df5, df6, df7, df8] ) df = tt.get_last_n_dailybars( "CZCE.ZC709", 20000 ) df = pd.concat( [df8] ) print( len( df ) ) return df
def makePicture(code, name): #df = ts.get_hist_data(code, start=begin_time, end=end_time) #df = ts.get_hist_data('600848') ret = md.init("13601380996", "it@iZ23psatkqsZ") df = tt.get_bars("SHFE.ru1709", 3600 * 4, "2017-02-01 09:00:00", "2017-06-02 23:00:00") print("kkkkkkkkkkkkkkkkkkkkkkkkkkkk!!!") print("df:", df) #df = df.sort_index(0) # df.plot() drawPic(df, code, name)
def makePicture(code, name): #df = ts.get_hist_data(code, start=begin_time, end=end_time) #df = ts.get_hist_data('600848') ret = md.init("13601380996","it@iZ23psatkqsZ") df = tt.get_bars("SHFE.ru1709", 3600*4, "2017-02-01 09:00:00", "2017-06-02 23:05:00") print("kkkkkkkkkkkkkkkkkkkkkkkkkkkk!!!") print("df:",df) #df = df.sort_index(0) # df.plot() C = df['close'] # 切片收盘价 C30 = C.tail(30) # 取最后30个收盘价数据 MA30 = C30.mean() # 均值 print("MA30:",MA30) xx = MA(C,5) print("MA30 ==== ",xx) kdj = KDJ(df,9,3,3) print("KDJ ==== ", kdj) drawPic(df, code, name)
def get_data( begin_time, end_time, period ): """ :param from_time: :param to_time: :return: """ # df = ts.get_hist_data(code, start=begin_time, end=end_time) # df = ts.get_hist_data('600848') ret = md.init( "13601380996", "it@iZ23psatkqsZ" ) # df4 = tt.get_bars( "SHFE.ru1709", 60, "2016-09-05 09:00:00", "2016-11-04 23:30:00" ) # df5 = tt.get_bars( "SHFE.ru1709", 60, "2016-11-05 09:00:00", "2017-01-04 23:30:00" ) # df6 = tt.get_bars( "SHFE.ru1709", 60, "2017-01-05 09:00:00", "2017-03-04 23:30:00" ) # df7 = tt.get_bars( "SHFE.ru1709", 60, "2017-03-05 09:00:00", "2017-05-04 23:30:00" ) # df8 = tt.get_bars( "SHFE.ru1709", 60, "2017-05-25 09:00:00", "2017-07-06 23:30:00" ) # df8 = tt.get_bars( "CZCE.CF709", 600, "2017-03-25 09:00:00", "2017-07-06 23:30:00" ) df8 = tt.get_bars( "CZCE.ZC709", 900, "2017-02-25 09:00:00", "2017-07-06 23:30:00" ) # df = pd.concat( [df4, df5, df6, df7, df8] ) df = pd.concat( [df8] ) print( len( df ) ) return df