def fetch_tick(stock, date):
with timer(logtime("ts.get_tick_data('%s', date='%s')" % (stock, date))):
df = await wait_concurrent(event_loop, proc_pool, ts.get_tick_data, stock, date=date, pause=0.1)
if df is None or (len(df) > 0 and "??????" in df['time'][0]):
# no data found
logging.debug("no tick data for stock: ts.get_tick_data('%s', date='%s')" % (stock, date))
return
# with timer(logtime("tick_data_proc")):
df['stock'] = stock
df['time'] = (date + ' ' + df['time']).map(lambda x: pd.Timestamp(datetime.strptime(x, time_fmt)).strftime(format="%Y-%m-%d %H:%M:%S%z"))
return tick_buffer.proc_data(df)
评论列表
文章目录