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

Dev #5267

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Dev #5267

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2916,9 +2916,10 @@
1.15.4 fix: fix stock_allotment_cninfo interface
1.15.5 fix: fix stock_individual_spot_xq interface
1.15.6 fix: fix qdii_e_index_jsl interface
1.15.7 fix: fix index_hist_sw interface
"""

__version__ = "1.15.6"
__version__ = "1.15.7"
__author__ = "AKFamily"

import sys
Expand Down
36 changes: 18 additions & 18 deletions akshare/index/index_research_sw.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2024/5/22 15:00
Date: 2024/10/23 13:00
Desc: 申万宏源研究-指数系列
https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex
https://www.swsresearch.com/institute_sw/allIndex/releasedIndex
"""

import math
Expand All @@ -17,7 +17,7 @@
def index_hist_sw(symbol: str = "801030", period: str = "day") -> pd.DataFrame:
"""
申万宏源研究-指数发布-指数详情-指数历史数据
https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
:param symbol: 指数代码
:type symbol: str
:param period: choice of {"day", "week", "month"}
Expand All @@ -30,7 +30,7 @@ def index_hist_sw(symbol: str = "801030", period: str = "day") -> pd.DataFrame:
"week": "WEEK",
"month": "MONTH",
}
url = "https://www.swhyresearch.com/institute-sw/api/index_publish/trend/"
url = "https://www.swsresearch.com/institute-sw/api/index_publish/trend/"
params = {
"swindexcode": symbol,
"period": period_map[period],
Expand Down Expand Up @@ -81,14 +81,14 @@ def index_hist_sw(symbol: str = "801030", period: str = "day") -> pd.DataFrame:
def index_min_sw(symbol: str = "801001") -> pd.DataFrame:
"""
申万宏源研究-指数发布-指数详情-指数分时数据
https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
:param symbol: 指数代码
:type symbol: str
:return: 指数分时数据
:rtype: pandas.DataFrame
"""
url = (
"https://www.swhyresearch.com/institute-sw/api/index_publish/details/timelines/"
"https://www.swsresearch.com/institute-sw/api/index_publish/details/timelines/"
)
params = {
"swindexcode": symbol,
Expand Down Expand Up @@ -127,13 +127,13 @@ def index_min_sw(symbol: str = "801001") -> pd.DataFrame:
def index_component_sw(symbol: str = "801001") -> pd.DataFrame:
"""
申万宏源研究-指数发布-指数详情-成分股
https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=%E7%94%B3%E4%B8%8750
:param symbol: 指数代码
:type symbol: str
:return: 成分股
:rtype: pandas.DataFrame
"""
url = "https://www.swhyresearch.com/institute-sw/api/index_publish/details/component_stocks/"
url = "https://www.swsresearch.com/institute-sw/api/index_publish/details/component_stocks/"
params = {"swindexcode": symbol, "page": "1", "page_size": "10000"}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
Expand Down Expand Up @@ -221,7 +221,7 @@ def __index_realtime_sw(symbol: str = "大类风格指数") -> pd.DataFrame:
def index_realtime_sw(symbol: str = "二级行业") -> pd.DataFrame:
"""
申万宏源研究-指数系列
https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex
https://www.swsresearch.com/institute_sw/allIndex/releasedIndex
:param symbol: choice of {"市场表征", "一级行业", "二级行业", "风格指数", "大类风格指数", "金创指数"}
:type symbol: str
:return: 指数系列实时行情数据
Expand All @@ -230,7 +230,7 @@ def index_realtime_sw(symbol: str = "二级行业") -> pd.DataFrame:
if symbol in {"大类风格指数", "金创指数"}:
temp_df = __index_realtime_sw(symbol)
return temp_df
url = "https://www.swhyresearch.com/institute-sw/api/index_publish/current/"
url = "https://www.swsresearch.com/institute-sw/api/index_publish/current/"
params = {"page": "1", "page_size": "50", "indextype": symbol}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
Expand Down Expand Up @@ -289,7 +289,7 @@ def index_analysis_daily_sw(
) -> pd.DataFrame:
"""
申万宏源研究-指数分析
https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
https://www.swsresearch.com/institute_sw/allIndex/analysisIndex
:param symbol: choice of {"市场表征", "一级行业", "二级行业", "风格指数"}
:type symbol: str
:param start_date: 开始日期
Expand All @@ -299,7 +299,7 @@ def index_analysis_daily_sw(
:return: 指数分析
:rtype: pandas.DataFrame
"""
url = "https://www.swhyresearch.com/institute-sw/api/index_analysis/index_analysis_report/"
url = "https://www.swsresearch.com/institute-sw/api/index_analysis/index_analysis_report/"
params = {
"page": "1",
"page_size": "50",
Expand Down Expand Up @@ -363,13 +363,13 @@ def index_analysis_daily_sw(
def index_analysis_week_month_sw(symbol: str = "month") -> pd.DataFrame:
"""
申万宏源研究-周/月报表-日期序列
https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
https://www.swsresearch.com/institute_sw/allIndex/analysisIndex
:param symbol: choice of {"week", "month"}
:type symbol: str
:return: 日期序列
:rtype: pandas.DataFrame
"""
url = "https://www.swhyresearch.com/institute-sw/api/index_analysis/week_month_datetime/"
url = "https://www.swsresearch.com/institute-sw/api/index_analysis/week_month_datetime/"
params = {"type": symbol.upper()}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
Expand All @@ -392,15 +392,15 @@ def index_analysis_weekly_sw(
) -> pd.DataFrame:
"""
申万宏源研究-指数分析-周报告
https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
https://www.swsresearch.com/institute_sw/allIndex/analysisIndex
:param symbol: choice of {"市场表征", "一级行业", "二级行业", "风格指数"}
:type symbol: str
:param date: 查询日期; 通过调用 ak.index_analysis_week_month_sw(date="20221104") 接口获取
:type date: str
:return: 指数分析
:rtype: pandas.DataFrame
"""
url = "https://www.swhyresearch.com/institute-sw/api/index_analysis/index_analysis_reports/"
url = "https://www.swsresearch.com/institute-sw/api/index_analysis/index_analysis_reports/"
params = {
"page": "1",
"page_size": "50",
Expand Down Expand Up @@ -467,15 +467,15 @@ def index_analysis_monthly_sw(
) -> pd.DataFrame:
"""
申万宏源研究-指数分析-月报告
https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
https://www.swsresearch.com/institute_sw/allIndex/analysisIndex
:param symbol: choice of {"市场表征", "一级行业", "二级行业", "风格指数"}
:type symbol: str
:param date: 查询日期; 通过调用 ak.index_analysis_week_month_sw() 接口获取
:type date: str
:return: 指数分析
:rtype: pandas.DataFrame
"""
url = "https://www.swhyresearch.com/institute-sw/api/index_analysis/index_analysis_reports/"
url = "https://www.swsresearch.com/institute-sw/api/index_analysis/index_analysis_reports/"
params = {
"page": "1",
"page_size": "50",
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@

## 更新说明详情

1.15.7 fix: fix index_hist_sw interface

1. 修复 index_hist_sw 接口

1.15.6 fix: fix qdii_e_index_jsl interface

1. 修复 qdii_e_index_jsl 接口
Expand Down Expand Up @@ -4670,6 +4674,8 @@

## 版本更新说明

1.15.7 fix: fix index_hist_sw interface

1.15.6 fix: fix qdii_e_index_jsl interface

1.15.5 fix: fix stock_individual_spot_xq interface
Expand Down
14 changes: 7 additions & 7 deletions docs/data/index/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4624,7 +4624,7 @@ print(index_hist_fund_sw_df)

接口: index_realtime_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex
目标地址: https://www.swsresearch.com/institute_sw/allIndex/releasedIndex

描述: 申万宏源研究-指数系列; 注意其中大类风格指数和金创指数的字段

Expand Down Expand Up @@ -4679,7 +4679,7 @@ print(index_realtime_sw_df)

接口: index_hist_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801002&name=申万中小
目标地址: https://www.swsresearch.com//institute_sw/allIndex/releasedIndex/releasedetail?code=801002&name=申万中小

描述: 申万宏源研究-指数发布-指数详情-指数历史数据

Expand Down Expand Up @@ -4736,7 +4736,7 @@ print(index_hist_sw_df)

接口: index_min_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=申万中小
目标地址: https://www.swsresearch.com//institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=申万中小

描述: 申万宏源研究-指数发布-指数详情-指数分时数据

Expand Down Expand Up @@ -4789,7 +4789,7 @@ print(index_min_sw_df)

接口: index_component_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=申万中小
目标地址: https://www.swsresearch.com//institute_sw/allIndex/releasedIndex/releasedetail?code=801001&name=申万中小

描述: 申万宏源研究-指数发布-指数详情-成分股

Expand Down Expand Up @@ -4842,7 +4842,7 @@ print(index_component_sw_df)

接口: index_analysis_daily_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
目标地址: https://www.swsresearch.com//institute_sw/allIndex/analysisIndex

描述: 申万宏源研究-指数分析-日报表

Expand Down Expand Up @@ -4904,7 +4904,7 @@ print(index_analysis_daily_sw_df)

接口: index_analysis_weekly_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
目标地址: https://www.swsresearch.com//institute_sw/allIndex/analysisIndex

描述: 申万宏源研究-指数分析-周报表

Expand Down Expand Up @@ -4965,7 +4965,7 @@ print(index_analysis_weekly_sw_df)

接口: index_analysis_monthly_sw

目标地址: https://www.swhyresearch.com/institute_sw/allIndex/analysisIndex
目标地址: https://www.swsresearch.com/institute_sw/allIndex/analysisIndex

描述: 申万宏源研究-指数分析-月报表

Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**风险提示**:[AKShare](https://github.com/akfamily/akshare) 开源财经数据接口库所采集的数据皆来自公开的数据源,不涉及任何个人隐私数据和非公开数据。
同时本项目提供的数据接口及相关数据仅用于学术研究,任何个人、机构及团体使用本项目的数据接口及相关数据请注意商业风险。

1. 本文档更新时间:**2024-10-22**;
1. 本文档更新时间:**2024-10-23**;
2. 如有 [AKShare](https://github.com/akfamily/akshare) 库、文档及数据的相关问题,请在 [AKShare Issues](https://github.com/akfamily/akshare/issues) 中提 Issues;
3. 欢迎关注 **数据科学实战** 微信公众号;<div><img src="https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/qrcode/ds.png"></div>
4. **知识星球【数据科学实战】** 2024 全新改版,聚焦于量化投资内容,欢迎加入 **知识星球【数据科学实战】** 高质量社区,里面有丰富的视频课程、问答、文章、书籍及代码等内容:
Expand Down