from tqsdk import TqApi, TqAuth, tafunc
api = TqApi(auth=TqAuth(" Xinyi account ", " password "))
kline = api.get_kline_serial("SHFE.rb2105", 60,data_length=5)
# use map Function 'datetime' Each timestamp of the column is converted to datetime.datetime type
kline.datetime = kline.datetime.map(tafunc.time_to_datetime)
print(kline) # Print... After conversion timestamp K Line
print(' Split line ----------')
print(f' newest K Line closing price :{kline.iloc[-1].close}, The previous one K Line closing price :{kline.iloc[-2].close}')
api.close()
kline.datetime = kline.datetime.map(tafunc.time_to_datetime)
Convert to standard time