import pandas as pd from tqsdk import TqApi, TqAuth api = TqApi(web_gui=True, debug="debug.log", auth=TqAuth("rrr", "rrrrr")) quote = api.get_quote("SHFE.rb2310") ticks = api.get_tick_serial("SHFE.rb2310") klines = api.get_kline_serial("SHFE.rb2310", 60) df = pd.DataFrame() minute = int(ticks["datetime"] // 60) while True: if minute not in df.index: df.loc[minute] = [ticks["last_price"], ticks["volume"], ticks["open_interest"]] df.to_csv("data.csv", sep=",", mode='a', header=False) klines = api.get_kline_serial("SHFE.rb2310", 60) ticks = api.get_tick_serial("SHFE.rb2310") minute = int(ticks["datetime"] // 60)
tqsdkdzqh 发表新评论 2023年8月28日
运行后,有啥报错信息么?
论坛人气怎么不旺啊