Comments (3)
描述遇到的问题
- 接口的名称和代码
- 接口报错的截图或代码
- 期望获得的正确结果
def stock_board_industry_index_ths( symbol: str = "半导体及元件", start_date: str = "20200101", end_date: str = "20211027", ) -> pd.DataFrame: """ 同花顺-板块-行业板块-指数数据 http://q.10jqka.com.cn/gn/detail/code/301558/ :param start_date: 开始时间 :type start_date: str :param end_date: 结束时间 :type end_date: str :param symbol: 指数数据 :type symbol: str :return: 指数数据 :rtype: pandas.DataFrame """ code_map = stock_board_industry_name_ths() code_map = dict(zip(code_map["name"].values, code_map["code"].values)) symbol_code = code_map[symbol] big_df = pd.DataFrame() current_year = datetime.now().year for year in tqdm(range(2000, current_year + 1), leave=False): .......... big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.index = pd.to_datetime(big_df["日期"]) big_df = big_df[start_date:end_date] big_df.reset_index(drop=True, inplace=True) big_df["开盘价"] = pd.to_numeric(big_df["开盘价"], errors="coerce") big_df["最高价"] = pd.to_numeric(big_df["最高价"], errors="coerce") big_df["最低价"] = pd.to_numeric(big_df["最低价"], errors="coerce") big_df["收盘价"] = pd.to_numeric(big_df["收盘价"], errors="coerce") big_df["成交量"] = pd.to_numeric(big_df["成交量"], errors="coerce") big_df["成交额"] = pd.to_numeric(big_df["成交额"], errors="coerce") return big_dfstock_board_industry_index_ths接口接受参数start_date和end_date,但采集数据是固定从2000年至今,只有在返回结果时才通过传入的start_date和end_date截取并返回。这样比较低效,建议改为通过传入的时间采集。
数据源暂不支持
from akshare.
for year in tqdm(range(2000, current_year + 1), leave=False):
url = f"http://d.10jqka.com.cn/v4/line/bk_{symbol_code}/01/{year}.js"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
"Referer": "http://q.10jqka.com.cn",
"Host": "d.10jqka.com.cn",
}
这里的'year'改为start_date的年即可
from akshare.
for year in tqdm(range(2000, current_year + 1), leave=False): url = f"http://d.10jqka.com.cn/v4/line/bk_{symbol_code}/01/{year}.js" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36", "Referer": "http://q.10jqka.com.cn", "Host": "d.10jqka.com.cn", }这里的'year'改为start_date的年即可
感谢提供解决方案,已修复该问题,升级到 AKShare 1.12.18 使用
from akshare.
Related Issues (20)
- stock_fhps_detail_ths warning HOT 1
- 期货上期所获取期货合约信息函数报错futures_contract_info_shfe HOT 4
- 个股新闻查询-AKShare 接口问题报告 HOT 1
- 上期所数据获取问题及其解决 HOT 5
- AKShare 沪深股通数据接口 stock_hsgt_hist_em 返回数据异常 HOT 1
- 上期所获取合约信息函数报错,更改网址仍然失效 ak.futures_contract_info_shfe(date=day) HOT 2
- 需求:华尔街见闻的宏观日历 HOT 2
- AKShare 接口问题报告 HOT 3
- 接口问题报告:同花顺行业板块实时信息接口 数据延迟 HOT 2
- stock_zh_index_daily 不支持多周期(日,分钟级别K线) HOT 1
- AKShare 接口问题报告 HOT 1
- stock_zh_a_hist_min_em的1分钟返回数据的open为0 HOT 1
- AKShare 接口问题报告ak.stock_news_em() HOT 5
- AKShare 获取持仓排名 HOT 2
- 获取东财三大报表时接口报错 HOT 1
- 申万行情接口 index_realtime_sw 报错 HOT 2
- AKShare 接口问题报告 HOT 1
- AKShare 接口问题报告 - index_analysis_daily_sw HOT 2
- AKShare 接口问题报告 HOT 1
- AKShare 接口问题报告ak.index_detail_cni()接口报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akshare.