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

AKShare 接口问题报告 #4754

Closed
lll666666 opened this issue Apr 15, 2024 · 2 comments
Closed

AKShare 接口问题报告 #4754

lll666666 opened this issue Apr 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lll666666
Copy link

lll666666 commented Apr 15, 2024

描述遇到的问题

  1. 操作系统版本
    win11
  2. Python 版本
    3.10.11
  3. AKShare 版本
    1.13.38
  4. 接口的名称和代码
    fund_etf_hist_min_em
import akshare as ak
import time
import os

path = "ETF数据"  # 目标目录的名称
start_time = '2023-10-1 09:30:00'   # 开始时间
end_time = '2023-12-31 15:00:00'     # 结束时间
if not os.path.exists(path):  # 判断目标目录是否存在
    print("-----------------------无”{}“目录".format(path))
    os.makedirs(path)  # 创建目标目录
    print("-----------------------已创建”{}“目录至该程序同目录下".format(path))

def download_data(symbol):
    print(symbol)
    code = symbol[:6]
    df = ak.fund_etf_hist_min_em(symbol=code, period="5", adjust="", start_date='{}'.format(start_time),
                             end_date='{}'.format(end_time))
    print(df)
    df.to_csv('{}\\{}.csv'.format(path, symbol), encoding='gbk')
    print("{}-{}数据-{}已保存至“{}”目录下".format(start_time, end_time, symbol, path))
    time.sleep(2)
    
if __name__ == '__main__':
    # ETF池列表
    symbols = [
       '159501.SZ',
       '159502.SZ',
       '159506.SZ',
       '159509.SZ',
       '159513.SZ',
       '159518.SZ',
       '159519.SZ',
       '159529.SZ',
       '159567.SZ',
       '159568.SZ',
       '159570.SZ',
       '159577.SZ',
       '159605.SZ',
       '159607.SZ',
       '159612.SZ',
       '159615.SZ',
       '159632.SZ',
       '159636.SZ',
       '159655.SZ',
       '159659.SZ',
       '159660.SZ',
       '159687.SZ',
       '159688.SZ',
       '159691.SZ',
       '159696.SZ',
       '159699.SZ',
       '159711.SZ',
       '159712.SZ',
       '159718.SZ',
       '159726.SZ',
       '159735.SZ',
       '159740.SZ',
       '159741.SZ',
       '159742.SZ',
       '159747.SZ',
       '159750.SZ',
       '159751.SZ',
       '159776.SZ',
       '159788.SZ',
       '159792.SZ',
       '159822.SZ',
       '159823.SZ',
       '159850.SZ',
       '159866.SZ',
       '159892.SZ',
       '159920.SZ',
       '159941.SZ',
       '159954.SZ',
       '159960.SZ',
       '510900.SH',
       '513000.SH',
       '513010.SH',
       '513020.SH',
       '513030.SH',
       '513040.SH',
       '513050.SH',
       '513060.SH',
       '513070.SH',
       '513080.SH',
       '513090.SH',
       '513100.SH',
       '513110.SH',
       '513120.SH',
       '513130.SH',
       '513140.SH',
       '513150.SH',
       '513160.SH',
       '513180.SH',
       '513190.SH',
       '513200.SH',
       '513220.SH',
       '513230.SH',
       '513260.SH',
       '513280.SH',
       '513290.SH',
       '513300.SH',
       '513310.SH',
       '513320.SH',
       '513330.SH',
       '513350.SH',
       '513360.SH',
       '513380.SH',
       '513390.SH',
       '513400.SH',
       '513500.SH',
       '513520.SH',
       '513530.SH',
       '513550.SH',
       '513560.SH',
       '513580.SH',
       '513590.SH',
       '513600.SH',
       '513630.SH',
       '513650.SH',
       '513660.SH',
       '513690.SH',
       '513700.SH',
       '513730.SH',
       '513750.SH',
       '513770.SH',
       '513800.SH',
       '513810.SH',
       '513850.SH',
       '513860.SH',
       '513870.SH',
       '513880.SH',
       '513890.SH',
       '513900.SH',
       '513910.SH',
       '513920.SH',
       '513950.SH',
       '513960.SH',
       '513970.SH',
       '513980.SH',
       '513990.SH'
    ]  # ETF池列表
    for symbol in symbols:
        download_data(symbol)

  1. 接口报错的截图或代码
    我用示例的代码也获取不到数据
    获取不到数据
    image

  2. 期望获得的正确结果
    正确获取数据

不知道是不是bug还是我的代码有问题

@lll666666 lll666666 added the bug Something isn't working label Apr 15, 2024
@albertandking
Copy link
Collaborator

start_time = '2023-10-1 09:30:00'

start_time = '2023-10-1 09:30:00' 写完整

@lll666666
Copy link
Author

start_time = '2023-10-1 09:30:00'

start_time = '2023-10-1 09:30:00' 写完整

我用start_time = '2023-10-01 09:30:00'还是start_time = '20231001 09:30:00'还是一样没有数据

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants