Ashare icon indicating copy to clipboard operation
Ashare copied to clipboard

无意中发现新浪的数据,没有复权

Open xinianyang opened this issue 2 years ago • 4 comments

无意中发现新浪的数据,没有复权

xinianyang avatar Aug 31 '23 06:08 xinianyang

但不知道如何修改。。。。

xinianyang avatar Aug 31 '23 06:08 xinianyang

我也发现了,所以来看看。试试腾讯的有没有复权,把主力和备用对换一下就行。我测试一下告诉你们结果。 `def get_price(code, end_date='',count=10, frequency='1d', fields=[]): #对外暴露只有唯一函数,这样对用户才是最友好的
xcode= code.replace('.XSHG','').replace('.XSHE','') #证券代码编码兼容处理 xcode='sh'+xcode if ('XSHG' in code) else 'sz'+xcode if ('XSHE' in code) else code

if  frequency in ['1d','1w','1M']:   #1d日线  1w周线  1M月线
     try:
        return get_price_day_tx(xcode,end_date=end_date,count=count,frequency=frequency)#备用                    
     except:
        return get_price_sina(xcode, end_date=end_date,count=count,frequency=frequency)#主力
if  frequency in ['1m','5m','15m','30m','60m']:  #分钟线 ,1m只有腾讯接口  5分钟5m   60分钟60m
     if frequency in '1m': return get_price_min_tx(xcode,end_date=end_date,count=count,frequency=frequency)
     try:
        return get_price_min_tx(xcode,end_date=end_date,count=count,frequency=frequency)   #备用
     except:
        return get_price_sina(xcode,end_date=end_date,count=count,frequency=frequency)   #主力   
    `

Iongtimenosee avatar Oct 10 '23 04:10 Iongtimenosee

经测试换疼讯的日,周线也都没有复权。只能做部分ETF了。

Iongtimenosee avatar Oct 10 '23 05:10 Iongtimenosee

能不能获取历史的“昨收”数据?我有现成的复权代码,能获取昨收的话可以把复权代码套上计算复权后的结果

Altixu avatar May 15 '24 13:05 Altixu