Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xinianyang opened this issue Aug 31, 2023 · 4 comments
Open

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

xinianyang opened this issue Aug 31, 2023 · 4 comments

Comments

@xinianyang
Copy link

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

@xinianyang
Copy link
Author

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

@Iongtimenosee
Copy link

Iongtimenosee commented Oct 10, 2023

我也发现了,所以来看看。试试腾讯的有没有复权,把主力和备用对换一下就行。我测试一下告诉你们结果。
`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
Copy link

Iongtimenosee commented Oct 10, 2023

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

@Molo-Y
Copy link

Molo-Y commented May 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants