easyquotation
easyquotation copied to clipboard
腾讯分时图日期错位的bug
您给的例子,获取的数据是4个工作日之前的
quotation = eq.use("timekline")
data = quotation.real(['603828'], prefix=True)
我于10.13日运行上面代码,获取的timekline的date是10.8号的

是因为腾讯的分时数据不更新了,停在了10月8号…… https://data.gtimg.cn/flashdata/hushen/minute/sh600000.js 有没有大神说说该咋办?
@xinlmain 你看看 get_tick_data,tushare的代码,把他们腾讯的移植过来?
def get_tick_data(code=None, date=None, retry_count=3, pause=0.001,
src='sn'):
"""
获取分笔数据
Parameters
------
code:string
股票代码 e.g. 600848
date:string
日期 format: YYYY-MM-DD
retry_count : int, 默认 3
如遇网络等问题重复执行的次数
pause : int, 默认 0
重复请求数据过程中暂停的秒数,防止请求间隔时间太短出现的问题
src : 数据源选择,可输入sn(新浪)、tt(腾讯)、nt(网易),默认sn
return
-------
DataFrame 当日所有股票交易数据(DataFrame)
属性:成交时间、成交价格、价格变动,成交手、成交金额(元),买卖类型
"""
if (src.strip() not in ct.TICK_SRCS):
print(ct.TICK_SRC_ERROR)
return None
symbol = ct._code_to_symbol(code)
symbol_dgt = ct._code_to_symbol_dgt(code)
datestr = date.replace('-', '')
url = {
ct.TICK_SRCS[0] : ct.TICK_PRICE_URL % (ct.P_TYPE['http'], ct.DOMAINS['sf'], ct.PAGES['dl'],
date, symbol),
ct.TICK_SRCS[1] : ct.TICK_PRICE_URL_TT % (ct.P_TYPE['http'], ct.DOMAINS['tt'], ct.PAGES['idx'],
symbol, datestr),
ct.TICK_SRCS[2] : ct.TICK_PRICE_URL_NT % (ct.P_TYPE['http'], ct.DOMAINS['163'], date[0:4],
datestr, symbol_dgt)
}
for _ in range(retry_count):
time.sleep(pause)
try:
if src == ct.TICK_SRCS[2]:
df = pd.read_excel(url[src])
df.columns = ct.TICK_COLUMNS
else:
re = Request(url[src])
lines = urlopen(re, timeout=10).read()
lines = lines.decode('GBK')
if len(lines) < 20:
return None
df = pd.read_table(StringIO(lines), names=ct.TICK_COLUMNS,
skiprows=[0])
except Exception as e:
print(e)
else:
return df
raise IOError(ct.NETWORK_URL_ERROR_MSG)