Giter VIP home page Giter VIP logo

Comments (1)

albertandking avatar albertandking commented on June 25, 2024

遇到任何问题,请先确认您的 AKShare 版本是最新的

pip install akshare --upgrade  # Python 版本需要大于等于 3.8

描述遇到的问题 操作系统版本 win11 Python 版本 3.10.11 AKShare 版本 1.13.38 接口的名称和代码 fund_etf_hist_min_em 接口报错的截图或代码 左边为昨天获取到159509.SZ的数据,右边是今天获取到159509.SZ的数据,昨天可以获取到23号为什么今天不行 image

import akshare as ak
import time
import os

path = "ETF数据"  # 目标目录的名称
start_time = '20240101 09:30:00'   # 开始时间
end_time = '20240415 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. 期望获得的正确结果
    正常获取数据

接口正常,只能获取近【期】的数据

from akshare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.