nwo
stringlengths 10
28
| sha
stringlengths 40
40
| path
stringlengths 11
97
| identifier
stringlengths 1
64
| parameters
stringlengths 2
2.24k
| return_statement
stringlengths 0
2.17k
| docstring
stringlengths 0
5.45k
| docstring_summary
stringlengths 0
3.83k
| func_begin
int64 1
13.4k
| func_end
int64 2
13.4k
| function
stringlengths 28
56.4k
| url
stringlengths 106
209
| project
int64 1
48
| executed_lines
list | executed_lines_pc
float64 0
153
| missing_lines
list | missing_lines_pc
float64 0
100
| covered
bool 2
classes | filecoverage
float64 2.53
100
| function_lines
int64 2
1.46k
| mccabe
int64 1
253
| coverage
float64 0
100
| docstring_lines
int64 0
112
| function_nodoc
stringlengths 9
56.4k
| id
int64 0
29.8k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdfx_em.py
|
stock_gdfx_holding_detail_em
|
(date: str = "20210930")
|
return big_df
|
东方财富网-数据中心-股东分析-股东持股明细-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
|
东方财富网-数据中心-股东分析-股东持股明细-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
| 578 | 670 |
def stock_gdfx_holding_detail_em(date: str = "20210930") -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东持股明细-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "NOTICE_DATE,SECURITY_CODE,RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_DMSK_HOLDERS",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"报告期",
"股东排名",
"-",
"股东名称",
"期末持股-数量",
"期末持股-持股占流通股比",
"期末持股-数量变化",
"期末持股-数量变化比例",
"-",
"-",
"-",
"-",
"-",
"公告日",
"期末持股-流通市值",
"-",
"-",
"股票简称",
"-",
"-",
"-",
"期末持股-持股变动",
"-",
"股东类型",
"-",
"-",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股东排名",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-持股占流通股比",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
]
]
big_df["报告期"] = pd.to_datetime(big_df["报告期"]).dt.date
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-持股占流通股比"] = pd.to_numeric(big_df["期末持股-持股占流通股比"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdfx_em.py#L578-L670
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 9.677419 |
[
9,
10,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
67,
85,
86,
87,
88,
89,
90,
91,
92
] | 25.806452 | false | 5.647841 | 93 | 2 | 74.193548 | 6 |
def stock_gdfx_holding_detail_em(date: str = "20210930") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "NOTICE_DATE,SECURITY_CODE,RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_DMSK_HOLDERS",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"报告期",
"股东排名",
"-",
"股东名称",
"期末持股-数量",
"期末持股-持股占流通股比",
"期末持股-数量变化",
"期末持股-数量变化比例",
"-",
"-",
"-",
"-",
"-",
"公告日",
"期末持股-流通市值",
"-",
"-",
"股票简称",
"-",
"-",
"-",
"期末持股-持股变动",
"-",
"股东类型",
"-",
"-",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股东排名",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-持股占流通股比",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
]
]
big_df["报告期"] = pd.to_datetime(big_df["报告期"]).dt.date
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-持股占流通股比"] = pd.to_numeric(big_df["期末持股-持股占流通股比"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
return big_df
| 17,834 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdfx_em.py
|
stock_gdfx_free_holding_analyse_em
|
(date: str = "20210930")
|
return big_df
|
东方财富网-数据中心-股东分析-股东持股分析-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大流通股东
:rtype: pandas.DataFrame
|
东方财富网-数据中心-股东分析-股东持股分析-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大流通股东
:rtype: pandas.DataFrame
| 673 | 776 |
def stock_gdfx_free_holding_analyse_em(date: str = "20210930") -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东持股分析-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大流通股东
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "UPDATE_DATE,SECURITY_CODE,HOLDER_RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_F10_EH_FREEHOLDERS_JOIN_FREEHOLDER_SHAREANALYSIS",
"columns": "ALL;D10_ADJCHRATE,D30_ADJCHRATE,D60_ADJCHRATE",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"股东名称",
"期末持股-数量",
"-",
"-",
"-",
"-",
"-",
"股票简称",
"-",
"-",
"-",
"期末持股-流通市值",
"-",
"-",
"期末持股-数量变化比例",
"股东类型",
"-",
"公告日",
"报告期",
"-",
"-",
"-",
"-",
"-",
"-",
"期末持股-持股变动",
"-",
"-",
"-",
"-",
"期末持股-数量变化",
"-",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
]
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
big_df["公告日后涨跌幅-10个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-10个交易日"])
big_df["公告日后涨跌幅-30个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-30个交易日"])
big_df["公告日后涨跌幅-60个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-60个交易日"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdfx_em.py#L673-L776
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 8.653846 |
[
9,
10,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
76,
95,
96,
97,
98,
99,
100,
101,
102,
103
] | 24.038462 | false | 5.647841 | 104 | 2 | 75.961538 | 6 |
def stock_gdfx_free_holding_analyse_em(date: str = "20210930") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "UPDATE_DATE,SECURITY_CODE,HOLDER_RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_F10_EH_FREEHOLDERS_JOIN_FREEHOLDER_SHAREANALYSIS",
"columns": "ALL;D10_ADJCHRATE,D30_ADJCHRATE,D60_ADJCHRATE",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"股东名称",
"期末持股-数量",
"-",
"-",
"-",
"-",
"-",
"股票简称",
"-",
"-",
"-",
"期末持股-流通市值",
"-",
"-",
"期末持股-数量变化比例",
"股东类型",
"-",
"公告日",
"报告期",
"-",
"-",
"-",
"-",
"-",
"-",
"期末持股-持股变动",
"-",
"-",
"-",
"-",
"期末持股-数量变化",
"-",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
]
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
big_df["公告日后涨跌幅-10个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-10个交易日"])
big_df["公告日后涨跌幅-30个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-30个交易日"])
big_df["公告日后涨跌幅-60个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-60个交易日"])
return big_df
| 17,835 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdfx_em.py
|
stock_gdfx_holding_analyse_em
|
(date: str = "20220331")
|
return big_df
|
东方财富网-数据中心-股东分析-股东持股分析-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
|
东方财富网-数据中心-股东分析-股东持股分析-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
| 779 | 877 |
def stock_gdfx_holding_analyse_em(date: str = "20220331") -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东持股分析-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:param date: 报告期
:type date: str
:return: 十大股东
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "NOTICE_DATE,SECURITY_CODE,RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_DMSK_HOLDERS_JOIN_HOLDER_SHAREANALYSIS",
"columns": "ALL;D10_ADJCHRATE,D30_ADJCHRATE,D60_ADJCHRATE",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"报告期",
"-",
"-",
"股东名称",
"期末持股-数量",
"-",
"期末持股-数量变化",
"期末持股-数量变化比例",
"-",
"-",
"股东类型",
"-",
"-",
"公告日",
"-",
"-",
"-",
"股票简称",
"-",
"-",
"期末持股-持股变动",
"期末持股-流通市值",
"-",
"-",
"-",
"-",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
]
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["报告期"] = pd.to_datetime(big_df["报告期"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
big_df["公告日后涨跌幅-10个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-10个交易日"])
big_df["公告日后涨跌幅-30个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-30个交易日"])
big_df["公告日后涨跌幅-60个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-60个交易日"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdfx_em.py#L779-L877
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 9.090909 |
[
9,
10,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
70,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98
] | 26.262626 | false | 5.647841 | 99 | 2 | 73.737374 | 6 |
def stock_gdfx_holding_analyse_em(date: str = "20220331") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "NOTICE_DATE,SECURITY_CODE,RANK",
"sortTypes": "-1,1,1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_DMSK_HOLDERS_JOIN_HOLDER_SHAREANALYSIS",
"columns": "ALL;D10_ADJCHRATE,D30_ADJCHRATE,D60_ADJCHRATE",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股票代码",
"-",
"-",
"报告期",
"-",
"-",
"股东名称",
"期末持股-数量",
"-",
"期末持股-数量变化",
"期末持股-数量变化比例",
"-",
"-",
"股东类型",
"-",
"-",
"公告日",
"-",
"-",
"-",
"股票简称",
"-",
"-",
"期末持股-持股变动",
"期末持股-流通市值",
"-",
"-",
"-",
"-",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"股票代码",
"股票简称",
"报告期",
"期末持股-数量",
"期末持股-数量变化",
"期末持股-数量变化比例",
"期末持股-持股变动",
"期末持股-流通市值",
"公告日",
"公告日后涨跌幅-10个交易日",
"公告日后涨跌幅-30个交易日",
"公告日后涨跌幅-60个交易日",
]
]
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
big_df["报告期"] = pd.to_datetime(big_df["报告期"]).dt.date
big_df["期末持股-数量"] = pd.to_numeric(big_df["期末持股-数量"])
big_df["期末持股-数量变化"] = pd.to_numeric(big_df["期末持股-数量变化"])
big_df["期末持股-数量变化比例"] = pd.to_numeric(big_df["期末持股-数量变化比例"])
big_df["期末持股-流通市值"] = pd.to_numeric(big_df["期末持股-流通市值"])
big_df["公告日后涨跌幅-10个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-10个交易日"])
big_df["公告日后涨跌幅-30个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-30个交易日"])
big_df["公告日后涨跌幅-60个交易日"] = pd.to_numeric(big_df["公告日后涨跌幅-60个交易日"])
return big_df
| 17,836 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdfx_em.py
|
stock_gdfx_free_holding_teamwork_em
|
()
|
return big_df
|
东方财富网-数据中心-股东分析-股东协同-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大流通股东
:rtype: pandas.DataFrame
|
东方财富网-数据中心-股东分析-股东协同-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大流通股东
:rtype: pandas.DataFrame
| 880 | 934 |
def stock_gdfx_free_holding_teamwork_em() -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东协同-十大流通股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大流通股东
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "COOPERAT_NUM,HOLDER_NEW,COOPERAT_HOLDER_NEW",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_COOPFREEHOLDER",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股东名称",
"股东类型",
"-",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
]
big_df["协同次数"] = pd.to_numeric(big_df["协同次数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdfx_em.py#L880-L934
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
29,
30,
31,
42,
53,
54
] | 32.727273 | false | 5.647841 | 55 | 2 | 67.272727 | 4 |
def stock_gdfx_free_holding_teamwork_em() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "COOPERAT_NUM,HOLDER_NEW,COOPERAT_HOLDER_NEW",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_COOPFREEHOLDER",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股东名称",
"股东类型",
"-",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
]
big_df["协同次数"] = pd.to_numeric(big_df["协同次数"])
return big_df
| 17,837 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdfx_em.py
|
stock_gdfx_holding_teamwork_em
|
()
|
return big_df
|
东方财富网-数据中心-股东分析-股东协同-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大股东
:rtype: pandas.DataFrame
|
东方财富网-数据中心-股东分析-股东协同-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大股东
:rtype: pandas.DataFrame
| 937 | 991 |
def stock_gdfx_holding_teamwork_em() -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东协同-十大股东
https://data.eastmoney.com/gdfx/HoldingAnalyse.html
:return: 十大股东
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "COOPERAT_NUM,HOLDER_NEW,COOPERAT_HOLDER_NEW",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_TENHOLDERS_COOPHOLDERS",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股东名称",
"股东类型",
"-",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
]
big_df["协同次数"] = pd.to_numeric(big_df["协同次数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdfx_em.py#L937-L991
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
29,
30,
31,
42,
53,
54
] | 32.727273 | false | 5.647841 | 55 | 2 | 67.272727 | 4 |
def stock_gdfx_holding_teamwork_em() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "COOPERAT_NUM,HOLDER_NEW,COOPERAT_HOLDER_NEW",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_TENHOLDERS_COOPHOLDERS",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"股东名称",
"股东类型",
"-",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
big_df = big_df[
[
"序号",
"股东名称",
"股东类型",
"协同股东名称",
"协同股东类型",
"协同次数",
"个股详情",
]
]
big_df["协同次数"] = pd.to_numeric(big_df["协同次数"])
return big_df
| 17,838 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdzjc_em.py
|
stock_ggcg_em
|
(symbol: str = "全部") ->
|
return big_df
|
东方财富网-数据中心-特色数据-高管持股
http://data.eastmoney.com/executive/gdzjc.html
:param symbol: choice of {"全部", "股东增持", "股东减持"}
:type symbol: str
:return: 高管持股
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-高管持股
http://data.eastmoney.com/executive/gdzjc.html
:param symbol: choice of {"全部", "股东增持", "股东减持"}
:type symbol: str
:return: 高管持股
:rtype: pandas.DataFrame
| 14 | 119 |
def stock_ggcg_em(symbol: str = "全部") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-高管持股
http://data.eastmoney.com/executive/gdzjc.html
:param symbol: choice of {"全部", "股东增持", "股东减持"}
:type symbol: str
:return: 高管持股
:rtype: pandas.DataFrame
"""
symbol_map = {
"全部": "",
"股东增持": '(DIRECTION="增持")',
"股东减持": '(DIRECTION="减持")',
}
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "END_DATE,SECURITY_CODE,EITIME",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_SHARE_HOLDER_INCREASE",
"quoteColumns": "f2~01~SECURITY_CODE~NEWEST_PRICE,f3~01~SECURITY_CODE~CHANGE_RATE_QUOTES",
"quoteType": "0",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": symbol_map[symbol],
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update(
{
"pageNumber": page,
}
)
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"持股变动信息-变动数量",
"公告日",
"代码",
"股东名称",
"持股变动信息-占总股本比例",
"_",
"-",
"变动截止日",
"-",
"变动后持股情况-持股总数",
"变动后持股情况-占总股本比例",
"_",
"变动后持股情况-占流通股比例",
"变动后持股情况-持流通股数",
"_",
"名称",
"持股变动信息-增减",
"_",
"持股变动信息-占流通股比例",
"变动开始日",
"_",
"最新价",
"涨跌幅",
"_",
]
big_df = big_df[
[
"代码",
"名称",
"最新价",
"涨跌幅",
"股东名称",
"持股变动信息-增减",
"持股变动信息-变动数量",
"持股变动信息-占总股本比例",
"持股变动信息-占流通股比例",
"变动后持股情况-持股总数",
"变动后持股情况-占总股本比例",
"变动后持股情况-持流通股数",
"变动后持股情况-占流通股比例",
"变动开始日",
"变动截止日",
"公告日",
]
]
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["持股变动信息-变动数量"])
big_df["持股变动信息-占总股本比例"] = pd.to_numeric(big_df["持股变动信息-占总股本比例"])
big_df["持股变动信息-占流通股比例"] = pd.to_numeric(big_df["持股变动信息-占流通股比例"])
big_df["变动后持股情况-持股总数"] = pd.to_numeric(big_df["变动后持股情况-持股总数"])
big_df["变动后持股情况-占总股本比例"] = pd.to_numeric(big_df["变动后持股情况-占总股本比例"])
big_df["变动后持股情况-持流通股数"] = pd.to_numeric(big_df["变动后持股情况-持流通股数"])
big_df["变动后持股情况-占流通股比例"] = pd.to_numeric(big_df["变动后持股情况-占流通股比例"])
big_df["变动开始日"] = pd.to_datetime(big_df["变动开始日"]).dt.date
big_df["变动截止日"] = pd.to_datetime(big_df["变动截止日"]).dt.date
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdzjc_em.py#L14-L119
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 8.490566 |
[
9,
14,
15,
29,
30,
31,
32,
33,
34,
39,
40,
41,
42,
44,
71,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
105
] | 26.415094 | false | 16.666667 | 106 | 2 | 73.584906 | 6 |
def stock_ggcg_em(symbol: str = "全部") -> pd.DataFrame:
symbol_map = {
"全部": "",
"股东增持": '(DIRECTION="增持")',
"股东减持": '(DIRECTION="减持")',
}
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "END_DATE,SECURITY_CODE,EITIME",
"sortTypes": "-1,-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_SHARE_HOLDER_INCREASE",
"quoteColumns": "f2~01~SECURITY_CODE~NEWEST_PRICE,f3~01~SECURITY_CODE~CHANGE_RATE_QUOTES",
"quoteType": "0",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": symbol_map[symbol],
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update(
{
"pageNumber": page,
}
)
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"持股变动信息-变动数量",
"公告日",
"代码",
"股东名称",
"持股变动信息-占总股本比例",
"_",
"-",
"变动截止日",
"-",
"变动后持股情况-持股总数",
"变动后持股情况-占总股本比例",
"_",
"变动后持股情况-占流通股比例",
"变动后持股情况-持流通股数",
"_",
"名称",
"持股变动信息-增减",
"_",
"持股变动信息-占流通股比例",
"变动开始日",
"_",
"最新价",
"涨跌幅",
"_",
]
big_df = big_df[
[
"代码",
"名称",
"最新价",
"涨跌幅",
"股东名称",
"持股变动信息-增减",
"持股变动信息-变动数量",
"持股变动信息-占总股本比例",
"持股变动信息-占流通股比例",
"变动后持股情况-持股总数",
"变动后持股情况-占总股本比例",
"变动后持股情况-持流通股数",
"变动后持股情况-占流通股比例",
"变动开始日",
"变动截止日",
"公告日",
]
]
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["持股变动信息-变动数量"])
big_df["持股变动信息-占总股本比例"] = pd.to_numeric(big_df["持股变动信息-占总股本比例"])
big_df["持股变动信息-占流通股比例"] = pd.to_numeric(big_df["持股变动信息-占流通股比例"])
big_df["变动后持股情况-持股总数"] = pd.to_numeric(big_df["变动后持股情况-持股总数"])
big_df["变动后持股情况-占总股本比例"] = pd.to_numeric(big_df["变动后持股情况-占总股本比例"])
big_df["变动后持股情况-持流通股数"] = pd.to_numeric(big_df["变动后持股情况-持流通股数"])
big_df["变动后持股情况-占流通股比例"] = pd.to_numeric(big_df["变动后持股情况-占流通股比例"])
big_df["变动开始日"] = pd.to_datetime(big_df["变动开始日"]).dt.date
big_df["变动截止日"] = pd.to_datetime(big_df["变动截止日"]).dt.date
big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date
return big_df
| 17,839 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_zh_valuation_baidu.py
|
stock_zh_valuation_baidu
|
(
symbol: str = "002044", indicator: str = "总市值", period: str = "近一年"
)
|
return temp_df
|
百度股市通- A 股-财务报表-估值数据
https://gushitong.baidu.com/stock/ab-002044
:param symbol: 股票代码
:type symbol: str
:param indicator: choice of {"总市值", "市盈率(TTM)", "市盈率(静)", "市净率", "市现率"}
:type indicator: str
:param period: choice of {"近一年", "近三年", "近五年", "近十年", "全部"}
:type period: str
:return: 估值数据
:rtype: pandas.DataFrame
|
百度股市通- A 股-财务报表-估值数据
https://gushitong.baidu.com/stock/ab-002044
:param symbol: 股票代码
:type symbol: str
:param indicator: choice of {"总市值", "市盈率(TTM)", "市盈率(静)", "市净率", "市现率"}
:type indicator: str
:param period: choice of {"近一年", "近三年", "近五年", "近十年", "全部"}
:type period: str
:return: 估值数据
:rtype: pandas.DataFrame
| 12 | 43 |
def stock_zh_valuation_baidu(
symbol: str = "002044", indicator: str = "总市值", period: str = "近一年"
) -> pd.DataFrame:
"""
百度股市通- A 股-财务报表-估值数据
https://gushitong.baidu.com/stock/ab-002044
:param symbol: 股票代码
:type symbol: str
:param indicator: choice of {"总市值", "市盈率(TTM)", "市盈率(静)", "市净率", "市现率"}
:type indicator: str
:param period: choice of {"近一年", "近三年", "近五年", "近十年", "全部"}
:type period: str
:return: 估值数据
:rtype: pandas.DataFrame
"""
url = "https://finance.pae.baidu.com/selfselect/openapi"
params = {
"srcid": "51171",
"code": symbol,
"market": "ab",
"tag": f"{indicator}",
"chart_select": period,
"skip_industry": "0",
"finClientType": "pc",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Result"]["chartInfo"][0]["body"])
temp_df.columns = ["date", "value"]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["value"] = pd.to_numeric(temp_df["value"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_zh_valuation_baidu.py#L12-L43
| 25 |
[
0
] | 3.125 |
[
15,
16,
25,
26,
27,
28,
29,
30,
31
] | 28.125 | false | 31.25 | 32 | 1 | 71.875 | 10 |
def stock_zh_valuation_baidu(
symbol: str = "002044", indicator: str = "总市值", period: str = "近一年"
) -> pd.DataFrame:
url = "https://finance.pae.baidu.com/selfselect/openapi"
params = {
"srcid": "51171",
"code": symbol,
"market": "ab",
"tag": f"{indicator}",
"chart_select": period,
"skip_industry": "0",
"finClientType": "pc",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Result"]["chartInfo"][0]["body"])
temp_df.columns = ["date", "value"]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["value"] = pd.to_numeric(temp_df["value"])
return temp_df
| 17,840 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_tfp_em.py
|
stock_tfp_em
|
(date: str = "20220523")
|
return temp_df
|
东方财富网-数据中心-特色数据-停复牌信息
http://data.eastmoney.com/tfpxx/
:param date: specific date as "2020-03-19"
:type date: str
:return: 停复牌信息表
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-停复牌信息
http://data.eastmoney.com/tfpxx/
:param date: specific date as "2020-03-19"
:type date: str
:return: 停复牌信息表
:rtype: pandas.DataFrame
| 12 | 58 |
def stock_tfp_em(date: str = "20220523") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-停复牌信息
http://data.eastmoney.com/tfpxx/
:param date: specific date as "2020-03-19"
:type date: str
:return: 停复牌信息表
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "SUSPEND_START_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_SUSPEND_DATA_INTERFACE",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f"""(MARKET="全部")(DATETIME='{"-".join([date[:4], date[4:6], date[6:]])}')""",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"代码",
"名称",
"停牌时间",
"停牌截止时间",
"停牌期限",
"停牌原因",
"所属市场",
"停牌开始日期",
"预计复牌时间",
"-",
"-",
]
temp_df = temp_df[
["序号", "代码", "名称", "停牌时间", "停牌截止时间", "停牌期限", "停牌原因", "所属市场", "预计复牌时间"]
]
temp_df["停牌时间"] = pd.to_datetime(temp_df["停牌时间"]).dt.date
temp_df["停牌截止时间"] = pd.to_datetime(temp_df["停牌截止时间"]).dt.date
temp_df["预计复牌时间"] = pd.to_datetime(temp_df["预计复牌时间"]).dt.date
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_tfp_em.py#L12-L58
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 19.148936 |
[
9,
10,
21,
22,
23,
24,
25,
26,
40,
43,
44,
45,
46
] | 27.659574 | false | 25 | 47 | 1 | 72.340426 | 6 |
def stock_tfp_em(date: str = "20220523") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "SUSPEND_START_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_CUSTOM_SUSPEND_DATA_INTERFACE",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f"""(MARKET="全部")(DATETIME='{"-".join([date[:4], date[4:6], date[6:]])}')""",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"代码",
"名称",
"停牌时间",
"停牌截止时间",
"停牌期限",
"停牌原因",
"所属市场",
"停牌开始日期",
"预计复牌时间",
"-",
"-",
]
temp_df = temp_df[
["序号", "代码", "名称", "停牌时间", "停牌截止时间", "停牌期限", "停牌原因", "所属市场", "预计复牌时间"]
]
temp_df["停牌时间"] = pd.to_datetime(temp_df["停牌时间"]).dt.date
temp_df["停牌截止时间"] = pd.to_datetime(temp_df["停牌截止时间"]).dt.date
temp_df["预计复牌时间"] = pd.to_datetime(temp_df["预计复牌时间"]).dt.date
return temp_df
| 17,841 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
_get_file_content_ths
|
(file: str = "ths.js")
|
return file_data
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
| 20 | 31 |
def _get_file_content_ths(file: str = "ths.js") -> str:
"""
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
"""
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L20-L31
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 66.666667 |
[
8,
9,
10,
11
] | 33.333333 | false | 10.365854 | 12 | 2 | 66.666667 | 5 |
def _get_file_content_ths(file: str = "ths.js") -> str:
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 17,842 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_board_industry_name_ths
|
()
|
return temp_df
|
同花顺-板块-行业板块-行业
http://q.10jqka.com.cn/thshy/
:return: 所有行业板块的名称和链接
:rtype: pandas.DataFrame
|
同花顺-板块-行业板块-行业
http://q.10jqka.com.cn/thshy/
:return: 所有行业板块的名称和链接
:rtype: pandas.DataFrame
| 34 | 358 |
def stock_board_industry_name_ths() -> pd.DataFrame:
"""
同花顺-板块-行业板块-行业
http://q.10jqka.com.cn/thshy/
:return: 所有行业板块的名称和链接
:rtype: pandas.DataFrame
"""
code_name_ths_map = {
"881101": "种植业与林业",
"881102": "养殖业",
"881103": "农产品加工",
"881104": "农业服务",
"881105": "煤炭开采加工",
"881107": "油气开采及服务",
"881108": "化学原料",
"881109": "化学制品",
"881110": "化工合成材料",
"881112": "钢铁",
"881114": "金属新材料",
"881115": "建筑材料",
"881116": "建筑装饰",
"881117": "通用设备",
"881118": "专用设备",
"881119": "仪器仪表",
"881120": "电力设备",
"881121": "半导体及元件",
"881122": "光学光电子",
"881123": "其他电子",
"881124": "消费电子",
"881125": "汽车整车",
"881126": "汽车零部件",
"881127": "非汽车交运",
"881128": "汽车服务",
"881129": "通信设备",
"881130": "计算机设备",
"881131": "白色家电",
"881132": "黑色家电",
"881133": "饮料制造",
"881134": "食品加工制造",
"881135": "纺织制造",
"881136": "服装家纺",
"881137": "造纸",
"881138": "包装印刷",
"881139": "家用轻工",
"881140": "化学制药",
"881141": "中药",
"881142": "生物制品",
"881143": "医药商业",
"881144": "医疗器械",
"881145": "电力",
"881146": "燃气",
"881148": "港口航运",
"881149": "公路铁路运输",
"881151": "机场航运",
"881152": "物流",
"881153": "房地产开发",
"881155": "银行",
"881156": "保险及其他",
"881157": "证券",
"881158": "零售",
"881159": "贸易",
"881160": "景点及旅游",
"881161": "酒店及餐饮",
"881162": "通信服务",
"881163": "计算机应用",
"881164": "传媒",
"881165": "综合",
"881166": "国防军工",
"881167": "非金属材料",
"881168": "工业金属",
"881169": "贵金属",
"881170": "小金属",
"881171": "自动化设备",
"881172": "电子化学品",
"881173": "小家电",
"881174": "厨卫电器",
"881175": "医疗服务",
"881176": "房地产服务",
"881177": "互联网电商",
"881178": "教育",
"881179": "其他社会服务",
"881180": "石油加工贸易",
"881181": "环保",
"881182": "美容护理",
"884001": "种子生产",
"884002": "粮食种植",
"884003": "其他种植业",
"884004": "林业",
"884005": "海洋捕捞",
"884006": "水产养殖",
"884007": "畜禽养殖",
"884008": "饲料",
"884009": "果蔬加工",
"884010": "粮油加工",
"884011": "其他农产品加工",
"884012": "农业综合",
"884013": "动物保健",
"884014": "煤炭开采",
"884015": "焦炭加工",
"884016": "油气开采",
"884018": "油服工程",
"884020": "石油加工",
"884021": "油品石化贸易",
"884022": "纯碱",
"884023": "氯碱",
"884024": "无机盐",
"884025": "其他化学原料",
"884026": "氮肥",
"884027": "磷肥及磷化工",
"884028": "农药",
"884030": "涂料油墨",
"884031": "钾肥",
"884032": "民爆用品",
"884033": "纺织化学用品",
"884034": "其他化学制品",
"884035": "复合肥",
"884036": "氟化工",
"884039": "聚氨酯",
"884041": "涤纶",
"884043": "粘胶",
"884044": "其他纤维",
"884045": "氨纶",
"884046": "其他塑料制品",
"884048": "改性塑料",
"884050": "其他橡胶制品",
"884051": "炭黑",
"884052": "普钢",
"884053": "铝",
"884054": "铜",
"884055": "铅锌",
"884056": "其他金属新材料",
"884057": "磁性材料",
"884058": "非金属材料Ⅲ",
"884059": "玻璃玻纤",
"884060": "水泥",
"884062": "其他建材",
"884063": "耐火材料",
"884064": "管材",
"884065": "装饰园林",
"884066": "房屋建设",
"884067": "基础建设",
"884068": "专业工程",
"884069": "机床工具",
"884071": "磨具磨料",
"884073": "制冷空调设备",
"884074": "其他通用设备",
"884075": "金属制品",
"884076": "纺织服装设备",
"884077": "工程机械",
"884078": "农用机械",
"884080": "能源及重型设备",
"884081": "印刷包装机械",
"884082": "其他专用设备",
"884083": "楼宇设备",
"884084": "环保设备",
"884085": "电机",
"884086": "电气自控设备",
"884088": "输变电设备",
"884089": "线缆部件及其他",
"884090": "分立器件",
"884091": "半导体材料",
"884092": "印制电路板",
"884093": "被动元件",
"884094": "面板",
"884095": "LED",
"884096": "光学元件",
"884098": "消费电子零部件及组装",
"884099": "乘用车",
"884100": "商用载货车",
"884101": "商用载客车",
"884105": "轨交设备",
"884106": "其他交运设备",
"884107": "汽车服务Ⅲ",
"884112": "冰洗",
"884113": "空调",
"884115": "小家电Ⅲ",
"884116": "其他白色家电",
"884117": "彩电",
"884118": "其他黑色家电",
"884119": "其他酒类",
"884120": "软饮料",
"884123": "肉制品",
"884124": "调味发酵品",
"884125": "乳品",
"884126": "其他食品",
"884128": "棉纺",
"884130": "印染",
"884131": "辅料",
"884132": "其他纺织",
"884136": "鞋帽及其他",
"884137": "家纺",
"884139": "家具",
"884140": "其他家用轻工",
"884141": "饰品",
"884142": "文娱用品",
"884143": "原料药",
"884144": "化学制剂",
"884145": "医疗设备",
"884146": "火电",
"884147": "水电",
"884149": "热力",
"884150": "新能源发电",
"884152": "燃气Ⅲ",
"884153": "港口",
"884154": "高速公路",
"884155": "铁路运输",
"884156": "机场",
"884157": "航空运输",
"884158": "多元金融",
"884159": "保险",
"884160": "百货零售",
"884161": "专业连锁",
"884162": "商业物业经营",
"884163": "人工景点",
"884164": "自然景点",
"884165": "旅游综合",
"884167": "酒店",
"884168": "餐饮",
"884172": "有线电视网络",
"884173": "通信服务Ⅲ",
"884174": "软件开发",
"884176": "出版",
"884177": "影视院线",
"884178": "广告营销",
"884179": "其他传媒",
"884180": "航天装备",
"884181": "航空装备",
"884182": "地面兵装",
"884183": "航海装备",
"884184": "特钢",
"884185": "贵金属Ⅲ",
"884186": "其他小金属",
"884188": "白酒",
"884189": "啤酒",
"884191": "航运",
"884192": "仪器仪表Ⅲ",
"884193": "其他电子Ⅲ",
"884194": "汽车零部件Ⅲ",
"884195": "造纸Ⅲ",
"884197": "中药Ⅲ",
"884199": "医药商业Ⅲ",
"884200": "公交",
"884201": "物流Ⅲ",
"884202": "住宅开发",
"884203": "产业地产",
"884205": "证券Ⅲ",
"884206": "贸易Ⅲ",
"884207": "计算机设备Ⅲ",
"884208": "综合Ⅲ",
"884209": "钛白粉",
"884210": "食品及饲料添加剂",
"884211": "有机硅",
"884212": "合成树脂",
"884213": "膜材料",
"884214": "冶钢原料",
"884215": "稀土",
"884216": "能源金属",
"884217": "工程咨询服务",
"884218": "机器人",
"884219": "工控设备",
"884220": "激光设备",
"884221": "其他自动化设备",
"884222": "光伏设备",
"884223": "风电设备",
"884224": "电池",
"884225": "其他电源设备",
"884226": "集成电路设计",
"884227": "集成电路制造",
"884228": "集成电路封测",
"884229": "半导体设备",
"884230": "品牌消费电子",
"884231": "电子化学品Ⅲ",
"884232": "厨卫电器Ⅲ",
"884233": "休闲食品",
"884234": "服装",
"884235": "印刷",
"884236": "包装",
"884237": "瓷砖地板",
"884238": "血液制品",
"884239": "疫苗",
"884240": "其他生物制品",
"884242": "医疗耗材",
"884243": "体外诊断",
"884244": "医疗研发外包",
"884245": "其他医疗服务",
"884246": "电能综合服务",
"884247": "商业地产",
"884248": "房地产服务Ⅲ",
"884249": "国有大型银行",
"884250": "股份制银行",
"884251": "城商行",
"884252": "农商行",
"884253": "其他银行",
"884254": "旅游零售",
"884255": "互联网电商Ⅲ",
"884256": "教育Ⅲ",
"884257": "专业服务",
"884258": "体育",
"884259": "其他社会服务Ⅲ",
"884260": "游戏",
"884261": "数字媒体",
"884262": "通信网络设备及器件",
"884263": "通信线缆及配套",
"884264": "通信终端及配件",
"884265": "其他通信设备",
"884266": "军工电子",
"884267": "大气治理",
"884268": "水务及水治理",
"884269": "固废治理",
"884270": "综合环境治理",
"884271": "个护用品",
"884272": "化妆品",
"884273": "医疗美容",
"884274": "IT服务",
}
temp_df = pd.DataFrame.from_dict(code_name_ths_map, orient="index")
temp_df.reset_index(inplace=True)
temp_df.columns = ["code", "name"]
temp_df = temp_df[
[
"name",
"code",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L34-L358
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 2.153846 |
[
7,
315,
316,
317,
318,
324
] | 1.846154 | false | 10.365854 | 325 | 1 | 98.153846 | 4 |
def stock_board_industry_name_ths() -> pd.DataFrame:
code_name_ths_map = {
"881101": "种植业与林业",
"881102": "养殖业",
"881103": "农产品加工",
"881104": "农业服务",
"881105": "煤炭开采加工",
"881107": "油气开采及服务",
"881108": "化学原料",
"881109": "化学制品",
"881110": "化工合成材料",
"881112": "钢铁",
"881114": "金属新材料",
"881115": "建筑材料",
"881116": "建筑装饰",
"881117": "通用设备",
"881118": "专用设备",
"881119": "仪器仪表",
"881120": "电力设备",
"881121": "半导体及元件",
"881122": "光学光电子",
"881123": "其他电子",
"881124": "消费电子",
"881125": "汽车整车",
"881126": "汽车零部件",
"881127": "非汽车交运",
"881128": "汽车服务",
"881129": "通信设备",
"881130": "计算机设备",
"881131": "白色家电",
"881132": "黑色家电",
"881133": "饮料制造",
"881134": "食品加工制造",
"881135": "纺织制造",
"881136": "服装家纺",
"881137": "造纸",
"881138": "包装印刷",
"881139": "家用轻工",
"881140": "化学制药",
"881141": "中药",
"881142": "生物制品",
"881143": "医药商业",
"881144": "医疗器械",
"881145": "电力",
"881146": "燃气",
"881148": "港口航运",
"881149": "公路铁路运输",
"881151": "机场航运",
"881152": "物流",
"881153": "房地产开发",
"881155": "银行",
"881156": "保险及其他",
"881157": "证券",
"881158": "零售",
"881159": "贸易",
"881160": "景点及旅游",
"881161": "酒店及餐饮",
"881162": "通信服务",
"881163": "计算机应用",
"881164": "传媒",
"881165": "综合",
"881166": "国防军工",
"881167": "非金属材料",
"881168": "工业金属",
"881169": "贵金属",
"881170": "小金属",
"881171": "自动化设备",
"881172": "电子化学品",
"881173": "小家电",
"881174": "厨卫电器",
"881175": "医疗服务",
"881176": "房地产服务",
"881177": "互联网电商",
"881178": "教育",
"881179": "其他社会服务",
"881180": "石油加工贸易",
"881181": "环保",
"881182": "美容护理",
"884001": "种子生产",
"884002": "粮食种植",
"884003": "其他种植业",
"884004": "林业",
"884005": "海洋捕捞",
"884006": "水产养殖",
"884007": "畜禽养殖",
"884008": "饲料",
"884009": "果蔬加工",
"884010": "粮油加工",
"884011": "其他农产品加工",
"884012": "农业综合",
"884013": "动物保健",
"884014": "煤炭开采",
"884015": "焦炭加工",
"884016": "油气开采",
"884018": "油服工程",
"884020": "石油加工",
"884021": "油品石化贸易",
"884022": "纯碱",
"884023": "氯碱",
"884024": "无机盐",
"884025": "其他化学原料",
"884026": "氮肥",
"884027": "磷肥及磷化工",
"884028": "农药",
"884030": "涂料油墨",
"884031": "钾肥",
"884032": "民爆用品",
"884033": "纺织化学用品",
"884034": "其他化学制品",
"884035": "复合肥",
"884036": "氟化工",
"884039": "聚氨酯",
"884041": "涤纶",
"884043": "粘胶",
"884044": "其他纤维",
"884045": "氨纶",
"884046": "其他塑料制品",
"884048": "改性塑料",
"884050": "其他橡胶制品",
"884051": "炭黑",
"884052": "普钢",
"884053": "铝",
"884054": "铜",
"884055": "铅锌",
"884056": "其他金属新材料",
"884057": "磁性材料",
"884058": "非金属材料Ⅲ",
"884059": "玻璃玻纤",
"884060": "水泥",
"884062": "其他建材",
"884063": "耐火材料",
"884064": "管材",
"884065": "装饰园林",
"884066": "房屋建设",
"884067": "基础建设",
"884068": "专业工程",
"884069": "机床工具",
"884071": "磨具磨料",
"884073": "制冷空调设备",
"884074": "其他通用设备",
"884075": "金属制品",
"884076": "纺织服装设备",
"884077": "工程机械",
"884078": "农用机械",
"884080": "能源及重型设备",
"884081": "印刷包装机械",
"884082": "其他专用设备",
"884083": "楼宇设备",
"884084": "环保设备",
"884085": "电机",
"884086": "电气自控设备",
"884088": "输变电设备",
"884089": "线缆部件及其他",
"884090": "分立器件",
"884091": "半导体材料",
"884092": "印制电路板",
"884093": "被动元件",
"884094": "面板",
"884095": "LED",
"884096": "光学元件",
"884098": "消费电子零部件及组装",
"884099": "乘用车",
"884100": "商用载货车",
"884101": "商用载客车",
"884105": "轨交设备",
"884106": "其他交运设备",
"884107": "汽车服务Ⅲ",
"884112": "冰洗",
"884113": "空调",
"884115": "小家电Ⅲ",
"884116": "其他白色家电",
"884117": "彩电",
"884118": "其他黑色家电",
"884119": "其他酒类",
"884120": "软饮料",
"884123": "肉制品",
"884124": "调味发酵品",
"884125": "乳品",
"884126": "其他食品",
"884128": "棉纺",
"884130": "印染",
"884131": "辅料",
"884132": "其他纺织",
"884136": "鞋帽及其他",
"884137": "家纺",
"884139": "家具",
"884140": "其他家用轻工",
"884141": "饰品",
"884142": "文娱用品",
"884143": "原料药",
"884144": "化学制剂",
"884145": "医疗设备",
"884146": "火电",
"884147": "水电",
"884149": "热力",
"884150": "新能源发电",
"884152": "燃气Ⅲ",
"884153": "港口",
"884154": "高速公路",
"884155": "铁路运输",
"884156": "机场",
"884157": "航空运输",
"884158": "多元金融",
"884159": "保险",
"884160": "百货零售",
"884161": "专业连锁",
"884162": "商业物业经营",
"884163": "人工景点",
"884164": "自然景点",
"884165": "旅游综合",
"884167": "酒店",
"884168": "餐饮",
"884172": "有线电视网络",
"884173": "通信服务Ⅲ",
"884174": "软件开发",
"884176": "出版",
"884177": "影视院线",
"884178": "广告营销",
"884179": "其他传媒",
"884180": "航天装备",
"884181": "航空装备",
"884182": "地面兵装",
"884183": "航海装备",
"884184": "特钢",
"884185": "贵金属Ⅲ",
"884186": "其他小金属",
"884188": "白酒",
"884189": "啤酒",
"884191": "航运",
"884192": "仪器仪表Ⅲ",
"884193": "其他电子Ⅲ",
"884194": "汽车零部件Ⅲ",
"884195": "造纸Ⅲ",
"884197": "中药Ⅲ",
"884199": "医药商业Ⅲ",
"884200": "公交",
"884201": "物流Ⅲ",
"884202": "住宅开发",
"884203": "产业地产",
"884205": "证券Ⅲ",
"884206": "贸易Ⅲ",
"884207": "计算机设备Ⅲ",
"884208": "综合Ⅲ",
"884209": "钛白粉",
"884210": "食品及饲料添加剂",
"884211": "有机硅",
"884212": "合成树脂",
"884213": "膜材料",
"884214": "冶钢原料",
"884215": "稀土",
"884216": "能源金属",
"884217": "工程咨询服务",
"884218": "机器人",
"884219": "工控设备",
"884220": "激光设备",
"884221": "其他自动化设备",
"884222": "光伏设备",
"884223": "风电设备",
"884224": "电池",
"884225": "其他电源设备",
"884226": "集成电路设计",
"884227": "集成电路制造",
"884228": "集成电路封测",
"884229": "半导体设备",
"884230": "品牌消费电子",
"884231": "电子化学品Ⅲ",
"884232": "厨卫电器Ⅲ",
"884233": "休闲食品",
"884234": "服装",
"884235": "印刷",
"884236": "包装",
"884237": "瓷砖地板",
"884238": "血液制品",
"884239": "疫苗",
"884240": "其他生物制品",
"884242": "医疗耗材",
"884243": "体外诊断",
"884244": "医疗研发外包",
"884245": "其他医疗服务",
"884246": "电能综合服务",
"884247": "商业地产",
"884248": "房地产服务Ⅲ",
"884249": "国有大型银行",
"884250": "股份制银行",
"884251": "城商行",
"884252": "农商行",
"884253": "其他银行",
"884254": "旅游零售",
"884255": "互联网电商Ⅲ",
"884256": "教育Ⅲ",
"884257": "专业服务",
"884258": "体育",
"884259": "其他社会服务Ⅲ",
"884260": "游戏",
"884261": "数字媒体",
"884262": "通信网络设备及器件",
"884263": "通信线缆及配套",
"884264": "通信终端及配件",
"884265": "其他通信设备",
"884266": "军工电子",
"884267": "大气治理",
"884268": "水务及水治理",
"884269": "固废治理",
"884270": "综合环境治理",
"884271": "个护用品",
"884272": "化妆品",
"884273": "医疗美容",
"884274": "IT服务",
}
temp_df = pd.DataFrame.from_dict(code_name_ths_map, orient="index")
temp_df.reset_index(inplace=True)
temp_df.columns = ["code", "name"]
temp_df = temp_df[
[
"name",
"code",
]
]
return temp_df
| 17,843 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_board_industry_cons_ths
|
(symbol: str = "半导体及元件") -> pd.DataF
|
return big_df
|
同花顺-板块-行业板块-成份股
https://q.10jqka.com.cn/thshy/detail/code/881121/
:param symbol: 板块名称
:type symbol: str
:return: 成份股
:rtype: pandas.DataFrame
|
同花顺-板块-行业板块-成份股
https://q.10jqka.com.cn/thshy/detail/code/881121/
:param symbol: 板块名称
:type symbol: str
:return: 成份股
:rtype: pandas.DataFrame
| 361 | 415 |
def stock_board_industry_cons_ths(symbol: str = "半导体及元件") -> pd.DataFrame:
"""
同花顺-板块-行业板块-成份股
https://q.10jqka.com.cn/thshy/detail/code/881121/
:param symbol: 板块名称
:type symbol: str
:return: 成份股
:rtype: pandas.DataFrame
"""
stock_board_ths_map_df = stock_board_industry_name_ths()
symbol = stock_board_ths_map_df[stock_board_ths_map_df["name"] == symbol][
"code"
].values[0]
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/detail/field/199112/order/desc/page/1/ajax/1/code/{symbol}"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
page_num = int(
soup.find_all("a", attrs={"class": "changePage"})[-1]["page"]
)
except IndexError as e:
page_num = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, page_num + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/detail/field/199112/order/desc/page/{page}/ajax/1/code/{symbol}"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.rename(
{
"涨跌幅(%)": "涨跌幅",
"涨速(%)": "涨速",
"换手(%)": "换手",
"振幅(%)": "振幅",
},
inplace=True,
axis=1,
)
del big_df["加自选"]
big_df["代码"] = big_df["代码"].astype(str).str.zfill(6)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L361-L415
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 16.363636 |
[
9,
10,
13,
14,
15,
16,
17,
21,
22,
23,
24,
25,
28,
29,
30,
31,
32,
33,
37,
38,
39,
40,
42,
52,
53,
54
] | 47.272727 | false | 10.365854 | 55 | 3 | 52.727273 | 6 |
def stock_board_industry_cons_ths(symbol: str = "半导体及元件") -> pd.DataFrame:
stock_board_ths_map_df = stock_board_industry_name_ths()
symbol = stock_board_ths_map_df[stock_board_ths_map_df["name"] == symbol][
"code"
].values[0]
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/detail/field/199112/order/desc/page/1/ajax/1/code/{symbol}"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
page_num = int(
soup.find_all("a", attrs={"class": "changePage"})[-1]["page"]
)
except IndexError as e:
page_num = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, page_num + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/detail/field/199112/order/desc/page/{page}/ajax/1/code/{symbol}"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.rename(
{
"涨跌幅(%)": "涨跌幅",
"涨速(%)": "涨速",
"换手(%)": "换手",
"振幅(%)": "振幅",
},
inplace=True,
axis=1,
)
del big_df["加自选"]
big_df["代码"] = big_df["代码"].astype(str).str.zfill(6)
return big_df
| 17,844 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_board_industry_info_ths
|
(symbol: str = "半导体及元件") -> pd.DataF
|
return temp_df
|
同花顺-板块-行业板块-板块简介
http://q.10jqka.com.cn/gn/detail/code/301558/
:param symbol: 板块简介
:type symbol: str
:return: 板块简介
:rtype: pandas.DataFrame
|
同花顺-板块-行业板块-板块简介
http://q.10jqka.com.cn/gn/detail/code/301558/
:param symbol: 板块简介
:type symbol: str
:return: 板块简介
:rtype: pandas.DataFrame
| 418 | 451 |
def stock_board_industry_info_ths(symbol: str = "半导体及元件") -> pd.DataFrame:
"""
同花顺-板块-行业板块-板块简介
http://q.10jqka.com.cn/gn/detail/code/301558/
:param symbol: 板块简介
:type symbol: str
:return: 板块简介
:rtype: pandas.DataFrame
"""
stock_board_ths_map_df = stock_board_industry_name_ths()
symbol_code = stock_board_ths_map_df[
stock_board_ths_map_df["name"] == symbol
]["code"].values[0]
url = f"http://q.10jqka.com.cn/thshy/detail/code/{symbol_code}/"
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",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
name_list = [
item.text.strip()
for item in soup.find("div", attrs={"class": "board-infos"}).find_all(
"dt"
)
]
value_list = [
item.text.strip().replace("\n", "/")
for item in soup.find("div", attrs={"class": "board-infos"}).find_all(
"dd"
)
]
temp_df = pd.DataFrame([name_list, value_list]).T
temp_df.columns = ["项目", "值"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L418-L451
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 26.470588 |
[
9,
10,
13,
14,
17,
18,
19,
25,
31,
32,
33
] | 32.352941 | false | 10.365854 | 34 | 3 | 67.647059 | 6 |
def stock_board_industry_info_ths(symbol: str = "半导体及元件") -> pd.DataFrame:
stock_board_ths_map_df = stock_board_industry_name_ths()
symbol_code = stock_board_ths_map_df[
stock_board_ths_map_df["name"] == symbol
]["code"].values[0]
url = f"http://q.10jqka.com.cn/thshy/detail/code/{symbol_code}/"
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",
}
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
name_list = [
item.text.strip()
for item in soup.find("div", attrs={"class": "board-infos"}).find_all(
"dt"
)
]
value_list = [
item.text.strip().replace("\n", "/")
for item in soup.find("div", attrs={"class": "board-infos"}).find_all(
"dd"
)
]
temp_df = pd.DataFrame([name_list, value_list]).T
temp_df.columns = ["项目", "值"]
return temp_df
| 17,845 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_board_industry_index_ths
|
(
symbol: str = "半导体及元件",
start_date: str = "20200101",
end_date: str = "20211027",
)
|
return big_df
|
同花顺-板块-行业板块-指数数据
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
|
同花顺-板块-行业板块-指数数据
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
| 454 | 544 |
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):
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",
}
r = requests.get(url, headers=headers)
data_text = r.text
try:
demjson.decode(data_text[data_text.find("{") : -1])
except:
continue
temp_df = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(temp_df["data"].split(";"))
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
if len(big_df.columns) == 11:
big_df.columns = [
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
]
else:
big_df.columns = [
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
"_",
]
big_df = big_df[
[
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
condition_one = pd.to_datetime(start_date) < big_df["日期"]
condition_two = pd.to_datetime(end_date) > big_df["日期"]
big_df = big_df[condition_one & condition_two]
big_df["开盘价"] = pd.to_numeric(big_df["开盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["成交量"] = pd.to_numeric(big_df["成交量"])
big_df["成交额"] = pd.to_numeric(big_df["成交额"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L454-L544
| 25 |
[
0
] | 1.098901 |
[
17,
18,
19,
20,
21,
22,
23,
24,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
40,
41,
55,
69,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90
] | 36.263736 | false | 10.365854 | 91 | 4 | 63.736264 | 10 |
def stock_board_industry_index_ths(
symbol: str = "半导体及元件",
start_date: str = "20200101",
end_date: str = "20211027",
) -> pd.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):
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",
}
r = requests.get(url, headers=headers)
data_text = r.text
try:
demjson.decode(data_text[data_text.find("{") : -1])
except:
continue
temp_df = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(temp_df["data"].split(";"))
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
if len(big_df.columns) == 11:
big_df.columns = [
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
]
else:
big_df.columns = [
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
"_",
]
big_df = big_df[
[
"日期",
"开盘价",
"最高价",
"最低价",
"收盘价",
"成交量",
"成交额",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
condition_one = pd.to_datetime(start_date) < big_df["日期"]
condition_two = pd.to_datetime(end_date) > big_df["日期"]
big_df = big_df[condition_one & condition_two]
big_df["开盘价"] = pd.to_numeric(big_df["开盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["成交量"] = pd.to_numeric(big_df["成交量"])
big_df["成交额"] = pd.to_numeric(big_df["成交额"])
return big_df
| 17,846 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_ipo_benefit_ths
|
()
|
return big_df
|
同花顺-数据中心-新股数据-IPO受益股
https://data.10jqka.com.cn/ipo/syg/
:return: IPO受益股
:rtype: pandas.DataFrame
|
同花顺-数据中心-新股数据-IPO受益股
https://data.10jqka.com.cn/ipo/syg/
:return: IPO受益股
:rtype: pandas.DataFrame
| 547 | 600 |
def stock_ipo_benefit_ths() -> pd.DataFrame:
"""
同花顺-数据中心-新股数据-IPO受益股
https://data.10jqka.com.cn/ipo/syg/
:return: IPO受益股
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
"hexin-v": v_code
}
url = f"http://data.10jqka.com.cn/ipo/syg/field/invest/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
page_num = soup.find("span", attrs={"class": "page_info"}).text.split("/")[
1
]
big_df = pd.DataFrame()
for page in tqdm(range(1, int(page_num) + 1), leave=False):
url = f"http://data.10jqka.com.cn/ipo/syg/field/invest/order/desc/page/{page}/ajax/1/free/1/"
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
"hexin-v": v_code
}
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"涨跌幅",
"市值",
"参股家数",
"投资总额",
"投资占市值比",
"参股对象",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
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_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L547-L600
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.962963 |
[
7,
8,
9,
10,
11,
16,
17,
18,
19,
22,
23,
24,
25,
26,
31,
32,
33,
35,
47,
48,
49,
50,
51,
52,
53
] | 46.296296 | false | 10.365854 | 54 | 2 | 53.703704 | 4 |
def stock_ipo_benefit_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
"hexin-v": v_code
}
url = f"http://data.10jqka.com.cn/ipo/syg/field/invest/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
page_num = soup.find("span", attrs={"class": "page_info"}).text.split("/")[
1
]
big_df = pd.DataFrame()
for page in tqdm(range(1, int(page_num) + 1), leave=False):
url = f"http://data.10jqka.com.cn/ipo/syg/field/invest/order/desc/page/{page}/ajax/1/free/1/"
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
"hexin-v": v_code
}
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"涨跌幅",
"市值",
"参股家数",
"投资总额",
"投资占市值比",
"参股对象",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
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_df
| 17,847 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_board_industry_ths.py
|
stock_board_industry_summary_ths
|
()
|
return big_df
|
同花顺-数据中心-行业板块-同花顺行业一览表
https://q.10jqka.com.cn/thshy/
:return: 同花顺行业一览表
:rtype: pandas.DataFrame
|
同花顺-数据中心-行业板块-同花顺行业一览表
https://q.10jqka.com.cn/thshy/
:return: 同花顺行业一览表
:rtype: pandas.DataFrame
| 603 | 655 |
def stock_board_industry_summary_ths() -> pd.DataFrame:
"""
同花顺-数据中心-行业板块-同花顺行业一览表
https://q.10jqka.com.cn/thshy/
:return: 同花顺行业一览表
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/index/field/199112/order/desc/page/1/ajax/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
page_num = soup.find("span", attrs={"class": "page_info"}).text.split("/")[
1
]
big_df = pd.DataFrame()
for page in tqdm(range(1, int(page_num) + 1), leave=False):
url = f"http://q.10jqka.com.cn/thshy/index/field/199112/order/desc/page/{page}/ajax/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"板块",
"涨跌幅",
"总成交量",
"总成交额",
"净流入",
"上涨家数",
"下跌家数",
"均价",
"领涨股",
"领涨股-最新价",
"领涨股-涨跌幅",
]
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")
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_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_board_industry_ths.py#L603-L655
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 13.207547 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
21,
22,
23,
24,
25,
26,
28,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52
] | 49.056604 | false | 10.365854 | 53 | 2 | 50.943396 | 4 |
def stock_board_industry_summary_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://q.10jqka.com.cn/thshy/index/field/199112/order/desc/page/1/ajax/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
page_num = soup.find("span", attrs={"class": "page_info"}).text.split("/")[
1
]
big_df = pd.DataFrame()
for page in tqdm(range(1, int(page_num) + 1), leave=False):
url = f"http://q.10jqka.com.cn/thshy/index/field/199112/order/desc/page/{page}/ajax/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"板块",
"涨跌幅",
"总成交量",
"总成交额",
"净流入",
"上涨家数",
"下跌家数",
"均价",
"领涨股",
"领涨股-最新价",
"领涨股-涨跌幅",
]
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")
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_df
| 17,848 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_analyst_em.py
|
stock_analyst_rank_em
|
(year: str = "2022")
|
return big_df
|
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数
http://data.eastmoney.com/invest/invest/list.html
:param year: 从 2015 年至今
:type year: str
:return: 东方财富分析师指数
:rtype: pandas.DataFrame
|
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数
http://data.eastmoney.com/invest/invest/list.html
:param year: 从 2015 年至今
:type year: str
:return: 东方财富分析师指数
:rtype: pandas.DataFrame
| 13 | 99 |
def stock_analyst_rank_em(year: str = "2022") -> pd.DataFrame:
"""
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数
http://data.eastmoney.com/invest/invest/list.html
:param year: 从 2015 年至今
:type year: str
:return: 东方财富分析师指数
:rtype: pandas.DataFrame
"""
url = "https://data.eastmoney.com/dataapi/invest/list"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
params = {
"sortColumns": "YEAR_YIELD",
"sortTypes": "-1",
"pageSize": "50",
"pageNumber": "1",
"reportName": "RPT_ANALYST_INDEX_RANK",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f'(YEAR="{year}")',
"limit": "top100",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1)):
params.update({"pageNumber": page})
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, data_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = list(range(1, len(big_df) + 1))
big_df.columns = [
"序号",
"分析师ID",
"分析师名称",
"更新日期",
"年度",
"分析师单位",
"_",
"年度指数",
f"{year}年收益率",
"3个月收益率",
"6个月收益率",
"12个月收益率",
"成分股个数",
f"{year}最新个股评级-股票名称",
"_",
f"{year}最新个股评级-股票代码",
"_",
"行业代码",
"行业",
]
big_df = big_df[
[
"序号",
"分析师名称",
"分析师单位",
"年度指数",
f"{year}年收益率",
"3个月收益率",
"6个月收益率",
"12个月收益率",
"成分股个数",
f"{year}最新个股评级-股票名称",
f"{year}最新个股评级-股票代码",
"分析师ID",
"行业代码",
"行业",
"更新日期",
"年度",
]
]
big_df["更新日期"] = pd.to_datetime(big_df["更新日期"]).dt.date
big_df["年度指数"] = pd.to_numeric(big_df["年度指数"])
big_df[f"{year}年收益率"] = pd.to_numeric(big_df[f"{year}年收益率"])
big_df["3个月收益率"] = pd.to_numeric(big_df["3个月收益率"])
big_df["6个月收益率"] = pd.to_numeric(big_df["6个月收益率"])
big_df["12个月收益率"] = pd.to_numeric(big_df["12个月收益率"])
big_df["成分股个数"] = pd.to_numeric(big_df["成分股个数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_analyst_em.py#L13-L99
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 10.344828 |
[
9,
10,
13,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
36,
37,
38,
59,
79,
80,
81,
82,
83,
84,
85,
86
] | 28.735632 | false | 8.75 | 87 | 2 | 71.264368 | 6 |
def stock_analyst_rank_em(year: str = "2022") -> pd.DataFrame:
url = "https://data.eastmoney.com/dataapi/invest/list"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
params = {
"sortColumns": "YEAR_YIELD",
"sortTypes": "-1",
"pageSize": "50",
"pageNumber": "1",
"reportName": "RPT_ANALYST_INDEX_RANK",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": f'(YEAR="{year}")',
"limit": "top100",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1)):
params.update({"pageNumber": page})
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, data_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = list(range(1, len(big_df) + 1))
big_df.columns = [
"序号",
"分析师ID",
"分析师名称",
"更新日期",
"年度",
"分析师单位",
"_",
"年度指数",
f"{year}年收益率",
"3个月收益率",
"6个月收益率",
"12个月收益率",
"成分股个数",
f"{year}最新个股评级-股票名称",
"_",
f"{year}最新个股评级-股票代码",
"_",
"行业代码",
"行业",
]
big_df = big_df[
[
"序号",
"分析师名称",
"分析师单位",
"年度指数",
f"{year}年收益率",
"3个月收益率",
"6个月收益率",
"12个月收益率",
"成分股个数",
f"{year}最新个股评级-股票名称",
f"{year}最新个股评级-股票代码",
"分析师ID",
"行业代码",
"行业",
"更新日期",
"年度",
]
]
big_df["更新日期"] = pd.to_datetime(big_df["更新日期"]).dt.date
big_df["年度指数"] = pd.to_numeric(big_df["年度指数"])
big_df[f"{year}年收益率"] = pd.to_numeric(big_df[f"{year}年收益率"])
big_df["3个月收益率"] = pd.to_numeric(big_df["3个月收益率"])
big_df["6个月收益率"] = pd.to_numeric(big_df["6个月收益率"])
big_df["12个月收益率"] = pd.to_numeric(big_df["12个月收益率"])
big_df["成分股个数"] = pd.to_numeric(big_df["成分股个数"])
return big_df
| 17,849 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_analyst_em.py
|
stock_analyst_detail_em
|
(
analyst_id: str = "11000200926", indicator: str = "最新跟踪成分股"
)
|
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数2020最新排行-分析师详情
http://data.eastmoney.com/invest/invest/11000200926.html
:param analyst_id: 分析师 ID, 从 ak.stock_analyst_rank_em() 获取
:type analyst_id: str
:param indicator: ["最新跟踪成分股", "历史跟踪成分股", "历史指数"]
:type indicator: str
:return: 具体指标的数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数2020最新排行-分析师详情
http://data.eastmoney.com/invest/invest/11000200926.html
:param analyst_id: 分析师 ID, 从 ak.stock_analyst_rank_em() 获取
:type analyst_id: str
:param indicator: ["最新跟踪成分股", "历史跟踪成分股", "历史指数"]
:type indicator: str
:return: 具体指标的数据
:rtype: pandas.DataFrame
| 102 | 212 |
def stock_analyst_detail_em(
analyst_id: str = "11000200926", indicator: str = "最新跟踪成分股"
) -> pd.DataFrame:
"""
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数2020最新排行-分析师详情
http://data.eastmoney.com/invest/invest/11000200926.html
:param analyst_id: 分析师 ID, 从 ak.stock_analyst_rank_em() 获取
:type analyst_id: str
:param indicator: ["最新跟踪成分股", "历史跟踪成分股", "历史指数"]
:type indicator: str
:return: 具体指标的数据
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://data.eastmoney.com/dataapi/invest/other"
if indicator == "最新跟踪成分股":
params = {
"href": "/api/Zgfxzs/json/AnalysisIndexNew.aspx",
"paramsstr": f"index=1&size=100&code={analyst_id}",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
if len(json_data) == 0:
return pd.DataFrame()
temp_df = pd.DataFrame(json_data["re"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"调入日期",
"当前评级名称",
"成交价格(前复权)",
"最新价格",
"最新评级日期",
"_",
"阶段涨跌幅",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"调入日期",
"最新评级日期",
"当前评级名称",
"成交价格(前复权)",
"最新价格",
"阶段涨跌幅",
]
]
temp_df["调入日期"] = pd.to_datetime(temp_df["调入日期"]).dt.date
temp_df["最新评级日期"] = pd.to_datetime(temp_df["最新评级日期"]).dt.date
temp_df["成交价格(前复权)"] = pd.to_numeric(temp_df["成交价格(前复权)"])
temp_df["最新价格"] = pd.to_numeric(temp_df["最新价格"])
temp_df["阶段涨跌幅"] = pd.to_numeric(temp_df["阶段涨跌幅"])
return temp_df
elif indicator == "历史跟踪成分股":
params = {
"href": "/api/Zgfxzs/json/AnalysisIndexls.aspx",
"paramsstr": f"index=1&size=100&code={analyst_id}",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(json_data["re"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"调入日期",
"调出日期",
"调入时评级名称",
"调出原因",
"_",
"累计涨跌幅",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"调入日期",
"调出日期",
"调入时评级名称",
"调出原因",
"累计涨跌幅",
]
]
temp_df["调入日期"] = pd.to_datetime(temp_df["调入日期"]).dt.date
temp_df["调出日期"] = pd.to_datetime(temp_df["调出日期"]).dt.date
temp_df["累计涨跌幅"] = pd.to_numeric(temp_df["累计涨跌幅"])
return temp_df
elif indicator == "历史指数":
params = {
"href": "/DataCenter_V3/chart/AnalystsIndex.ashx",
"paramsstr": f"code={analyst_id}&d=&isxml=True",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(
[json_data["X"].split(","), json_data["Y"][0].split(",")],
index=["date", "value"],
).T
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["value"] = pd.to_numeric(temp_df["value"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_analyst_em.py#L102-L212
| 25 |
[
0
] | 0.900901 |
[
13,
16,
17,
18,
22,
23,
24,
25,
26,
27,
28,
29,
41,
54,
55,
56,
57,
58,
59,
60,
61,
65,
66,
67,
68,
69,
70,
81,
93,
94,
95,
96,
97,
98,
102,
103,
104,
108,
109,
110
] | 36.036036 | false | 8.75 | 111 | 5 | 63.963964 | 8 |
def stock_analyst_detail_em(
analyst_id: str = "11000200926", indicator: str = "最新跟踪成分股"
) -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://data.eastmoney.com/dataapi/invest/other"
if indicator == "最新跟踪成分股":
params = {
"href": "/api/Zgfxzs/json/AnalysisIndexNew.aspx",
"paramsstr": f"index=1&size=100&code={analyst_id}",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
if len(json_data) == 0:
return pd.DataFrame()
temp_df = pd.DataFrame(json_data["re"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"调入日期",
"当前评级名称",
"成交价格(前复权)",
"最新价格",
"最新评级日期",
"_",
"阶段涨跌幅",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"调入日期",
"最新评级日期",
"当前评级名称",
"成交价格(前复权)",
"最新价格",
"阶段涨跌幅",
]
]
temp_df["调入日期"] = pd.to_datetime(temp_df["调入日期"]).dt.date
temp_df["最新评级日期"] = pd.to_datetime(temp_df["最新评级日期"]).dt.date
temp_df["成交价格(前复权)"] = pd.to_numeric(temp_df["成交价格(前复权)"])
temp_df["最新价格"] = pd.to_numeric(temp_df["最新价格"])
temp_df["阶段涨跌幅"] = pd.to_numeric(temp_df["阶段涨跌幅"])
return temp_df
elif indicator == "历史跟踪成分股":
params = {
"href": "/api/Zgfxzs/json/AnalysisIndexls.aspx",
"paramsstr": f"index=1&size=100&code={analyst_id}",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(json_data["re"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"调入日期",
"调出日期",
"调入时评级名称",
"调出原因",
"_",
"累计涨跌幅",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"调入日期",
"调出日期",
"调入时评级名称",
"调出原因",
"累计涨跌幅",
]
]
temp_df["调入日期"] = pd.to_datetime(temp_df["调入日期"]).dt.date
temp_df["调出日期"] = pd.to_datetime(temp_df["调出日期"]).dt.date
temp_df["累计涨跌幅"] = pd.to_numeric(temp_df["累计涨跌幅"])
return temp_df
elif indicator == "历史指数":
params = {
"href": "/DataCenter_V3/chart/AnalystsIndex.ashx",
"paramsstr": f"code={analyst_id}&d=&isxml=True",
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(
[json_data["X"].split(","), json_data["Y"][0].split(",")],
index=["date", "value"],
).T
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["value"] = pd.to_numeric(temp_df["value"])
return temp_df
| 17,850 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_a_pe_and_pb.py
|
stock_a_pe_and_pb
|
(symbol: str = "sz")
|
return index_df
|
乐咕乐股-A 股市盈率和市净率
https://legulegu.com/stockdata/hs300-ttm-lyr
https://legulegu.com/stockdata/hs300-pb
两个网页分别展示市盈率和市净率,但实际上是来自同一个API的数据
:param symbol: choice of {"sh", "sz", "cy", "zx", "000300.SH" ...}
:type symbol: str
:return: 指定市场的 A 股的市盈率和市净率,包括等权和加权
:rtype: pandas.DataFrame
|
乐咕乐股-A 股市盈率和市净率
https://legulegu.com/stockdata/hs300-ttm-lyr
https://legulegu.com/stockdata/hs300-pb
两个网页分别展示市盈率和市净率,但实际上是来自同一个API的数据
:param symbol: choice of {"sh", "sz", "cy", "zx", "000300.SH" ...}
:type symbol: str
:return: 指定市场的 A 股的市盈率和市净率,包括等权和加权
:rtype: pandas.DataFrame
| 325 | 359 |
def stock_a_pe_and_pb(symbol: str = "sz") -> pd.DataFrame:
"""
乐咕乐股-A 股市盈率和市净率
https://legulegu.com/stockdata/hs300-ttm-lyr
https://legulegu.com/stockdata/hs300-pb
两个网页分别展示市盈率和市净率,但实际上是来自同一个API的数据
:param symbol: choice of {"sh", "sz", "cy", "zx", "000300.SH" ...}
:type symbol: str
:return: 指定市场的 A 股的市盈率和市净率,包括等权和加权
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/index-basic"
params = {
"token": token,
"indexCode": symbol
}
if symbol == "sh":
params["indexCode"] = "1"
if symbol == "sz":
params["indexCode"] = "2"
if symbol == "cy":
params["indexCode"] = "4"
if symbol == "kc":
params["indexCode"] = "7"
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df.index = pd.to_datetime(
temp_df["date"], unit="ms", utc=True).dt.tz_convert("Asia/Shanghai").dt.date
index_df = temp_df[["addTtmPe", "middleTtmPe", "addLyrPe", "middleLyrPe", "addPb",
"ttmPe", "lyrPe", "pb", "middlePb", "close"]]
index_df.columns = ["addTtmPe", "middleAddTtmPe", "addLyrPe", "middleAddLyrPe", "addPb",
"averageTtmPe", "averageLyr", "averagePb", "middleAveragePb", "close"]
index_df.reset_index(inplace=True)
return index_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_a_pe_and_pb.py#L325-L359
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
] | 31.428571 |
[
11,
12,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
29,
31,
33,
34
] | 51.428571 | false | 35.294118 | 35 | 5 | 48.571429 | 8 |
def stock_a_pe_and_pb(symbol: str = "sz") -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/index-basic"
params = {
"token": token,
"indexCode": symbol
}
if symbol == "sh":
params["indexCode"] = "1"
if symbol == "sz":
params["indexCode"] = "2"
if symbol == "cy":
params["indexCode"] = "4"
if symbol == "kc":
params["indexCode"] = "7"
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df.index = pd.to_datetime(
temp_df["date"], unit="ms", utc=True).dt.tz_convert("Asia/Shanghai").dt.date
index_df = temp_df[["addTtmPe", "middleTtmPe", "addLyrPe", "middleLyrPe", "addPb",
"ttmPe", "lyrPe", "pb", "middlePb", "close"]]
index_df.columns = ["addTtmPe", "middleAddTtmPe", "addLyrPe", "middleAddLyrPe", "addPb",
"averageTtmPe", "averageLyr", "averagePb", "middleAveragePb", "close"]
index_df.reset_index(inplace=True)
return index_df
| 17,851 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lh_yybpm.py
|
stock_lh_yyb_most
|
()
|
return big_df
|
同花顺-数据中心-营业部排名-上榜次数最多
http://data.10jqka.com.cn/market/longhu/
:return: 上榜次数最多
:rtype: pandas.DataFrame
|
同花顺-数据中心-营业部排名-上榜次数最多
http://data.10jqka.com.cn/market/longhu/
:return: 上榜次数最多
:rtype: pandas.DataFrame
| 13 | 30 |
def stock_lh_yyb_most() -> pd.DataFrame:
"""
同花顺-数据中心-营业部排名-上榜次数最多
http://data.10jqka.com.cn/market/longhu/
:return: 上榜次数最多
:rtype: pandas.DataFrame
"""
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/sbcs/field/sbcs/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lh_yybpm.py#L13-L30
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 38.888889 |
[
7,
8,
9,
12,
13,
14,
15,
16,
17
] | 50 | false | 19.512195 | 18 | 2 | 50 | 4 |
def stock_lh_yyb_most() -> pd.DataFrame:
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/sbcs/field/sbcs/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 17,852 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lh_yybpm.py
|
stock_lh_yyb_capital
|
()
|
return big_df
|
同花顺-数据中心-营业部排名-资金实力最强
http://data.10jqka.com.cn/market/longhu/
:return: 资金实力最强
:rtype: pandas.DataFrame
|
同花顺-数据中心-营业部排名-资金实力最强
http://data.10jqka.com.cn/market/longhu/
:return: 资金实力最强
:rtype: pandas.DataFrame
| 33 | 50 |
def stock_lh_yyb_capital() -> pd.DataFrame:
"""
同花顺-数据中心-营业部排名-资金实力最强
http://data.10jqka.com.cn/market/longhu/
:return: 资金实力最强
:rtype: pandas.DataFrame
"""
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/zjsl/field/zgczje/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lh_yybpm.py#L33-L50
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 38.888889 |
[
7,
8,
9,
12,
13,
14,
15,
16,
17
] | 50 | false | 19.512195 | 18 | 2 | 50 | 4 |
def stock_lh_yyb_capital() -> pd.DataFrame:
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/zjsl/field/zgczje/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 17,853 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lh_yybpm.py
|
stock_lh_yyb_control
|
()
|
return big_df
|
同花顺-数据中心-营业部排名-抱团操作实力
http://data.10jqka.com.cn/market/longhu/
:return: 抱团操作实力
:rtype: pandas.DataFrame
|
同花顺-数据中心-营业部排名-抱团操作实力
http://data.10jqka.com.cn/market/longhu/
:return: 抱团操作实力
:rtype: pandas.DataFrame
| 53 | 70 |
def stock_lh_yyb_control() -> pd.DataFrame:
"""
同花顺-数据中心-营业部排名-抱团操作实力
http://data.10jqka.com.cn/market/longhu/
:return: 抱团操作实力
:rtype: pandas.DataFrame
"""
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/btcz/field/xsjs/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lh_yybpm.py#L53-L70
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 38.888889 |
[
7,
8,
9,
12,
13,
14,
15,
16,
17
] | 50 | false | 19.512195 | 18 | 2 | 50 | 4 |
def stock_lh_yyb_control() -> pd.DataFrame:
big_df = pd.DataFrame()
for page in tqdm(range(1, 11)):
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'
}
url = f'http://data.10jqka.com.cn/ifmarket/lhbyyb/type/1/tab/btcz/field/xsjs/sort/desc/page/{page}/'
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = big_df.append(temp_df)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 17,854 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdhs.py
|
stock_zh_a_gdhs
|
(symbol: str = "20210930")
|
return big_df
|
东方财富网-数据中心-特色数据-股东户数
https://data.eastmoney.com/gdhs/
:param symbol: choice of {"最新", "每个季度末"}
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-股东户数
https://data.eastmoney.com/gdhs/
:param symbol: choice of {"最新", "每个季度末"}
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
| 13 | 112 |
def stock_zh_a_gdhs(symbol: str = "20210930") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-股东户数
https://data.eastmoney.com/gdhs/
:param symbol: choice of {"最新", "每个季度末"}
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
if symbol == "最新":
params = {
"sortColumns": "HOLD_NOTICE_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_HOLDERNUMLATEST",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE",
"quoteColumns": "f2,f3",
"source": "WEB",
"client": "WEB",
}
else:
params = {
"sortColumns": "HOLD_NOTICE_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_HOLDERNUM_DET",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE",
"quoteColumns": "f2,f3",
"source": "WEB",
"client": "WEB",
'filter': f"(END_DATE='{symbol[:4] + '-' + symbol[4:6] + '-' + symbol[6:]}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page_num = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page_num in tqdm(range(1, total_page_num + 1), leave=False):
params.update({
"pageNumber": page_num,
})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"代码",
"名称",
"股东户数统计截止日-本次",
"区间涨跌幅",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"公告日期",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"股东户数统计截止日-上次",
"最新价",
"涨跌幅",
]
big_df = big_df[
[
"代码",
"名称",
"最新价",
"涨跌幅",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"区间涨跌幅",
"股东户数统计截止日-本次",
"股东户数统计截止日-上次",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"公告日期",
]
]
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")
big_df['区间涨跌幅'] = pd.to_numeric(big_df['区间涨跌幅'], errors="coerce")
big_df['股东户数统计截止日-本次'] = pd.to_datetime(big_df['股东户数统计截止日-本次']).dt.date
big_df['股东户数统计截止日-上次'] = pd.to_datetime(big_df['股东户数统计截止日-上次']).dt.date
big_df['户均持股市值'] = pd.to_numeric(big_df['户均持股市值'])
big_df['户均持股数量'] = pd.to_numeric(big_df['户均持股数量'])
big_df['总市值'] = pd.to_numeric(big_df['总市值'])
big_df['总股本'] = pd.to_numeric(big_df['总股本'])
big_df['公告日期'] = pd.to_datetime(big_df['公告日期']).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdhs.py#L13-L112
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 9 |
[
9,
10,
11,
23,
35,
36,
37,
38,
39,
40,
43,
44,
45,
46,
47,
65,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99
] | 31 | false | 10.144928 | 100 | 3 | 69 | 6 |
def stock_zh_a_gdhs(symbol: str = "20210930") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
if symbol == "最新":
params = {
"sortColumns": "HOLD_NOTICE_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_HOLDERNUMLATEST",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE",
"quoteColumns": "f2,f3",
"source": "WEB",
"client": "WEB",
}
else:
params = {
"sortColumns": "HOLD_NOTICE_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_HOLDERNUM_DET",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE",
"quoteColumns": "f2,f3",
"source": "WEB",
"client": "WEB",
'filter': f"(END_DATE='{symbol[:4] + '-' + symbol[4:6] + '-' + symbol[6:]}')",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page_num = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page_num in tqdm(range(1, total_page_num + 1), leave=False):
params.update({
"pageNumber": page_num,
})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"代码",
"名称",
"股东户数统计截止日-本次",
"区间涨跌幅",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"公告日期",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"股东户数统计截止日-上次",
"最新价",
"涨跌幅",
]
big_df = big_df[
[
"代码",
"名称",
"最新价",
"涨跌幅",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"区间涨跌幅",
"股东户数统计截止日-本次",
"股东户数统计截止日-上次",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"公告日期",
]
]
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")
big_df['区间涨跌幅'] = pd.to_numeric(big_df['区间涨跌幅'], errors="coerce")
big_df['股东户数统计截止日-本次'] = pd.to_datetime(big_df['股东户数统计截止日-本次']).dt.date
big_df['股东户数统计截止日-上次'] = pd.to_datetime(big_df['股东户数统计截止日-上次']).dt.date
big_df['户均持股市值'] = pd.to_numeric(big_df['户均持股市值'])
big_df['户均持股数量'] = pd.to_numeric(big_df['户均持股数量'])
big_df['总市值'] = pd.to_numeric(big_df['总市值'])
big_df['总股本'] = pd.to_numeric(big_df['总股本'])
big_df['公告日期'] = pd.to_datetime(big_df['公告日期']).dt.date
return big_df
| 17,855 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_gdhs.py
|
stock_zh_a_gdhs_detail_em
|
(symbol: str = "000002")
|
return big_df
|
东方财富网-数据中心-特色数据-股东户数详情
https://data.eastmoney.com/gdhs/detail/000002.html
:param symbol: 股票代码
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-股东户数详情
https://data.eastmoney.com/gdhs/detail/000002.html
:param symbol: 股票代码
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
| 115 | 200 |
def stock_zh_a_gdhs_detail_em(symbol: str = "000002") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-股东户数详情
https://data.eastmoney.com/gdhs/detail/000002.html
:param symbol: 股票代码
:type symbol: str
:return: 股东户数
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
'sortColumns': 'END_DATE',
'sortTypes': '-1',
'pageSize': '500',
'pageNumber': '1',
'reportName': 'RPT_HOLDERNUM_DET',
'columns': 'SECURITY_CODE,SECURITY_NAME_ABBR,CHANGE_SHARES,CHANGE_REASON,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE',
'quoteColumns': 'f2,f3',
'filter': f'(SECURITY_CODE="{symbol}")',
'source': 'WEB',
'client': 'WEB',
}
r = requests.get(url, params=params)
data_json = r.json()
total_page_num = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page_num in tqdm(range(1, total_page_num + 1), leave=False):
params.update({
"pageNumber": page_num,
})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"代码",
"名称",
"股本变动",
"股本变动原因",
"股东户数统计截止日",
"区间涨跌幅",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"股东户数公告日期",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"-",
"-",
"-",
]
big_df = big_df[
[
"股东户数统计截止日",
"区间涨跌幅",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"股本变动",
"股本变动原因",
"股东户数公告日期",
"代码",
"名称",
]
]
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['户均持股市值'])
big_df['户均持股数量'] = pd.to_numeric(big_df['户均持股数量'])
big_df['总市值'] = pd.to_numeric(big_df['总市值'])
big_df['总股本'] = pd.to_numeric(big_df['总股本'])
big_df['股本变动'] = pd.to_numeric(big_df['股本变动'])
big_df['股东户数统计截止日'] = pd.to_datetime(big_df['股东户数统计截止日']).dt.date
big_df['股东户数公告日期'] = pd.to_datetime(big_df['股东户数公告日期']).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_gdhs.py#L115-L200
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 10.465116 |
[
9,
10,
22,
23,
24,
25,
26,
27,
30,
31,
32,
33,
34,
54,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85
] | 31.395349 | false | 10.144928 | 86 | 2 | 68.604651 | 6 |
def stock_zh_a_gdhs_detail_em(symbol: str = "000002") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
'sortColumns': 'END_DATE',
'sortTypes': '-1',
'pageSize': '500',
'pageNumber': '1',
'reportName': 'RPT_HOLDERNUM_DET',
'columns': 'SECURITY_CODE,SECURITY_NAME_ABBR,CHANGE_SHARES,CHANGE_REASON,END_DATE,INTERVAL_CHRATE,AVG_MARKET_CAP,AVG_HOLD_NUM,TOTAL_MARKET_CAP,TOTAL_A_SHARES,HOLD_NOTICE_DATE,HOLDER_NUM,PRE_HOLDER_NUM,HOLDER_NUM_CHANGE,HOLDER_NUM_RATIO,END_DATE,PRE_END_DATE',
'quoteColumns': 'f2,f3',
'filter': f'(SECURITY_CODE="{symbol}")',
'source': 'WEB',
'client': 'WEB',
}
r = requests.get(url, params=params)
data_json = r.json()
total_page_num = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page_num in tqdm(range(1, total_page_num + 1), leave=False):
params.update({
"pageNumber": page_num,
})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"代码",
"名称",
"股本变动",
"股本变动原因",
"股东户数统计截止日",
"区间涨跌幅",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"股东户数公告日期",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"-",
"-",
"-",
]
big_df = big_df[
[
"股东户数统计截止日",
"区间涨跌幅",
"股东户数-本次",
"股东户数-上次",
"股东户数-增减",
"股东户数-增减比例",
"户均持股市值",
"户均持股数量",
"总市值",
"总股本",
"股本变动",
"股本变动原因",
"股东户数公告日期",
"代码",
"名称",
]
]
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['户均持股市值'])
big_df['户均持股数量'] = pd.to_numeric(big_df['户均持股数量'])
big_df['总市值'] = pd.to_numeric(big_df['总市值'])
big_df['总股本'] = pd.to_numeric(big_df['总股本'])
big_df['股本变动'] = pd.to_numeric(big_df['股本变动'])
big_df['股东户数统计截止日'] = pd.to_datetime(big_df['股东户数统计截止日']).dt.date
big_df['股东户数公告日期'] = pd.to_datetime(big_df['股东户数公告日期']).dt.date
return big_df
| 17,856 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_congestion_lg.py
|
stock_a_congestion_lg
|
()
|
return temp_df
|
乐咕乐股-大盘拥挤度
https://legulegu.com/stockdata/ashares-congestion
:return: 大盘拥挤度
:rtype: pandas.DataFrame
|
乐咕乐股-大盘拥挤度
https://legulegu.com/stockdata/ashares-congestion
:return: 大盘拥挤度
:rtype: pandas.DataFrame
| 14 | 35 |
def stock_a_congestion_lg() -> pd.DataFrame:
"""
乐咕乐股-大盘拥挤度
https://legulegu.com/stockdata/ashares-congestion
:return: 大盘拥挤度
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/ashares-congestion"
token = get_token_lg()
params = {"token": token}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json['items'])
temp_df['date'] = pd.to_datetime(temp_df['date']).dt.date
temp_df = temp_df[[
'date',
'close',
'congestion',
]]
temp_df['close'] = pd.to_numeric(temp_df['close'], errors="coerce")
temp_df['congestion'] = pd.to_numeric(temp_df['congestion'], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_congestion_lg.py#L14-L35
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 31.818182 |
[
7,
8,
9,
10,
11,
12,
13,
14,
19,
20,
21
] | 50 | false | 31.578947 | 22 | 1 | 50 | 4 |
def stock_a_congestion_lg() -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/ashares-congestion"
token = get_token_lg()
params = {"token": token}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json['items'])
temp_df['date'] = pd.to_datetime(temp_df['date']).dt.date
temp_df = temp_df[[
'date',
'close',
'congestion',
]]
temp_df['close'] = pd.to_numeric(temp_df['close'], errors="coerce")
temp_df['congestion'] = pd.to_numeric(temp_df['congestion'], errors="coerce")
return temp_df
| 17,857 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_dxsyl_em.py
|
stock_dxsyl_em
|
()
|
return big_df
|
东方财富网-数据中心-新股申购-打新收益率
https://data.eastmoney.com/xg/xg/dxsyl.html
:return: 打新收益率数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-新股申购-打新收益率
https://data.eastmoney.com/xg/xg/dxsyl.html
:return: 打新收益率数据
:rtype: pandas.DataFrame
| 16 | 106 |
def stock_dxsyl_em() -> pd.DataFrame:
"""
东方财富网-数据中心-新股申购-打新收益率
https://data.eastmoney.com/xg/xg/dxsyl.html
:return: 打新收益率数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "LISTING_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "5000",
"pageNumber": "1",
"reportName": "RPTA_APP_IPOAPPLY",
"quoteColumns": "f2~01~SECURITY_CODE,f14~01~SECURITY_CODE",
"quoteType": "0",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter": """((APPLY_DATE>'2010-01-01')(|@APPLY_DATE="NULL"))((LISTING_DATE>'2010-01-01')(|@LISTING_DATE="NULL"))(TRADE_MARKET_CODE!="069001017")""",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.rename(
columns={
"index": "序号",
"SECURITY_CODE": "股票代码",
"f14": "股票简称",
"ISSUE_PRICE": "发行价",
"LATELY_PRICE": "最新价",
"ONLINE_ISSUE_LWR": "网上-发行中签率",
"ONLINE_VA_SHARES": "网上-有效申购股数",
"ONLINE_VA_NUM": "网上-有效申购户数",
"ONLINE_ES_MULTIPLE": "网上-超额认购倍数",
"OFFLINE_VAP_RATIO": "网下-配售中签率",
"OFFLINE_VATS": "网下-有效申购股数",
"OFFLINE_VAP_OBJECT": "网下-有效申购户数",
"OFFLINE_VAS_MULTIPLE": "网下-配售认购倍数",
"ISSUE_NUM": "总发行数量",
"LD_OPEN_PREMIUM": "开盘溢价",
"LD_CLOSE_CHANGE": "首日涨幅",
"LISTING_DATE": "上市日期",
},
inplace=True,
)
big_df = big_df[
[
"序号",
"股票代码",
"股票简称",
"发行价",
"最新价",
"网上-发行中签率",
"网上-有效申购股数",
"网上-有效申购户数",
"网上-超额认购倍数",
"网下-配售中签率",
"网下-有效申购股数",
"网下-有效申购户数",
"网下-配售认购倍数",
"总发行数量",
"开盘溢价",
"首日涨幅",
"上市日期",
]
]
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")
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")
big_df["首日涨幅"] = pd.to_numeric(big_df["首日涨幅"], errors="coerce")
big_df["上市日期"] = pd.to_datetime(big_df["上市日期"]).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_dxsyl_em.py#L16-L106
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 7.692308 |
[
7,
8,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
55,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90
] | 34.065934 | false | 5.932203 | 91 | 2 | 65.934066 | 4 |
def stock_dxsyl_em() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "LISTING_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "5000",
"pageNumber": "1",
"reportName": "RPTA_APP_IPOAPPLY",
"quoteColumns": "f2~01~SECURITY_CODE,f14~01~SECURITY_CODE",
"quoteType": "0",
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"filter":,
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.rename(
columns={
"index": "序号",
"SECURITY_CODE": "股票代码",
"f14": "股票简称",
"ISSUE_PRICE": "发行价",
"LATELY_PRICE": "最新价",
"ONLINE_ISSUE_LWR": "网上-发行中签率",
"ONLINE_VA_SHARES": "网上-有效申购股数",
"ONLINE_VA_NUM": "网上-有效申购户数",
"ONLINE_ES_MULTIPLE": "网上-超额认购倍数",
"OFFLINE_VAP_RATIO": "网下-配售中签率",
"OFFLINE_VATS": "网下-有效申购股数",
"OFFLINE_VAP_OBJECT": "网下-有效申购户数",
"OFFLINE_VAS_MULTIPLE": "网下-配售认购倍数",
"ISSUE_NUM": "总发行数量",
"LD_OPEN_PREMIUM": "开盘溢价",
"LD_CLOSE_CHANGE": "首日涨幅",
"LISTING_DATE": "上市日期",
},
inplace=True,
)
big_df = big_df[
[
"序号",
"股票代码",
"股票简称",
"发行价",
"最新价",
"网上-发行中签率",
"网上-有效申购股数",
"网上-有效申购户数",
"网上-超额认购倍数",
"网下-配售中签率",
"网下-有效申购股数",
"网下-有效申购户数",
"网下-配售认购倍数",
"总发行数量",
"开盘溢价",
"首日涨幅",
"上市日期",
]
]
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")
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")
big_df["首日涨幅"] = pd.to_numeric(big_df["首日涨幅"], errors="coerce")
big_df["上市日期"] = pd.to_datetime(big_df["上市日期"]).dt.date
return big_df
| 17,858 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_dxsyl_em.py
|
stock_xgsglb_em
|
(symbol: str = "京市A股") -> pd
|
return big_df
|
新股申购与中签查询
http://data.eastmoney.com/xg/xg/default_2.html
:param symbol: choice of {"全部股票", "沪市A股", "科创板", "深市A股", "创业板", "京市A股"}
:type symbol: str
:return: 新股申购与中签数据
:rtype: pandas.DataFrame
|
新股申购与中签查询
http://data.eastmoney.com/xg/xg/default_2.html
:param symbol: choice of {"全部股票", "沪市A股", "科创板", "深市A股", "创业板", "京市A股"}
:type symbol: str
:return: 新股申购与中签数据
:rtype: pandas.DataFrame
| 109 | 338 |
def stock_xgsglb_em(symbol: str = "京市A股") -> pd.DataFrame:
"""
新股申购与中签查询
http://data.eastmoney.com/xg/xg/default_2.html
:param symbol: choice of {"全部股票", "沪市A股", "科创板", "深市A股", "创业板", "京市A股"}
:type symbol: str
:return: 新股申购与中签数据
:rtype: pandas.DataFrame
"""
market_map = {
"全部股票": """(APPLY_DATE>'2010-01-01')""",
"沪市A股": """(APPLY_DATE>'2010-01-01')(SECURITY_TYPE_CODE in ("058001001","058001008"))(TRADE_MARKET_CODE in ("069001001001","069001001003","069001001006"))""",
"科创板": """(APPLY_DATE>'2010-01-01')(SECURITY_TYPE_CODE in ("058001001","058001008"))(TRADE_MARKET_CODE="069001001006")""",
"深市A股": """(APPLY_DATE>'2010-01-01')(SECURITY_TYPE_CODE="058001001")(TRADE_MARKET_CODE in ("069001002001","069001002002","069001002003","069001002005"))""",
"创业板": """(APPLY_DATE>'2010-01-01')(SECURITY_TYPE_CODE="058001001")(TRADE_MARKET_CODE="069001002002")""",
}
url = "http://datacenter-web.eastmoney.com/api/data/v1/get"
if symbol == "京市A股":
params = {
"sortColumns": "APPLY_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"columns": "ALL",
"reportName": "RPT_NEEQ_ISSUEINFO_LIST",
"quoteColumns": "f14~01~SECURITY_CODE~SECURITY_NAME_ABBR",
"source": "NEEQSELECT",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, 1 + int(total_page)), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"代码",
"-",
"简称",
"申购代码",
"发行总数",
"-",
"发行价格",
"发行市盈率",
"申购日",
"发行结果公告日",
"上市日",
"网上发行数量",
"顶格申购所需资金",
"申购上限",
"网上申购缴款日",
"网上申购退款日",
"-",
"网上获配比例",
"最新价",
"首日收盘价",
"网下有效申购倍数",
"每百股获利",
"-",
"-",
"-",
"-",
"-",
"-",
]
big_df = big_df[
[
"序号",
"代码",
"简称",
"申购代码",
"发行总数",
"网上发行数量",
"顶格申购所需资金",
"申购上限",
"发行价格",
"最新价",
"首日收盘价",
"申购日",
"网上申购缴款日",
"网上申购退款日",
"上市日",
"发行结果公告日",
"发行市盈率",
"网上获配比例",
"网下有效申购倍数",
"每百股获利",
]
]
big_df["发行总数"] = pd.to_numeric(big_df["发行总数"])
big_df["网上发行数量"] = pd.to_numeric(big_df["网上发行数量"])
big_df["顶格申购所需资金"] = pd.to_numeric(big_df["顶格申购所需资金"])
big_df["申购上限"] = pd.to_numeric(big_df["申购上限"])
big_df["发行价格"] = pd.to_numeric(big_df["发行价格"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["首日收盘价"] = pd.to_numeric(big_df["首日收盘价"])
big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"])
big_df["网上获配比例"] = pd.to_numeric(big_df["网上获配比例"])
big_df["网下有效申购倍数"] = pd.to_numeric(big_df["网下有效申购倍数"])
big_df["每百股获利"] = pd.to_numeric(big_df["每百股获利"])
big_df["申购日"] = pd.to_datetime(big_df["申购日"]).dt.date
big_df["网上申购缴款日"] = pd.to_datetime(big_df["网上申购缴款日"]).dt.date
big_df["网上申购退款日"] = pd.to_datetime(big_df["网上申购退款日"]).dt.date
big_df["上市日"] = pd.to_datetime(big_df["上市日"]).dt.date
big_df["发行结果公告日"] = pd.to_datetime(big_df["发行结果公告日"]).dt.date
return big_df
else:
params = {
"sortColumns": "APPLY_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "5000",
"pageNumber": "1",
"reportName": "RPTA_APP_IPOAPPLY",
"columns": "SECURITY_CODE,SECURITY_NAME,TRADE_MARKET_CODE,APPLY_CODE,TRADE_MARKET,MARKET_TYPE,ORG_TYPE,ISSUE_NUM,ONLINE_ISSUE_NUM,OFFLINE_PLACING_NUM,TOP_APPLY_MARKETCAP,PREDICT_ONFUND_UPPER,ONLINE_APPLY_UPPER,PREDICT_ONAPPLY_UPPER,ISSUE_PRICE,LATELY_PRICE,CLOSE_PRICE,APPLY_DATE,BALLOT_NUM_DATE,BALLOT_PAY_DATE,LISTING_DATE,AFTER_ISSUE_PE,ONLINE_ISSUE_LWR,INITIAL_MULTIPLE,INDUSTRY_PE_NEW,OFFLINE_EP_OBJECT,CONTINUOUS_1WORD_NUM,TOTAL_CHANGE,PROFIT,LIMIT_UP_PRICE,INFO_CODE,OPEN_PRICE,LD_OPEN_PREMIUM,LD_CLOSE_CHANGE,TURNOVERRATE,LD_HIGH_CHANG,LD_AVERAGE_PRICE,OPEN_DATE,OPEN_AVERAGE_PRICE,PREDICT_PE,PREDICT_ISSUE_PRICE2,PREDICT_ISSUE_PRICE,PREDICT_ISSUE_PRICE1,PREDICT_ISSUE_PE,PREDICT_PE_THREE,ONLINE_APPLY_PRICE,MAIN_BUSINESS",
"filter": market_map[symbol],
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"股票代码",
"股票简称",
"_",
"申购代码",
"_",
"_",
"_",
"发行总数",
"网上发行",
"_",
"顶格申购需配市值",
"_",
"申购上限",
"_",
"发行价格",
"最新价",
"首日收盘价",
"申购日期",
"中签号公布日",
"中签缴款日期",
"上市日期",
"发行市盈率",
"中签率",
"询价累计报价倍数",
"_",
"配售对象报价家数",
"连续一字板数量",
"涨幅",
"每中一签获利",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"行业市盈率",
"_",
"_",
"_",
]
big_df = big_df[
[
"股票代码",
"股票简称",
"申购代码",
"发行总数",
"网上发行",
"顶格申购需配市值",
"申购上限",
"发行价格",
"最新价",
"首日收盘价",
"申购日期",
"中签号公布日",
"中签缴款日期",
"上市日期",
"发行市盈率",
"行业市盈率",
"中签率",
"询价累计报价倍数",
"配售对象报价家数",
"连续一字板数量",
"涨幅",
"每中一签获利",
]
]
big_df["申购日期"] = pd.to_datetime(big_df["申购日期"]).dt.date
big_df["中签号公布日"] = pd.to_datetime(big_df["中签号公布日"]).dt.date
big_df["中签缴款日期"] = pd.to_datetime(big_df["中签缴款日期"]).dt.date
big_df["发行总数"] = pd.to_numeric(big_df["发行总数"])
big_df["网上发行"] = pd.to_numeric(big_df["网上发行"])
big_df["顶格申购需配市值"] = pd.to_numeric(big_df["顶格申购需配市值"])
big_df["申购上限"] = pd.to_numeric(big_df["申购上限"])
big_df["发行价格"] = pd.to_numeric(big_df["发行价格"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["首日收盘价"] = pd.to_numeric(big_df["首日收盘价"])
big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"])
big_df["行业市盈率"] = pd.to_numeric(big_df["行业市盈率"])
big_df["中签率"] = pd.to_numeric(big_df["中签率"])
big_df["询价累计报价倍数"] = pd.to_numeric(big_df["询价累计报价倍数"])
big_df["配售对象报价家数"] = pd.to_numeric(big_df["配售对象报价家数"])
big_df["涨幅"] = pd.to_numeric(big_df["涨幅"])
big_df["每中一签获利"] = pd.to_numeric(big_df["每中一签获利"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_dxsyl_em.py#L109-L338
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 3.913043 |
[
9,
16,
17,
18,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
73,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
109,
110,
111,
112,
113,
114,
116,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
186,
212,
213,
214,
215,
216,
217,
218,
219,
220,
221,
222,
223,
224,
225,
226,
227,
228,
229
] | 28.695652 | false | 5.932203 | 230 | 4 | 71.304348 | 6 |
def stock_xgsglb_em(symbol: str = "京市A股") -> pd.DataFrame:
market_map = {
"全部股票":,
"沪市A股":,
"科创板":,
"深市A股":,
"创业板":,
}
url = "http://datacenter-web.eastmoney.com/api/data/v1/get"
if symbol == "京市A股":
params = {
"sortColumns": "APPLY_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"columns": "ALL",
"reportName": "RPT_NEEQ_ISSUEINFO_LIST",
"quoteColumns": "f14~01~SECURITY_CODE~SECURITY_NAME_ABBR",
"source": "NEEQSELECT",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, 1 + int(total_page)), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"代码",
"-",
"简称",
"申购代码",
"发行总数",
"-",
"发行价格",
"发行市盈率",
"申购日",
"发行结果公告日",
"上市日",
"网上发行数量",
"顶格申购所需资金",
"申购上限",
"网上申购缴款日",
"网上申购退款日",
"-",
"网上获配比例",
"最新价",
"首日收盘价",
"网下有效申购倍数",
"每百股获利",
"-",
"-",
"-",
"-",
"-",
"-",
]
big_df = big_df[
[
"序号",
"代码",
"简称",
"申购代码",
"发行总数",
"网上发行数量",
"顶格申购所需资金",
"申购上限",
"发行价格",
"最新价",
"首日收盘价",
"申购日",
"网上申购缴款日",
"网上申购退款日",
"上市日",
"发行结果公告日",
"发行市盈率",
"网上获配比例",
"网下有效申购倍数",
"每百股获利",
]
]
big_df["发行总数"] = pd.to_numeric(big_df["发行总数"])
big_df["网上发行数量"] = pd.to_numeric(big_df["网上发行数量"])
big_df["顶格申购所需资金"] = pd.to_numeric(big_df["顶格申购所需资金"])
big_df["申购上限"] = pd.to_numeric(big_df["申购上限"])
big_df["发行价格"] = pd.to_numeric(big_df["发行价格"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["首日收盘价"] = pd.to_numeric(big_df["首日收盘价"])
big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"])
big_df["网上获配比例"] = pd.to_numeric(big_df["网上获配比例"])
big_df["网下有效申购倍数"] = pd.to_numeric(big_df["网下有效申购倍数"])
big_df["每百股获利"] = pd.to_numeric(big_df["每百股获利"])
big_df["申购日"] = pd.to_datetime(big_df["申购日"]).dt.date
big_df["网上申购缴款日"] = pd.to_datetime(big_df["网上申购缴款日"]).dt.date
big_df["网上申购退款日"] = pd.to_datetime(big_df["网上申购退款日"]).dt.date
big_df["上市日"] = pd.to_datetime(big_df["上市日"]).dt.date
big_df["发行结果公告日"] = pd.to_datetime(big_df["发行结果公告日"]).dt.date
return big_df
else:
params = {
"sortColumns": "APPLY_DATE,SECURITY_CODE",
"sortTypes": "-1,-1",
"pageSize": "5000",
"pageNumber": "1",
"reportName": "RPTA_APP_IPOAPPLY",
"columns": "SECURITY_CODE,SECURITY_NAME,TRADE_MARKET_CODE,APPLY_CODE,TRADE_MARKET,MARKET_TYPE,ORG_TYPE,ISSUE_NUM,ONLINE_ISSUE_NUM,OFFLINE_PLACING_NUM,TOP_APPLY_MARKETCAP,PREDICT_ONFUND_UPPER,ONLINE_APPLY_UPPER,PREDICT_ONAPPLY_UPPER,ISSUE_PRICE,LATELY_PRICE,CLOSE_PRICE,APPLY_DATE,BALLOT_NUM_DATE,BALLOT_PAY_DATE,LISTING_DATE,AFTER_ISSUE_PE,ONLINE_ISSUE_LWR,INITIAL_MULTIPLE,INDUSTRY_PE_NEW,OFFLINE_EP_OBJECT,CONTINUOUS_1WORD_NUM,TOTAL_CHANGE,PROFIT,LIMIT_UP_PRICE,INFO_CODE,OPEN_PRICE,LD_OPEN_PREMIUM,LD_CLOSE_CHANGE,TURNOVERRATE,LD_HIGH_CHANG,LD_AVERAGE_PRICE,OPEN_DATE,OPEN_AVERAGE_PRICE,PREDICT_PE,PREDICT_ISSUE_PRICE2,PREDICT_ISSUE_PRICE,PREDICT_ISSUE_PRICE1,PREDICT_ISSUE_PE,PREDICT_PE_THREE,ONLINE_APPLY_PRICE,MAIN_BUSINESS",
"filter": market_map[symbol],
"source": "WEB",
"client": "WEB",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"股票代码",
"股票简称",
"_",
"申购代码",
"_",
"_",
"_",
"发行总数",
"网上发行",
"_",
"顶格申购需配市值",
"_",
"申购上限",
"_",
"发行价格",
"最新价",
"首日收盘价",
"申购日期",
"中签号公布日",
"中签缴款日期",
"上市日期",
"发行市盈率",
"中签率",
"询价累计报价倍数",
"_",
"配售对象报价家数",
"连续一字板数量",
"涨幅",
"每中一签获利",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"行业市盈率",
"_",
"_",
"_",
]
big_df = big_df[
[
"股票代码",
"股票简称",
"申购代码",
"发行总数",
"网上发行",
"顶格申购需配市值",
"申购上限",
"发行价格",
"最新价",
"首日收盘价",
"申购日期",
"中签号公布日",
"中签缴款日期",
"上市日期",
"发行市盈率",
"行业市盈率",
"中签率",
"询价累计报价倍数",
"配售对象报价家数",
"连续一字板数量",
"涨幅",
"每中一签获利",
]
]
big_df["申购日期"] = pd.to_datetime(big_df["申购日期"]).dt.date
big_df["中签号公布日"] = pd.to_datetime(big_df["中签号公布日"]).dt.date
big_df["中签缴款日期"] = pd.to_datetime(big_df["中签缴款日期"]).dt.date
big_df["发行总数"] = pd.to_numeric(big_df["发行总数"])
big_df["网上发行"] = pd.to_numeric(big_df["网上发行"])
big_df["顶格申购需配市值"] = pd.to_numeric(big_df["顶格申购需配市值"])
big_df["申购上限"] = pd.to_numeric(big_df["申购上限"])
big_df["发行价格"] = pd.to_numeric(big_df["发行价格"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["首日收盘价"] = pd.to_numeric(big_df["首日收盘价"])
big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"])
big_df["行业市盈率"] = pd.to_numeric(big_df["行业市盈率"])
big_df["中签率"] = pd.to_numeric(big_df["中签率"])
big_df["询价累计报价倍数"] = pd.to_numeric(big_df["询价累计报价倍数"])
big_df["配售对象报价家数"] = pd.to_numeric(big_df["配售对象报价家数"])
big_df["涨幅"] = pd.to_numeric(big_df["涨幅"])
big_df["每中一签获利"] = pd.to_numeric(big_df["每中一签获利"])
return big_df
| 17,859 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_cninfo_yjyg.py
|
stock_report_disclosure
|
(
market: str = "沪深京", period: str = "2021年报"
)
|
return temp_df
|
巨潮资讯-首页-数据-预约披露
http://www.cninfo.com.cn/new/commonUrl?url=data/yypl
:param market: choice of {"沪深京": "szsh", "深市": "sz", "深主板": "szmb", "中小板": "szsme", "创业板": "szcn", "沪市": "sh", "沪主板": "shmb", "科创板": "shkcp"}
:type market: str
:param period: 最近四期的财报
:type period: str
:return: 指定 market 和 period 的数据
:rtype: pandas.DataFrame
|
巨潮资讯-首页-数据-预约披露
http://www.cninfo.com.cn/new/commonUrl?url=data/yypl
:param market: choice of {"沪深京": "szsh", "深市": "sz", "深主板": "szmb", "中小板": "szsme", "创业板": "szcn", "沪市": "sh", "沪主板": "shmb", "科创板": "shkcp"}
:type market: str
:param period: 最近四期的财报
:type period: str
:return: 指定 market 和 period 的数据
:rtype: pandas.DataFrame
| 12 | 85 |
def stock_report_disclosure(
market: str = "沪深京", period: str = "2021年报"
) -> pd.DataFrame:
"""
巨潮资讯-首页-数据-预约披露
http://www.cninfo.com.cn/new/commonUrl?url=data/yypl
:param market: choice of {"沪深京": "szsh", "深市": "sz", "深主板": "szmb", "中小板": "szsme", "创业板": "szcn", "沪市": "sh", "沪主板": "shmb", "科创板": "shkcp"}
:type market: str
:param period: 最近四期的财报
:type period: str
:return: 指定 market 和 period 的数据
:rtype: pandas.DataFrame
"""
market_map = {
"沪深京": "szsh",
"深市": "sz",
"深主板": "szmb",
"创业板": "szcn",
"沪市": "sh",
"沪主板": "shmb",
"科创板": "shkcp",
"北交所": "bj",
}
year = period[:4]
period_map = {
f"{year}一季": f"{year}-03-31",
f"{year}半年报": f"{year}-06-30",
f"{year}三季": f"{year}-09-30",
f"{year}年报": f"{year}-12-31",
}
url = "http://www.cninfo.com.cn/new/information/getPrbookInfo"
params = {
"sectionTime": period_map[period],
"firstTime": "",
"lastTime": "",
"market": market_map[market],
"stockCode": "",
"orderClos": "",
"isDesc": "",
"pagesize": "10000",
"pagenum": "1",
}
r = requests.post(url, params=params)
text_json = r.json()
temp_df = pd.DataFrame(text_json["prbookinfos"])
temp_df.columns = [
"股票代码",
"股票简称",
"首次预约",
"实际披露",
"初次变更",
"二次变更",
"三次变更",
"报告期",
"-",
"组织码",
]
temp_df = temp_df[
[
"股票代码",
"股票简称",
"首次预约",
"初次变更",
"二次变更",
"三次变更",
"实际披露",
]
]
temp_df["首次预约"] = pd.to_datetime(temp_df["首次预约"]).dt.date
temp_df["初次变更"] = pd.to_datetime(temp_df["初次变更"]).dt.date
temp_df["二次变更"] = pd.to_datetime(temp_df["二次变更"]).dt.date
temp_df["三次变更"] = pd.to_datetime(temp_df["三次变更"]).dt.date
temp_df["实际披露"] = pd.to_datetime(temp_df["实际披露"]).dt.date
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_cninfo_yjyg.py#L12-L85
| 25 |
[
0
] | 1.351351 |
[
13,
23,
24,
30,
31,
42,
43,
44,
45,
57,
68,
69,
70,
71,
72,
73
] | 21.621622 | false | 21.73913 | 74 | 1 | 78.378378 | 8 |
def stock_report_disclosure(
market: str = "沪深京", period: str = "2021年报"
) -> pd.DataFrame:
market_map = {
"沪深京": "szsh",
"深市": "sz",
"深主板": "szmb",
"创业板": "szcn",
"沪市": "sh",
"沪主板": "shmb",
"科创板": "shkcp",
"北交所": "bj",
}
year = period[:4]
period_map = {
f"{year}一季": f"{year}-03-31",
f"{year}半年报": f"{year}-06-30",
f"{year}三季": f"{year}-09-30",
f"{year}年报": f"{year}-12-31",
}
url = "http://www.cninfo.com.cn/new/information/getPrbookInfo"
params = {
"sectionTime": period_map[period],
"firstTime": "",
"lastTime": "",
"market": market_map[market],
"stockCode": "",
"orderClos": "",
"isDesc": "",
"pagesize": "10000",
"pagenum": "1",
}
r = requests.post(url, params=params)
text_json = r.json()
temp_df = pd.DataFrame(text_json["prbookinfos"])
temp_df.columns = [
"股票代码",
"股票简称",
"首次预约",
"实际披露",
"初次变更",
"二次变更",
"三次变更",
"报告期",
"-",
"组织码",
]
temp_df = temp_df[
[
"股票代码",
"股票简称",
"首次预约",
"初次变更",
"二次变更",
"三次变更",
"实际披露",
]
]
temp_df["首次预约"] = pd.to_datetime(temp_df["首次预约"]).dt.date
temp_df["初次变更"] = pd.to_datetime(temp_df["初次变更"]).dt.date
temp_df["二次变更"] = pd.to_datetime(temp_df["二次变更"]).dt.date
temp_df["三次变更"] = pd.to_datetime(temp_df["三次变更"]).dt.date
temp_df["实际披露"] = pd.to_datetime(temp_df["实际披露"]).dt.date
return temp_df
| 17,860 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_market_legu.py
|
stock_market_activity_legu
|
()
|
return temp_df
|
乐咕乐股网-赚钱效应分析
https://www.legulegu.com/stockdata/market-activity
:return: 乐咕乐股网-赚钱效应分析
:rtype: pandas.DataFrame
|
乐咕乐股网-赚钱效应分析
https://www.legulegu.com/stockdata/market-activity
:return: 乐咕乐股网-赚钱效应分析
:rtype: pandas.DataFrame
| 13 | 41 |
def stock_market_activity_legu() -> pd.DataFrame:
"""
乐咕乐股网-赚钱效应分析
https://www.legulegu.com/stockdata/market-activity
:return: 乐咕乐股网-赚钱效应分析
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/stockdata/market-activity"
r = requests.get(url)
temp_df = pd.read_html(r.text)[0]
temp_df_one = temp_df.iloc[:, :2]
temp_df_one.columns = ["item", "value"]
temp_df_two = temp_df.iloc[:, 2:4]
temp_df_two.columns = ["item", "value"]
temp_df_three = temp_df.iloc[:, 4:6]
temp_df_three.columns = ["item", "value"]
temp_df = pd.concat([temp_df_one, temp_df_two, temp_df_three])
temp_df.dropna(how="all", axis=0, inplace=True)
soup = BeautifulSoup(r.text, "lxml")
item_str = soup.find("div", attrs={"class": "current-index"}).text
inner_temp_df = pd.DataFrame(item_str.split(":")).T
inner_temp_df.columns = ["item", "value"]
temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
item_str = soup.find("div", attrs={"class": "current-data"}).text.strip()
inner_temp_df = pd.DataFrame(["统计日期", item_str]).T
inner_temp_df.columns = ["item", "value"]
temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
temp_df.reset_index(inplace=True, drop=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_market_legu.py#L13-L41
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 24.137931 |
[
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28
] | 75.862069 | false | 20 | 29 | 1 | 24.137931 | 4 |
def stock_market_activity_legu() -> pd.DataFrame:
url = "https://legulegu.com/stockdata/market-activity"
r = requests.get(url)
temp_df = pd.read_html(r.text)[0]
temp_df_one = temp_df.iloc[:, :2]
temp_df_one.columns = ["item", "value"]
temp_df_two = temp_df.iloc[:, 2:4]
temp_df_two.columns = ["item", "value"]
temp_df_three = temp_df.iloc[:, 4:6]
temp_df_three.columns = ["item", "value"]
temp_df = pd.concat([temp_df_one, temp_df_two, temp_df_three])
temp_df.dropna(how="all", axis=0, inplace=True)
soup = BeautifulSoup(r.text, "lxml")
item_str = soup.find("div", attrs={"class": "current-index"}).text
inner_temp_df = pd.DataFrame(item_str.split(":")).T
inner_temp_df.columns = ["item", "value"]
temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
item_str = soup.find("div", attrs={"class": "current-data"}).text.strip()
inner_temp_df = pd.DataFrame(["统计日期", item_str]).T
inner_temp_df.columns = ["item", "value"]
temp_df = pd.concat([temp_df, inner_temp_df], ignore_index=True)
temp_df.reset_index(inplace=True, drop=True)
return temp_df
| 17,861 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_sse_margin.py
|
stock_margin_sse
|
(
start_date: str = "20010106", end_date: str = "20210208"
)
|
return temp_df
|
上海证券交易所-融资融券数据-融资融券汇总
http://www.sse.com.cn/market/othersdata/margin/sum/
:param start_date: 交易开始日期
:type start_date: str
:param end_date: 交易结束日期
:type end_date: str
:return: 融资融券汇总
:rtype: pandas.DataFrame
|
上海证券交易所-融资融券数据-融资融券汇总
http://www.sse.com.cn/market/othersdata/margin/sum/
:param start_date: 交易开始日期
:type start_date: str
:param end_date: 交易结束日期
:type end_date: str
:return: 融资融券汇总
:rtype: pandas.DataFrame
| 12 | 72 |
def stock_margin_sse(
start_date: str = "20010106", end_date: str = "20210208"
) -> pd.DataFrame:
"""
上海证券交易所-融资融券数据-融资融券汇总
http://www.sse.com.cn/market/othersdata/margin/sum/
:param start_date: 交易开始日期
:type start_date: str
:param end_date: 交易结束日期
:type end_date: str
:return: 融资融券汇总
:rtype: pandas.DataFrame
"""
url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
params = {
"isPagination": "true",
"beginDate": start_date,
"endDate": end_date,
"tabType": "",
"stockCode": "",
"pageHelp.pageSize": "5000",
"pageHelp.pageNo": "1",
"pageHelp.beginPage": "1",
"pageHelp.cacheSize": "1",
"pageHelp.endPage": "5",
"_": "1612773448860",
}
headers = {
"Referer": "http://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"])
temp_df.columns = [
"_",
"信用交易日期",
"_",
"融券卖出量",
"融券余量",
"融券余量金额",
"_",
"_",
"融资买入额",
"融资融券余额",
"融资余额",
"_",
"_",
]
temp_df = temp_df[
[
"信用交易日期",
"融资余额",
"融资买入额",
"融券余量",
"融券余量金额",
"融券卖出量",
"融资融券余额",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_sse_margin.py#L12-L72
| 25 |
[
0
] | 1.639344 |
[
13,
14,
27,
31,
32,
33,
34,
49,
60
] | 14.754098 | false | 21.428571 | 61 | 1 | 85.245902 | 8 |
def stock_margin_sse(
start_date: str = "20010106", end_date: str = "20210208"
) -> pd.DataFrame:
url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
params = {
"isPagination": "true",
"beginDate": start_date,
"endDate": end_date,
"tabType": "",
"stockCode": "",
"pageHelp.pageSize": "5000",
"pageHelp.pageNo": "1",
"pageHelp.beginPage": "1",
"pageHelp.cacheSize": "1",
"pageHelp.endPage": "5",
"_": "1612773448860",
}
headers = {
"Referer": "http://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"])
temp_df.columns = [
"_",
"信用交易日期",
"_",
"融券卖出量",
"融券余量",
"融券余量金额",
"_",
"_",
"融资买入额",
"融资融券余额",
"融资余额",
"_",
"_",
]
temp_df = temp_df[
[
"信用交易日期",
"融资余额",
"融资买入额",
"融券余量",
"融券余量金额",
"融券卖出量",
"融资融券余额",
]
]
return temp_df
| 17,862 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_sse_margin.py
|
stock_margin_detail_sse
|
(date: str = "20210205")
|
return temp_df
|
上海证券交易所-融资融券数据-融资融券明细
http://www.sse.com.cn/market/othersdata/margin/detail/
:param date: 交易日期
:type date: str
:return: 融资融券明细
:rtype: pandas.DataFrame
|
上海证券交易所-融资融券数据-融资融券明细
http://www.sse.com.cn/market/othersdata/margin/detail/
:param date: 交易日期
:type date: str
:return: 融资融券明细
:rtype: pandas.DataFrame
| 75 | 135 |
def stock_margin_detail_sse(date: str = "20210205") -> pd.DataFrame:
"""
上海证券交易所-融资融券数据-融资融券明细
http://www.sse.com.cn/market/othersdata/margin/detail/
:param date: 交易日期
:type date: str
:return: 融资融券明细
:rtype: pandas.DataFrame
"""
url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
params = {
"isPagination": "true",
"tabType": "mxtype",
"detailsDate": date,
"stockCode": "",
"beginDate": "",
"endDate": "",
"pageHelp.pageSize": "5000",
"pageHelp.pageCount": "50",
"pageHelp.pageNo": "1",
"pageHelp.beginPage": "1",
"pageHelp.cacheSize": "1",
"pageHelp.endPage": "21",
"_": "1612773448860",
}
headers = {
"Referer": "http://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"])
temp_df.columns = [
"_",
"信用交易日期",
"融券偿还量",
"融券卖出量",
"融券余量",
"_",
"_",
"融资偿还额",
"融资买入额",
"_",
"融资余额",
"标的证券简称",
"标的证券代码",
]
temp_df = temp_df[
[
"信用交易日期",
"标的证券代码",
"标的证券简称",
"融资余额",
"融资买入额",
"融资偿还额",
"融券余量",
"融券卖出量",
"融券偿还量",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_sse_margin.py#L75-L135
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.754098 |
[
9,
10,
25,
29,
30,
31,
32,
47,
60
] | 14.754098 | false | 21.428571 | 61 | 1 | 85.245902 | 6 |
def stock_margin_detail_sse(date: str = "20210205") -> pd.DataFrame:
url = "http://query.sse.com.cn/marketdata/tradedata/queryMargin.do"
params = {
"isPagination": "true",
"tabType": "mxtype",
"detailsDate": date,
"stockCode": "",
"beginDate": "",
"endDate": "",
"pageHelp.pageSize": "5000",
"pageHelp.pageCount": "50",
"pageHelp.pageNo": "1",
"pageHelp.beginPage": "1",
"pageHelp.cacheSize": "1",
"pageHelp.endPage": "21",
"_": "1612773448860",
}
headers = {
"Referer": "http://www.sse.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"])
temp_df.columns = [
"_",
"信用交易日期",
"融券偿还量",
"融券卖出量",
"融券余量",
"_",
"_",
"融资偿还额",
"融资买入额",
"_",
"融资余额",
"标的证券简称",
"标的证券代码",
]
temp_df = temp_df[
[
"信用交易日期",
"标的证券代码",
"标的证券简称",
"融资余额",
"融资买入额",
"融资偿还额",
"融券余量",
"融券卖出量",
"融券偿还量",
]
]
return temp_df
| 17,863 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_wencai.py
|
_get_file_content_ths
|
(file: str = "ths.js")
|
return file_data
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
| 16 | 27 |
def _get_file_content_ths(file: str = "ths.js") -> str:
"""
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
"""
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_wencai.py#L16-L27
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 66.666667 |
[
8,
9,
10,
11
] | 33.333333 | false | 20.454545 | 12 | 2 | 66.666667 | 5 |
def _get_file_content_ths(file: str = "ths.js") -> str:
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 17,864 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_wencai.py
|
stock_hot_rank_wc
|
(date: str = "20210430")
|
return big_df
|
问财-热门股票排名
https://www.iwencai.com/unifiedwap/result?w=%E7%83%AD%E9%97%A85000%E8%82%A1%E7%A5%A8&querytype=stock&issugs&sign=1620126514335
:param date: 查询日期
:type date: str
:return: 热门股票排名
:rtype: pandas.DataFrame
|
问财-热门股票排名
https://www.iwencai.com/unifiedwap/result?w=%E7%83%AD%E9%97%A85000%E8%82%A1%E7%A5%A8&querytype=stock&issugs&sign=1620126514335
:param date: 查询日期
:type date: str
:return: 热门股票排名
:rtype: pandas.DataFrame
| 30 | 110 |
def stock_hot_rank_wc(date: str = "20210430") -> pd.DataFrame:
"""
问财-热门股票排名
https://www.iwencai.com/unifiedwap/result?w=%E7%83%AD%E9%97%A85000%E8%82%A1%E7%A5%A8&querytype=stock&issugs&sign=1620126514335
:param date: 查询日期
:type date: str
:return: 热门股票排名
:rtype: pandas.DataFrame
"""
url = "http://www.iwencai.com/unifiedwap/unified-wap/v2/result/get-robot-data"
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
headers = {
"hexin-v": v_code,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36",
}
params = {
"question": f"{date}热门5000股票",
"perpage": "5000",
"page": "1",
"secondary_intent": "",
"log_info": '{"input_type":"click"}',
"source": "Ths_iwencai_Xuangu",
"version": "2.0",
"query_area": "",
"block_list": "",
"add_info": '{"urp":{"scene":1,"company":1,"business":1},"contentType":"json"}',
}
big_df = pd.DataFrame()
for page in tqdm(range(1, 11), leave=False):
params.update({
"page": page,
})
r = requests.post(url, data=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["answer"][0]["txt"][0]["content"]["components"][0][
"data"
]["datas"]
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
try:
rank_date_str = big_df.columns[1].split("[")[1].strip("]")
except:
try:
rank_date_str = big_df.columns[2].split("[")[1].strip("]")
except:
rank_date_str = date
big_df.rename(
columns={
"index": "序号",
f"个股热度排名[{rank_date_str}]": "个股热度排名",
f"个股热度[{rank_date_str}]": "个股热度",
"code": "股票代码",
"market_code": "_",
"最新涨跌幅": "涨跌幅",
"最新价": "现价",
"股票代码": "_",
},
inplace=True,
)
big_df = big_df[
[
"序号",
"股票代码",
"股票简称",
"现价",
"涨跌幅",
"个股热度",
"个股热度排名",
]
]
big_df["涨跌幅"] = big_df["涨跌幅"].astype(float).round(2)
big_df["排名日期"] = rank_date_str
big_df["现价"] = pd.to_numeric(big_df["现价"], errors="coerce")
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_wencai.py#L30-L110
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 11.111111 |
[
9,
10,
11,
12,
13,
14,
18,
30,
31,
32,
35,
36,
37,
42,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
66,
77,
78,
79,
80
] | 35.802469 | false | 20.454545 | 81 | 4 | 64.197531 | 6 |
def stock_hot_rank_wc(date: str = "20210430") -> pd.DataFrame:
url = "http://www.iwencai.com/unifiedwap/unified-wap/v2/result/get-robot-data"
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
headers = {
"hexin-v": v_code,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36",
}
params = {
"question": f"{date}热门5000股票",
"perpage": "5000",
"page": "1",
"secondary_intent": "",
"log_info": '{"input_type":"click"}',
"source": "Ths_iwencai_Xuangu",
"version": "2.0",
"query_area": "",
"block_list": "",
"add_info": '{"urp":{"scene":1,"company":1,"business":1},"contentType":"json"}',
}
big_df = pd.DataFrame()
for page in tqdm(range(1, 11), leave=False):
params.update({
"page": page,
})
r = requests.post(url, data=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["answer"][0]["txt"][0]["content"]["components"][0][
"data"
]["datas"]
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
try:
rank_date_str = big_df.columns[1].split("[")[1].strip("]")
except:
try:
rank_date_str = big_df.columns[2].split("[")[1].strip("]")
except:
rank_date_str = date
big_df.rename(
columns={
"index": "序号",
f"个股热度排名[{rank_date_str}]": "个股热度排名",
f"个股热度[{rank_date_str}]": "个股热度",
"code": "股票代码",
"market_code": "_",
"最新涨跌幅": "涨跌幅",
"最新价": "现价",
"股票代码": "_",
},
inplace=True,
)
big_df = big_df[
[
"序号",
"股票代码",
"股票简称",
"现价",
"涨跌幅",
"个股热度",
"个股热度排名",
]
]
big_df["涨跌幅"] = big_df["涨跌幅"].astype(float).round(2)
big_df["排名日期"] = rank_date_str
big_df["现价"] = pd.to_numeric(big_df["现价"], errors="coerce")
return big_df
| 17,865 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ebs_lg.py
|
stock_ebs_lg
|
()
|
return temp_df
|
乐咕乐股-股债利差
https://legulegu.com/stockdata/equity-bond-spread
:return: 股债利差
:rtype: pandas.DataFrame
|
乐咕乐股-股债利差
https://legulegu.com/stockdata/equity-bond-spread
:return: 股债利差
:rtype: pandas.DataFrame
| 14 | 48 |
def stock_ebs_lg() -> pd.DataFrame:
"""
乐咕乐股-股债利差
https://legulegu.com/stockdata/equity-bond-spread
:return: 股债利差
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/equity-bond-spread"
token = get_token_lg()
params = {"token": token, "code": "000300.SH"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.rename(
columns={
"date": "日期",
"close": "沪深300指数",
"peSpread": "股债利差",
"peSpreadAverage": "股债利差均线",
},
inplace=True,
)
temp_df = temp_df[
[
"日期",
"沪深300指数",
"股债利差",
"股债利差均线",
]
]
temp_df["沪深300指数"] = pd.to_numeric(temp_df["沪深300指数"], errors="coerce")
temp_df["股债利差"] = pd.to_numeric(temp_df["股债利差"], errors="coerce")
temp_df["股债利差均线"] = pd.to_numeric(temp_df["股债利差均线"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ebs_lg.py#L14-L48
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 20 |
[
7,
8,
9,
10,
11,
12,
13,
14,
23,
31,
32,
33,
34
] | 37.142857 | false | 28.571429 | 35 | 1 | 62.857143 | 4 |
def stock_ebs_lg() -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/equity-bond-spread"
token = get_token_lg()
params = {"token": token, "code": "000300.SH"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.rename(
columns={
"date": "日期",
"close": "沪深300指数",
"peSpread": "股债利差",
"peSpreadAverage": "股债利差均线",
},
inplace=True,
)
temp_df = temp_df[
[
"日期",
"沪深300指数",
"股债利差",
"股债利差均线",
]
]
temp_df["沪深300指数"] = pd.to_numeric(temp_df["沪深300指数"], errors="coerce")
temp_df["股债利差"] = pd.to_numeric(temp_df["股债利差"], errors="coerce")
temp_df["股债利差均线"] = pd.to_numeric(temp_df["股债利差均线"], errors="coerce")
return temp_df
| 17,866 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_qsjy_em.py
|
stock_qsjy_em
|
(date: str = "20200731")
|
return temp_df
|
东方财富网-数据中心-特色数据-券商业绩月报
http://data.eastmoney.com/other/qsjy.html
:param date: 数据月份,从 2010-06-01 开始, e.g., 需要 2011 年 7 月, 则输入 2011-07-01
:type date: str
:return: 券商业绩月报
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-券商业绩月报
http://data.eastmoney.com/other/qsjy.html
:param date: 数据月份,从 2010-06-01 开始, e.g., 需要 2011 年 7 月, 则输入 2011-07-01
:type date: str
:return: 券商业绩月报
:rtype: pandas.DataFrame
| 12 | 83 |
def stock_qsjy_em(date: str = "20200731") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-券商业绩月报
http://data.eastmoney.com/other/qsjy.html
:param date: 数据月份,从 2010-06-01 开始, e.g., 需要 2011 年 7 月, 则输入 2011-07-01
:type date: str
:return: 券商业绩月报
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "END_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_PERFORMANCE",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,NETPROFIT,NP_YOY,NP_QOQ,ACCUMPROFIT,ACCUMPROFIT_YOY,OPERATE_INCOME,OI_YOY,OI_QOQ,ACCUMOI,ACCUMOI_YOY,NET_ASSETS,NA_YOY",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.columns = [
"代码",
"简称",
"-",
"当月净利润-净利润",
"当月净利润-同比增长",
"当月净利润-环比增长",
"当年累计净利润-累计净利润",
"当年累计净利润-同比增长",
"当月营业收入-营业收入",
"当月营业收入-环比增长",
"当月营业收入-同比增长",
"当年累计营业收入-累计营业收入",
"当年累计营业收入-同比增长",
"净资产-净资产",
"净资产-同比增长",
]
temp_df = temp_df[
[
"简称",
"代码",
"当月净利润-净利润",
"当月净利润-同比增长",
"当月净利润-环比增长",
"当年累计净利润-累计净利润",
"当年累计净利润-同比增长",
"当月营业收入-营业收入",
"当月营业收入-环比增长",
"当月营业收入-同比增长",
"当年累计营业收入-累计营业收入",
"当年累计营业收入-同比增长",
"净资产-净资产",
"净资产-同比增长",
]
]
temp_df["当月净利润-净利润"] = pd.to_numeric(temp_df["当月净利润-净利润"])
temp_df["当月净利润-同比增长"] = pd.to_numeric(temp_df["当月净利润-同比增长"])
temp_df["当月净利润-环比增长"] = pd.to_numeric(temp_df["当月净利润-环比增长"])
temp_df["当年累计净利润-累计净利润"] = pd.to_numeric(temp_df["当年累计净利润-累计净利润"])
temp_df["当年累计净利润-同比增长"] = pd.to_numeric(temp_df["当年累计净利润-同比增长"])
temp_df["当月营业收入-营业收入"] = pd.to_numeric(temp_df["当月营业收入-营业收入"])
temp_df["当月营业收入-环比增长"] = pd.to_numeric(temp_df["当月营业收入-环比增长"])
temp_df["当月营业收入-同比增长"] = pd.to_numeric(temp_df["当月营业收入-同比增长"])
temp_df["当年累计营业收入-累计营业收入"] = pd.to_numeric(temp_df["当年累计营业收入-累计营业收入"])
temp_df["当年累计营业收入-同比增长"] = pd.to_numeric(temp_df["当年累计营业收入-同比增长"])
temp_df["净资产-净资产"] = pd.to_numeric(temp_df["净资产-净资产"])
temp_df["净资产-同比增长"] = pd.to_numeric(temp_df["净资产-同比增长"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_qsjy_em.py#L12-L83
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 12.5 |
[
9,
10,
21,
22,
23,
24,
41,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71
] | 27.777778 | false | 18.518519 | 72 | 1 | 72.222222 | 6 |
def stock_qsjy_em(date: str = "20200731") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "END_DATE",
"sortTypes": "-1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_PERFORMANCE",
"columns": "SECURITY_CODE,SECURITY_NAME_ABBR,END_DATE,NETPROFIT,NP_YOY,NP_QOQ,ACCUMPROFIT,ACCUMPROFIT_YOY,OPERATE_INCOME,OI_YOY,OI_QOQ,ACCUMOI,ACCUMOI_YOY,NET_ASSETS,NA_YOY",
"source": "WEB",
"client": "WEB",
"filter": f"(END_DATE='{'-'.join([date[:4], date[4:6], date[6:]])}')",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.columns = [
"代码",
"简称",
"-",
"当月净利润-净利润",
"当月净利润-同比增长",
"当月净利润-环比增长",
"当年累计净利润-累计净利润",
"当年累计净利润-同比增长",
"当月营业收入-营业收入",
"当月营业收入-环比增长",
"当月营业收入-同比增长",
"当年累计营业收入-累计营业收入",
"当年累计营业收入-同比增长",
"净资产-净资产",
"净资产-同比增长",
]
temp_df = temp_df[
[
"简称",
"代码",
"当月净利润-净利润",
"当月净利润-同比增长",
"当月净利润-环比增长",
"当年累计净利润-累计净利润",
"当年累计净利润-同比增长",
"当月营业收入-营业收入",
"当月营业收入-环比增长",
"当月营业收入-同比增长",
"当年累计营业收入-累计营业收入",
"当年累计营业收入-同比增长",
"净资产-净资产",
"净资产-同比增长",
]
]
temp_df["当月净利润-净利润"] = pd.to_numeric(temp_df["当月净利润-净利润"])
temp_df["当月净利润-同比增长"] = pd.to_numeric(temp_df["当月净利润-同比增长"])
temp_df["当月净利润-环比增长"] = pd.to_numeric(temp_df["当月净利润-环比增长"])
temp_df["当年累计净利润-累计净利润"] = pd.to_numeric(temp_df["当年累计净利润-累计净利润"])
temp_df["当年累计净利润-同比增长"] = pd.to_numeric(temp_df["当年累计净利润-同比增长"])
temp_df["当月营业收入-营业收入"] = pd.to_numeric(temp_df["当月营业收入-营业收入"])
temp_df["当月营业收入-环比增长"] = pd.to_numeric(temp_df["当月营业收入-环比增长"])
temp_df["当月营业收入-同比增长"] = pd.to_numeric(temp_df["当月营业收入-同比增长"])
temp_df["当年累计营业收入-累计营业收入"] = pd.to_numeric(temp_df["当年累计营业收入-累计营业收入"])
temp_df["当年累计营业收入-同比增长"] = pd.to_numeric(temp_df["当年累计营业收入-同比增长"])
temp_df["净资产-净资产"] = pd.to_numeric(temp_df["净资产-净资产"])
temp_df["净资产-同比增长"] = pd.to_numeric(temp_df["净资产-同比增长"])
return temp_df
| 17,867 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_buffett_index_lg.py
|
stock_buffett_index_lg
|
()
|
return temp_df
|
乐估乐股-底部研究-巴菲特指标
https://legulegu.com/stockdata/marketcap-gdp
:return: 巴菲特指标
:rtype: pandas.DataFrame
|
乐估乐股-底部研究-巴菲特指标
https://legulegu.com/stockdata/marketcap-gdp
:return: 巴菲特指标
:rtype: pandas.DataFrame
| 14 | 49 |
def stock_buffett_index_lg() -> pd.DataFrame:
"""
乐估乐股-底部研究-巴菲特指标
https://legulegu.com/stockdata/marketcap-gdp
:return: 巴菲特指标
:rtype: pandas.DataFrame
"""
token = get_token_lg()
url = "https://legulegu.com/api/stockdata/marketcap-gdp/get-marketcap-gdp"
params = {"token": token}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df.rename(
columns={
"marketCap": "总市值",
"gdp": "GDP",
"close": "收盘价",
"date": "日期",
"quantileInAllHistory": "总历史分位数",
"quantileInRecent10Years": "近十年分位数",
},
inplace=True,
)
temp_df = temp_df[
[
"日期",
"收盘价",
"总市值",
"GDP",
"近十年分位数",
"总历史分位数",
]
]
temp_df["日期"] = pd.to_datetime(temp_df["日期"], unit="ms").dt.date
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_buffett_index_lg.py#L14-L49
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 19.444444 |
[
7,
8,
9,
10,
11,
12,
13,
24,
34,
35
] | 27.777778 | false | 33.333333 | 36 | 1 | 72.222222 | 4 |
def stock_buffett_index_lg() -> pd.DataFrame:
token = get_token_lg()
url = "https://legulegu.com/api/stockdata/marketcap-gdp/get-marketcap-gdp"
params = {"token": token}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df.rename(
columns={
"marketCap": "总市值",
"gdp": "GDP",
"close": "收盘价",
"date": "日期",
"quantileInAllHistory": "总历史分位数",
"quantileInRecent10Years": "近十年分位数",
},
inplace=True,
)
temp_df = temp_df[
[
"日期",
"收盘价",
"总市值",
"GDP",
"近十年分位数",
"总历史分位数",
]
]
temp_df["日期"] = pd.to_datetime(temp_df["日期"], unit="ms").dt.date
return temp_df
| 17,868 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_em
|
(date: str = "20220426")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-涨停股池
http://quote.eastmoney.com/ztb/detail#type=ztgc
:return: 涨停股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-涨停股池
http://quote.eastmoney.com/ztb/detail#type=ztgc
:return: 涨停股池
:rtype: pandas.DataFrame
| 21 | 102 |
def stock_zt_pool_em(date: str = "20220426") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-涨停股池
http://quote.eastmoney.com/ztb/detail#type=ztgc
:return: 涨停股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getTopicZTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "10000",
"sort": "fbt:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"连板数",
"首次封板时间",
"最后封板时间",
"封板资金",
"炸板次数",
"所属行业",
"涨停统计",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"成交额",
"流通市值",
"总市值",
"换手率",
"封板资金",
"首次封板时间",
"最后封板时间",
"炸板次数",
"涨停统计",
"连板数",
"所属行业",
]
]
temp_df["首次封板时间"] = temp_df["首次封板时间"].astype(str).str.zfill(6)
temp_df["最后封板时间"] = temp_df["最后封板时间"].astype(str).str.zfill(6)
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"])
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["封板资金"] = pd.to_numeric(temp_df["封板资金"])
temp_df["炸板次数"] = pd.to_numeric(temp_df["炸板次数"])
temp_df["连板数"] = pd.to_numeric(temp_df["连板数"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L21-L102
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.536585 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
43,
48,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
81
] | 30.487805 | false | 7.29927 | 82 | 2 | 69.512195 | 4 |
def stock_zt_pool_em(date: str = "20220426") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getTopicZTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "10000",
"sort": "fbt:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"连板数",
"首次封板时间",
"最后封板时间",
"封板资金",
"炸板次数",
"所属行业",
"涨停统计",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"成交额",
"流通市值",
"总市值",
"换手率",
"封板资金",
"首次封板时间",
"最后封板时间",
"炸板次数",
"涨停统计",
"连板数",
"所属行业",
]
]
temp_df["首次封板时间"] = temp_df["首次封板时间"].astype(str).str.zfill(6)
temp_df["最后封板时间"] = temp_df["最后封板时间"].astype(str).str.zfill(6)
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"])
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["封板资金"] = pd.to_numeric(temp_df["封板资金"])
temp_df["炸板次数"] = pd.to_numeric(temp_df["炸板次数"])
temp_df["连板数"] = pd.to_numeric(temp_df["连板数"])
return temp_df
| 17,869 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_previous_em
|
(date: str = "20210521")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-昨日涨停股池
http://quote.eastmoney.com/ztb/detail#type=zrzt
:return: 昨日涨停股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-昨日涨停股池
http://quote.eastmoney.com/ztb/detail#type=zrzt
:return: 昨日涨停股池
:rtype: pandas.DataFrame
| 105 | 176 |
def stock_zt_pool_previous_em(date: str = "20210521") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-昨日涨停股池
http://quote.eastmoney.com/ztb/detail#type=zrzt
:return: 昨日涨停股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getYesterdayZTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "zs:desc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"振幅",
"涨速",
"昨日封板时间",
"昨日连板数",
"所属行业",
"涨停统计",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"振幅",
"昨日封板时间",
"昨日连板数",
"涨停统计",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df["昨日封板时间"] = temp_df["昨日封板时间"].astype(str).str.zfill(6)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L105-L176
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.722222 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
43,
48,
68,
69,
70,
71
] | 22.222222 | false | 7.29927 | 72 | 2 | 77.777778 | 4 |
def stock_zt_pool_previous_em(date: str = "20210521") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getYesterdayZTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "zs:desc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"振幅",
"涨速",
"昨日封板时间",
"昨日连板数",
"所属行业",
"涨停统计",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"振幅",
"昨日封板时间",
"昨日连板数",
"涨停统计",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df["昨日封板时间"] = temp_df["昨日封板时间"].astype(str).str.zfill(6)
return temp_df
| 17,870 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_strong_em
|
(date: str = "20210521")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-强势股池
http://quote.eastmoney.com/ztb/detail#type=qsgc
:return: 强势股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-强势股池
http://quote.eastmoney.com/ztb/detail#type=qsgc
:return: 强势股池
:rtype: pandas.DataFrame
| 179 | 250 |
def stock_zt_pool_strong_em(date: str = "20210521") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-强势股池
http://quote.eastmoney.com/ztb/detail#type=qsgc
:return: 强势股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getTopicQSPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "zdp:desc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"_",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"是否新高",
"入选理由",
"量比",
"涨速",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"是否新高",
"量比",
"涨停统计",
"入选理由",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L179-L250
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.722222 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
44,
49,
69,
70,
71
] | 20.833333 | false | 7.29927 | 72 | 2 | 79.166667 | 4 |
def stock_zt_pool_strong_em(date: str = "20210521") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getTopicQSPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "zdp:desc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"_",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"是否新高",
"入选理由",
"量比",
"涨速",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"是否新高",
"量比",
"涨停统计",
"入选理由",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
return temp_df
| 17,871 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_sub_new_em
|
(date: str = "20210525")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-次新股池
http://quote.eastmoney.com/ztb/detail#type=cxgc
:return: 次新股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-次新股池
http://quote.eastmoney.com/ztb/detail#type=cxgc
:return: 次新股池
:rtype: pandas.DataFrame
| 253 | 327 |
def stock_zt_pool_sub_new_em(date: str = "20210525") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-次新股池
http://quote.eastmoney.com/ztb/detail#type=cxgc
:return: 次新股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getTopicCXPooll"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "ods:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"_",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"转手率",
"开板几日",
"开板日期",
"上市日期",
"_",
"是否新高",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"转手率",
"开板几日",
"开板日期",
"上市日期",
"是否新高",
"涨停统计",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df.loc[temp_df["涨停价"] > 100000, "涨停价"] = "-"
temp_df.loc[temp_df["上市日期"] == 0, "上市日期"] = "-"
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L253-L327
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.333333 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
45,
50,
70,
71,
72,
73,
74
] | 22.666667 | false | 7.29927 | 75 | 2 | 77.333333 | 4 |
def stock_zt_pool_sub_new_em(date: str = "20210525") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getTopicCXPooll"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "ods:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"_",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"转手率",
"开板几日",
"开板日期",
"上市日期",
"_",
"是否新高",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"转手率",
"开板几日",
"开板日期",
"上市日期",
"是否新高",
"涨停统计",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df.loc[temp_df["涨停价"] > 100000, "涨停价"] = "-"
temp_df.loc[temp_df["上市日期"] == 0, "上市日期"] = "-"
return temp_df
| 17,872 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_zbgc_em
|
(date: str = "20210525")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-炸板股池
http://quote.eastmoney.com/ztb/detail#type=zbgc
:return: 炸板股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-炸板股池
http://quote.eastmoney.com/ztb/detail#type=zbgc
:return: 炸板股池
:rtype: pandas.DataFrame
| 330 | 401 |
def stock_zt_pool_zbgc_em(date: str = "20210525") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-炸板股池
http://quote.eastmoney.com/ztb/detail#type=zbgc
:return: 炸板股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getTopicZBPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "fbt:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"首次封板时间",
"炸板次数",
"振幅",
"涨速",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"首次封板时间",
"炸板次数",
"涨停统计",
"振幅",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df["首次封板时间"] = temp_df["首次封板时间"].astype(str).str.zfill(6)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L330-L401
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.722222 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
43,
48,
68,
69,
70,
71
] | 22.222222 | false | 7.29927 | 72 | 2 | 77.777778 | 4 |
def stock_zt_pool_zbgc_em(date: str = "20210525") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getTopicZBPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "170",
"sort": "fbt:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨停价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"换手率",
"首次封板时间",
"炸板次数",
"振幅",
"涨速",
"涨停统计",
"所属行业",
]
temp_df["涨停统计"] = (
temp_df["涨停统计"].apply(lambda x: dict(x)["days"]).astype(str)
+ "/"
+ temp_df["涨停统计"].apply(lambda x: dict(x)["ct"]).astype(str)
)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"涨停价",
"成交额",
"流通市值",
"总市值",
"换手率",
"涨速",
"首次封板时间",
"炸板次数",
"涨停统计",
"振幅",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["涨停价"] = temp_df["涨停价"] / 1000
temp_df["首次封板时间"] = temp_df["首次封板时间"].astype(str).str.zfill(6)
return temp_df
| 17,873 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_ztb_em.py
|
stock_zt_pool_dtgc_em
|
(date: str = "20220425")
|
return temp_df
|
东方财富网-行情中心-涨停板行情-跌停股池
http://quote.eastmoney.com/ztb/detail#type=dtgc
:param date: 交易日
:type date: str
:return: 跌停股池
:rtype: pandas.DataFrame
|
东方财富网-行情中心-涨停板行情-跌停股池
http://quote.eastmoney.com/ztb/detail#type=dtgc
:param date: 交易日
:type date: str
:return: 跌停股池
:rtype: pandas.DataFrame
| 404 | 485 |
def stock_zt_pool_dtgc_em(date: str = "20220425") -> pd.DataFrame:
"""
东方财富网-行情中心-涨停板行情-跌停股池
http://quote.eastmoney.com/ztb/detail#type=dtgc
:param date: 交易日
:type date: str
:return: 跌停股池
:rtype: pandas.DataFrame
"""
url = "http://push2ex.eastmoney.com/getTopicDTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "10000",
"sort": "fund:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"动态市盈率",
"换手率",
"封单资金",
"最后封板时间",
"板上成交额",
"连续跌停",
"开板次数",
"所属行业",
]
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"成交额",
"流通市值",
"总市值",
"动态市盈率",
"换手率",
"封单资金",
"最后封板时间",
"板上成交额",
"连续跌停",
"开板次数",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["最后封板时间"] = temp_df["最后封板时间"].astype(str).str.zfill(6)
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"])
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"])
temp_df["动态市盈率"] = pd.to_numeric(temp_df["动态市盈率"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["封单资金"] = pd.to_numeric(temp_df["封单资金"])
temp_df["板上成交额"] = pd.to_numeric(temp_df["板上成交额"])
temp_df["连续跌停"] = pd.to_numeric(temp_df["连续跌停"])
temp_df["开板次数"] = pd.to_numeric(temp_df["开板次数"])
temp_df["开板次数"] = pd.to_numeric(temp_df["开板次数"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_ztb_em.py#L404-L485
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 10.97561 |
[
9,
10,
19,
20,
21,
22,
23,
24,
25,
26,
45,
65,
66,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
81
] | 31.707317 | false | 7.29927 | 82 | 2 | 68.292683 | 6 |
def stock_zt_pool_dtgc_em(date: str = "20220425") -> pd.DataFrame:
url = "http://push2ex.eastmoney.com/getTopicDTPool"
params = {
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"dpt": "wz.ztzt",
"Pageindex": "0",
"pagesize": "10000",
"sort": "fund:asc",
"date": date,
"_": "1621590489736",
}
r = requests.get(url, params=params)
data_json = r.json()
if data_json["data"] is None:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["pool"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"代码",
"_",
"名称",
"最新价",
"涨跌幅",
"成交额",
"流通市值",
"总市值",
"动态市盈率",
"换手率",
"封单资金",
"最后封板时间",
"板上成交额",
"连续跌停",
"开板次数",
"所属行业",
]
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"涨跌幅",
"最新价",
"成交额",
"流通市值",
"总市值",
"动态市盈率",
"换手率",
"封单资金",
"最后封板时间",
"板上成交额",
"连续跌停",
"开板次数",
"所属行业",
]
]
temp_df["最新价"] = temp_df["最新价"] / 1000
temp_df["最后封板时间"] = temp_df["最后封板时间"].astype(str).str.zfill(6)
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"])
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"])
temp_df["动态市盈率"] = pd.to_numeric(temp_df["动态市盈率"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["封单资金"] = pd.to_numeric(temp_df["封单资金"])
temp_df["板上成交额"] = pd.to_numeric(temp_df["板上成交额"])
temp_df["连续跌停"] = pd.to_numeric(temp_df["连续跌停"])
temp_df["开板次数"] = pd.to_numeric(temp_df["开板次数"])
temp_df["开板次数"] = pd.to_numeric(temp_df["开板次数"])
return temp_df
| 17,874 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_zh_a_spot_em
|
()
|
return temp_df
|
东方财富网-沪深京 A 股-实时行情
https://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-沪深京 A 股-实时行情
https://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 13 | 122 |
def stock_zh_a_spot_em() -> pd.DataFrame:
"""
东方财富网-沪深京 A 股-实时行情
https://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L13-L122
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.363636 |
[
7,
8,
21,
22,
23,
24,
25,
26,
59,
60,
61,
62,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109
] | 30 | false | 3.979239 | 110 | 2 | 70 | 4 |
def stock_zh_a_spot_em() -> pd.DataFrame:
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,875 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_sh_a_spot_em
|
()
|
return temp_df
|
东方财富网-沪 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-沪 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 125 | 234 |
def stock_sh_a_spot_em() -> pd.DataFrame:
"""
东方财富网-沪 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:1 t:2,m:1 t:23",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L125-L234
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.363636 |
[
7,
8,
21,
22,
23,
24,
25,
26,
59,
60,
61,
62,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109
] | 30 | false | 3.979239 | 110 | 2 | 70 | 4 |
def stock_sh_a_spot_em() -> pd.DataFrame:
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:1 t:2,m:1 t:23",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,876 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_sz_a_spot_em
|
()
|
return temp_df
|
东方财富网-深 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-深 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 237 | 346 |
def stock_sz_a_spot_em() -> pd.DataFrame:
"""
东方财富网-深 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L237-L346
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.363636 |
[
7,
8,
21,
22,
23,
24,
25,
26,
59,
60,
61,
62,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109
] | 30 | false | 3.979239 | 110 | 2 | 70 | 4 |
def stock_sz_a_spot_em() -> pd.DataFrame:
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,877 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_bj_a_spot_em
|
()
|
return temp_df
|
东方财富网-京 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-京 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 349 | 458 |
def stock_bj_a_spot_em() -> pd.DataFrame:
"""
东方财富网-京 A 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:81 s:2048",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L349-L458
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.363636 |
[
7,
8,
21,
22,
23,
24,
25,
26,
59,
60,
61,
62,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109
] | 30 | false | 3.979239 | 110 | 2 | 70 | 4 |
def stock_bj_a_spot_em() -> pd.DataFrame:
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:81 s:2048",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,878 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_new_a_spot_em
|
()
|
return temp_df
|
东方财富网-新股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-新股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 461 | 575 |
def stock_new_a_spot_em() -> pd.DataFrame:
"""
东方财富网-新股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f26",
"fs": "m:0 f:8,m:1 f:8",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"上市日期",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"上市日期",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
temp_df["上市日期"] = pd.to_datetime(temp_df["上市日期"], format="%Y%m%d").dt.date
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L461-L575
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.086957 |
[
7,
8,
22,
23,
24,
25,
26,
27,
61,
62,
63,
64,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
113,
114
] | 29.565217 | false | 3.979239 | 115 | 2 | 70.434783 | 4 |
def stock_new_a_spot_em() -> pd.DataFrame:
url = "http://82.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f26",
"fs": "m:0 f:8,m:1 f:8",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"上市日期",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"上市日期",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
temp_df["上市日期"] = pd.to_datetime(temp_df["上市日期"], format="%Y%m%d").dt.date
return temp_df
| 17,879 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_kc_a_spot_em
|
()
|
return temp_df
|
东方财富网-科创板-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网-科创板-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 578 | 688 |
def stock_kc_a_spot_em() -> pd.DataFrame:
"""
东方财富网-科创板-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://7.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "m:1 t:23",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L578-L688
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.306306 |
[
7,
8,
22,
23,
24,
25,
26,
27,
60,
61,
62,
63,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110
] | 29.72973 | false | 3.979239 | 111 | 2 | 70.27027 | 4 |
def stock_kc_a_spot_em() -> pd.DataFrame:
url = "http://7.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "m:1 t:23",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,880 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_zh_b_spot_em
|
()
|
return temp_df
|
东方财富网- B 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
|
东方财富网- B 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
| 691 | 800 |
def stock_zh_b_spot_em() -> pd.DataFrame:
"""
东方财富网- B 股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 实时行情
:rtype: pandas.DataFrame
"""
url = "http://28.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:7,m:1 t:3",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L691-L800
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 6.363636 |
[
7,
8,
21,
22,
23,
24,
25,
26,
59,
60,
61,
62,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109
] | 30 | false | 3.979239 | 110 | 2 | 70 | 4 |
def stock_zh_b_spot_em() -> pd.DataFrame:
url = "http://28.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:7,m:1 t:3",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"5分钟涨跌",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"总市值",
"流通市值",
"涨速",
"市净率",
"60日涨跌幅",
"年初至今涨跌幅",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"最高",
"最低",
"今开",
"昨收",
"量比",
"换手率",
"市盈率-动态",
"市净率",
"总市值",
"流通市值",
"涨速",
"5分钟涨跌",
"60日涨跌幅",
"年初至今涨跌幅",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
temp_df["市盈率-动态"] = pd.to_numeric(temp_df["市盈率-动态"], errors="coerce")
temp_df["市净率"] = pd.to_numeric(temp_df["市净率"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["流通市值"] = pd.to_numeric(temp_df["流通市值"], errors="coerce")
temp_df["涨速"] = pd.to_numeric(temp_df["涨速"], errors="coerce")
temp_df["5分钟涨跌"] = pd.to_numeric(temp_df["5分钟涨跌"], errors="coerce")
temp_df["60日涨跌幅"] = pd.to_numeric(temp_df["60日涨跌幅"], errors="coerce")
temp_df["年初至今涨跌幅"] = pd.to_numeric(temp_df["年初至今涨跌幅"], errors="coerce")
return temp_df
| 17,881 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
code_id_map_em
|
()
|
return code_id_dict
|
东方财富-股票和市场代码
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 股票和市场代码
:rtype: dict
|
东方财富-股票和市场代码
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 股票和市场代码
:rtype: dict
| 804 | 873 |
def code_id_map_em() -> dict:
"""
东方财富-股票和市场代码
http://quote.eastmoney.com/center/gridlist.html#hs_a_board
:return: 股票和市场代码
:rtype: dict
"""
url = "http://80.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:1 t:2,m:1 t:23",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df["market_id"] = 1
temp_df.columns = ["sh_code", "sh_id"]
code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
temp_df_sz["sz_id"] = 0
code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:81 s:2048",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
temp_df_sz["bj_id"] = 0
code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
return code_id_dict
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L804-L873
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10 |
[
7,
8,
21,
22,
23,
24,
25,
26,
27,
28,
29,
42,
43,
44,
45,
46,
47,
48,
49,
62,
63,
64,
65,
66,
67,
68,
69
] | 38.571429 | false | 3.979239 | 70 | 4 | 61.428571 | 4 |
def code_id_map_em() -> dict:
url = "http://80.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:1 t:2,m:1 t:23",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df["market_id"] = 1
temp_df.columns = ["sh_code", "sh_id"]
code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:6,m:0 t:80",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
temp_df_sz["sz_id"] = 0
code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:0 t:81 s:2048",
"fields": "f12",
"_": "1623833739532",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["diff"]:
return dict()
temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
temp_df_sz["bj_id"] = 0
code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
return code_id_dict
| 17,882 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_zh_a_hist
|
(
symbol: str = "000001",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
)
|
return temp_df
|
东方财富网-行情首页-沪深京 A 股-每日行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
|
东方财富网-行情首页-沪深京 A 股-每日行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
| 876 | 948 |
def stock_zh_a_hist(
symbol: str = "000001",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富网-行情首页-沪深京 A 股-每日行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
"""
code_id_dict = code_id_map_em()
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": start_date,
"end": end_date,
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not (data_json["data"] and data_json["data"]["klines"]):
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L876-L948
| 25 |
[
0
] | 1.369863 |
[
23,
24,
25,
26,
27,
38,
39,
40,
41,
42,
45,
58,
59,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
72
] | 32.876712 | false | 3.979239 | 73 | 4 | 67.123288 | 14 |
def stock_zh_a_hist(
symbol: str = "000001",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
) -> pd.DataFrame:
code_id_dict = code_id_map_em()
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": start_date,
"end": end_date,
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not (data_json["data"] and data_json["data"]["klines"]):
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
| 17,883 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_zh_a_hist_min_em
|
(
symbol: str = "000001",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
)
|
东方财富网-行情首页-沪深京 A 股-每日分时行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
|
东方财富网-行情首页-沪深京 A 股-每日分时行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
| 951 | 1,078 |
def stock_zh_a_hist_min_em(
symbol: str = "000001",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富网-行情首页-沪深京 A 股-每日分时行情
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
"""
code_id_dict = code_id_map_em()
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"ndays": "5",
"iscr": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L951-L1078
| 25 |
[
0
] | 0.78125 |
[
23,
24,
29,
30,
31,
40,
41,
42,
45,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
68,
69,
80,
81,
82,
85,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
112,
127
] | 33.59375 | false | 3.979239 | 128 | 4 | 66.40625 | 14 |
def stock_zh_a_hist_min_em(
symbol: str = "000001",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
) -> pd.DataFrame:
code_id_dict = code_id_map_em()
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"ndays": "5",
"iscr": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
| 17,884 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_zh_a_hist_pre_min_em
|
(
symbol: str = "000001",
start_time: str = "09:00:00",
end_time: str = "15:50:00",
)
|
return temp_df
|
东方财富网-行情首页-沪深京 A 股-每日分时行情包含盘前数据
http://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_time: 开始时间
:type start_time: str
:param end_time: 结束时间
:type end_time: str
:return: 每日分时行情包含盘前数据
:rtype: pandas.DataFrame
|
东方财富网-行情首页-沪深京 A 股-每日分时行情包含盘前数据
http://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_time: 开始时间
:type start_time: str
:param end_time: 结束时间
:type end_time: str
:return: 每日分时行情包含盘前数据
:rtype: pandas.DataFrame
| 1,081 | 1,139 |
def stock_zh_a_hist_pre_min_em(
symbol: str = "000001",
start_time: str = "09:00:00",
end_time: str = "15:50:00",
) -> pd.DataFrame:
"""
东方财富网-行情首页-沪深京 A 股-每日分时行情包含盘前数据
http://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param start_time: 开始时间
:type start_time: str
:param end_time: 结束时间
:type end_time: str
:return: 每日分时行情包含盘前数据
:rtype: pandas.DataFrame
"""
code_id_dict = code_id_map_em()
url = "https://push2.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"ndays": "1",
"iscr": "1",
"iscca": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
date_format = temp_df.index[0].date().isoformat()
temp_df = temp_df[
date_format + " " + start_time : date_format + " " + end_time
]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1081-L1139
| 25 |
[
0
] | 1.694915 |
[
17,
18,
19,
29,
30,
31,
34,
44,
45,
46,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58
] | 33.898305 | false | 3.979239 | 59 | 2 | 66.101695 | 10 |
def stock_zh_a_hist_pre_min_em(
symbol: str = "000001",
start_time: str = "09:00:00",
end_time: str = "15:50:00",
) -> pd.DataFrame:
code_id_dict = code_id_map_em()
url = "https://push2.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"ndays": "1",
"iscr": "1",
"iscca": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
date_format = temp_df.index[0].date().isoformat()
temp_df = temp_df[
date_format + " " + start_time : date_format + " " + end_time
]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
| 17,885 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_hk_spot_em
|
()
|
return temp_df
|
东方财富网-港股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hk_stocks
:return: 港股-实时行情
:rtype: pandas.DataFrame
|
东方财富网-港股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hk_stocks
:return: 港股-实时行情
:rtype: pandas.DataFrame
| 1,142 | 1,228 |
def stock_hk_spot_em() -> pd.DataFrame:
"""
东方财富网-港股-实时行情
http://quote.eastmoney.com/center/gridlist.html#hk_stocks
:return: 港股-实时行情
:rtype: pandas.DataFrame
"""
url = "http://72.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:128 t:3,m:128 t:4,m:128 t:1,m:128 t:2",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1624010056945",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"_",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"_",
"_",
"_",
"市净率",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"今开",
"最高",
"最低",
"昨收",
"成交量",
"成交额",
]
]
temp_df["序号"] = pd.to_numeric(temp_df["序号"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1142-L1228
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.045977 |
[
7,
8,
21,
22,
23,
24,
57,
58,
59,
60,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86
] | 24.137931 | false | 3.979239 | 87 | 1 | 75.862069 | 4 |
def stock_hk_spot_em() -> pd.DataFrame:
url = "http://72.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "50000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:128 t:3,m:128 t:4,m:128 t:1,m:128 t:2",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1624010056945",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"市盈率-动态",
"量比",
"_",
"代码",
"_",
"名称",
"最高",
"最低",
"今开",
"昨收",
"_",
"_",
"_",
"市净率",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df = temp_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"今开",
"最高",
"最低",
"昨收",
"成交量",
"成交额",
]
]
temp_df["序号"] = pd.to_numeric(temp_df["序号"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
return temp_df
| 17,886 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_hk_hist
|
(
symbol: str = "40224",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
)
|
return temp_df
|
东方财富网-行情-港股-每日行情
http://quote.eastmoney.com/hk/08367.html
:param symbol: 港股-每日行情
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
|
东方财富网-行情-港股-每日行情
http://quote.eastmoney.com/hk/08367.html
:param symbol: 港股-每日行情
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
| 1,231 | 1,303 |
def stock_hk_hist(
symbol: str = "40224",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富网-行情-港股-每日行情
http://quote.eastmoney.com/hk/08367.html
:param symbol: 港股-每日行情
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
"""
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://33.push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"secid": f"116.{symbol}",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"end": "20500000",
"lmt": "1000000",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
if temp_df.empty:
return pd.DataFrame()
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df = temp_df[start_date:end_date]
if temp_df.empty:
return pd.DataFrame()
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1231-L1303
| 25 |
[
0
] | 1.369863 |
[
23,
24,
25,
26,
37,
38,
39,
42,
43,
44,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72
] | 35.616438 | false | 3.979239 | 73 | 4 | 64.383562 | 14 |
def stock_hk_hist(
symbol: str = "40224",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
) -> pd.DataFrame:
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://33.push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"secid": f"116.{symbol}",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"end": "20500000",
"lmt": "1000000",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
if temp_df.empty:
return pd.DataFrame()
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df = temp_df[start_date:end_date]
if temp_df.empty:
return pd.DataFrame()
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
| 17,887 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_hk_hist_min_em
|
(
symbol: str = "01611",
period: str = "1",
adjust: str = "",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
)
|
return temp_df
|
东方财富网-行情-港股-每日分时行情
http://quote.eastmoney.com/hk/00948.html
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
|
东方财富网-行情-港股-每日分时行情
http://quote.eastmoney.com/hk/00948.html
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
| 1,306 | 1,432 |
def stock_hk_hist_min_em(
symbol: str = "01611",
period: str = "1",
adjust: str = "",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
) -> pd.DataFrame:
"""
东方财富网-行情-港股-每日分时行情
http://quote.eastmoney.com/hk/00948.html
:param symbol: 股票代码
:type symbol: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
"""
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "http://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"iscr": "0",
"ndays": "5",
"secid": f"116.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"116.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1306-L1432
| 25 |
[
0
] | 0.787402 |
[
23,
28,
29,
30,
39,
40,
41,
44,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
67,
68,
79,
80,
81,
84,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
126
] | 33.070866 | false | 3.979239 | 127 | 4 | 66.929134 | 14 |
def stock_hk_hist_min_em(
symbol: str = "01611",
period: str = "1",
adjust: str = "",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
) -> pd.DataFrame:
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "http://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"iscr": "0",
"ndays": "5",
"secid": f"116.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"116.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
| 17,888 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_us_spot_em
|
()
|
return temp_df
|
东方财富-美股-实时行情
http://quote.eastmoney.com/center/gridlist.html#us_stocks
:return: 美股-实时行情; 延迟 15 min
:rtype: pandas.DataFrame
|
东方财富-美股-实时行情
http://quote.eastmoney.com/center/gridlist.html#us_stocks
:return: 美股-实时行情; 延迟 15 min
:rtype: pandas.DataFrame
| 1,435 | 1,531 |
def stock_us_spot_em() -> pd.DataFrame:
"""
东方财富-美股-实时行情
http://quote.eastmoney.com/center/gridlist.html#us_stocks
:return: 美股-实时行情; 延迟 15 min
:rtype: pandas.DataFrame
"""
url = "http://72.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "20000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:105,m:106,m:107",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152",
"_": "1624010056945",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"_",
"_",
"_",
"简称",
"编码",
"名称",
"最高价",
"最低价",
"开盘价",
"昨收价",
"总市值",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"市盈率",
"_",
"_",
"_",
"_",
"_",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df["代码"] = temp_df["编码"].astype(str) + "." + temp_df["简称"]
temp_df = temp_df[
[
"序号",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"开盘价",
"最高价",
"最低价",
"昨收价",
"总市值",
"市盈率",
"成交量",
"成交额",
"振幅",
"换手率",
"代码",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["开盘价"] = pd.to_numeric(temp_df["开盘价"], errors="coerce")
temp_df["最高价"] = pd.to_numeric(temp_df["最高价"], errors="coerce")
temp_df["最低价"] = pd.to_numeric(temp_df["最低价"], errors="coerce")
temp_df["昨收价"] = pd.to_numeric(temp_df["昨收价"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["市盈率"] = pd.to_numeric(temp_df["市盈率"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1435-L1531
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 7.216495 |
[
7,
8,
21,
22,
23,
24,
59,
60,
61,
62,
63,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96
] | 25.773196 | false | 3.979239 | 97 | 1 | 74.226804 | 4 |
def stock_us_spot_em() -> pd.DataFrame:
url = "http://72.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "20000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"fid": "f3",
"fs": "m:105,m:106,m:107",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152",
"_": "1624010056945",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.columns = [
"_",
"最新价",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
"_",
"_",
"_",
"简称",
"编码",
"名称",
"最高价",
"最低价",
"开盘价",
"昨收价",
"总市值",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"市盈率",
"_",
"_",
"_",
"_",
"_",
]
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(columns={"index": "序号"}, inplace=True)
temp_df["代码"] = temp_df["编码"].astype(str) + "." + temp_df["简称"]
temp_df = temp_df[
[
"序号",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"开盘价",
"最高价",
"最低价",
"昨收价",
"总市值",
"市盈率",
"成交量",
"成交额",
"振幅",
"换手率",
"代码",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
temp_df["开盘价"] = pd.to_numeric(temp_df["开盘价"], errors="coerce")
temp_df["最高价"] = pd.to_numeric(temp_df["最高价"], errors="coerce")
temp_df["最低价"] = pd.to_numeric(temp_df["最低价"], errors="coerce")
temp_df["昨收价"] = pd.to_numeric(temp_df["昨收价"], errors="coerce")
temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
temp_df["市盈率"] = pd.to_numeric(temp_df["市盈率"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
return temp_df
| 17,889 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_us_hist
|
(
symbol: str = "105.MSFT",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
)
|
return temp_df
|
东方财富网-行情-美股-每日行情
http://quote.eastmoney.com/us/ENTX.html#fullScreenChart
:param symbol: 股票代码; 此股票代码需要通过调用 ak.stock_us_spot_em() 的 `代码` 字段获取
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
|
东方财富网-行情-美股-每日行情
http://quote.eastmoney.com/us/ENTX.html#fullScreenChart
:param symbol: 股票代码; 此股票代码需要通过调用 ak.stock_us_spot_em() 的 `代码` 字段获取
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
| 1,534 | 1,605 |
def stock_us_hist(
symbol: str = "105.MSFT",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富网-行情-美股-每日行情
http://quote.eastmoney.com/us/ENTX.html#fullScreenChart
:param symbol: 股票代码; 此股票代码需要通过调用 ak.stock_us_spot_em() 的 `代码` 字段获取
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "1", "hfq": "2", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
"""
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
url = "http://63.push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"secid": f"{symbol}",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"end": "20500000",
"lmt": "1000000",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["klines"]:
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df.sort_values(["日期"], inplace=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1534-L1605
| 25 |
[
0
] | 1.388889 |
[
23,
24,
25,
26,
37,
38,
39,
40,
41,
44,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71
] | 34.722222 | false | 3.979239 | 72 | 3 | 65.277778 | 14 |
def stock_us_hist(
symbol: str = "105.MSFT",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "22220101",
adjust: str = "",
) -> pd.DataFrame:
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
url = "http://63.push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"secid": f"{symbol}",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"end": "20500000",
"lmt": "1000000",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["klines"]:
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df.sort_values(["日期"], inplace=True)
return temp_df
| 17,890 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hist_em.py
|
stock_us_hist_min_em
|
(
symbol: str = "105.ATER",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
)
|
return temp_df
|
东方财富网-行情首页-美股-每日分时行情
http://quote.eastmoney.com/us/ATER.html
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
|
东方财富网-行情首页-美股-每日分时行情
http://quote.eastmoney.com/us/ATER.html
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
| 1,608 | 1,663 |
def stock_us_hist_min_em(
symbol: str = "105.ATER",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
) -> pd.DataFrame:
"""
东方财富网-行情首页-美股-每日分时行情
http://quote.eastmoney.com/us/ATER.html
:param symbol: 股票代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 每日分时行情
:rtype: pandas.DataFrame
"""
url = "http://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"iscr": "0",
"ndays": "5",
"secid": f"{symbol.split('.')[0]}.{symbol.split('.')[1]}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["trends"]:
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hist_em.py#L1608-L1663
| 25 |
[
0
] | 1.785714 |
[
17,
18,
27,
28,
29,
30,
31,
34,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55
] | 35.714286 | false | 3.979239 | 56 | 3 | 64.285714 | 10 |
def stock_us_hist_min_em(
symbol: str = "105.ATER",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
) -> pd.DataFrame:
url = "http://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "fa5fd1943c7b386f172d6893dbfba10b",
"iscr": "0",
"ndays": "5",
"secid": f"{symbol.split('.')[0]}.{symbol.split('.')[1]}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not data_json["data"]["trends"]:
return pd.DataFrame()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
| 17,891 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
_stock_balance_sheet_by_report_ctype_em
|
(symbol: str = "SH600519")
|
return company_type
|
东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh601878#zcfzb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
:rtype: str
|
东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh601878#zcfzb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
:rtype: str
| 16 | 30 |
def _stock_balance_sheet_by_report_ctype_em(symbol: str = "SH600519") -> str:
"""
东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh601878#zcfzb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 东方财富-股票-财务分析-资产负债表-按报告期-公司类型判断
:rtype: str
"""
url = f"https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index"
params = {"type": "web", "code": symbol.lower()}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
company_type = soup.find(attrs={"id": "hidctype"})["value"]
return company_type
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L16-L30
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 60 |
[
9,
10,
11,
12,
13,
14
] | 40 | false | 8.5 | 15 | 1 | 60 | 6 |
def _stock_balance_sheet_by_report_ctype_em(symbol: str = "SH600519") -> str:
url = f"https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index"
params = {"type": "web", "code": symbol.lower()}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
company_type = soup.find(attrs={"id": "hidctype"})["value"]
return company_type
| 17,892 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_balance_sheet_by_report_em
|
(symbol: str = "SH600519")
|
return big_df
|
东方财富-股票-财务分析-资产负债表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按报告期
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-资产负债表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按报告期
:rtype: pandas.DataFrame
| 33 | 72 |
def stock_balance_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
"""
东方财富-股票-财务分析-资产负债表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按报告期
:rtype: pandas.DataFrame
"""
company_type = _stock_balance_sheet_by_report_ctype_em(symbol=symbol)
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L33-L72
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 22.5 |
[
9,
10,
11,
16,
17,
18,
19,
20,
21,
22,
25,
26,
27,
28,
35,
36,
37,
38,
39
] | 47.5 | false | 8.5 | 40 | 3 | 52.5 | 6 |
def stock_balance_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
company_type = _stock_balance_sheet_by_report_ctype_em(symbol=symbol)
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,893 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_balance_sheet_by_yearly_em
|
(symbol: str = "SH600036")
|
return big_df
|
东方财富-股票-财务分析-资产负债表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按年度
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-资产负债表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按年度
:rtype: pandas.DataFrame
| 75 | 121 |
def stock_balance_sheet_by_yearly_em(symbol: str = "SH600036") -> pd.DataFrame:
"""
东方财富-股票-财务分析-资产负债表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 资产负债表-按年度
:rtype: pandas.DataFrame
"""
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbDateAjaxNew"
company_type = _stock_balance_sheet_by_report_ctype_em(symbol)
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
try:
temp_df = pd.DataFrame(data_json["data"])
except:
company_type = 3
params.update({"companyType": company_type})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L75-L121
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 19.148936 |
[
9,
10,
11,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
32,
33,
34,
35,
42,
43,
44,
45,
46
] | 55.319149 | false | 8.5 | 47 | 4 | 44.680851 | 6 |
def stock_balance_sheet_by_yearly_em(symbol: str = "SH600036") -> pd.DataFrame:
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbDateAjaxNew"
company_type = _stock_balance_sheet_by_report_ctype_em(symbol)
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
try:
temp_df = pd.DataFrame(data_json["data"])
except:
company_type = 3
params.update({"companyType": company_type})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/zcfzbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,894 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_profit_sheet_by_report_em
|
(symbol: str = "SH600519")
|
return big_df
|
东方财富-股票-财务分析-利润表-报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-报告期
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-利润表-报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-报告期
:rtype: pandas.DataFrame
| 124 | 163 |
def stock_profit_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
"""
东方财富-股票-财务分析-利润表-报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-报告期
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"code": symbol,
"dates": item,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L124-L163
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 22.5 |
[
9,
10,
11,
16,
17,
18,
19,
20,
21,
22,
25,
26,
27,
28,
35,
36,
37,
38,
39
] | 47.5 | false | 8.5 | 40 | 3 | 52.5 | 6 |
def stock_profit_sheet_by_report_em(symbol: str = "SH600519") -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"code": symbol,
"dates": item,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,895 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_profit_sheet_by_yearly_em
|
(symbol: str = "SH600519")
|
return big_df
|
东方财富-股票-财务分析-利润表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按年度
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-利润表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按年度
:rtype: pandas.DataFrame
| 166 | 205 |
def stock_profit_sheet_by_yearly_em(symbol: str = "SH600519") -> pd.DataFrame:
"""
东方财富-股票-财务分析-利润表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按年度
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L166-L205
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 22.5 |
[
9,
10,
11,
16,
17,
18,
19,
20,
21,
22,
25,
26,
27,
28,
35,
36,
37,
38,
39
] | 47.5 | false | 8.5 | 40 | 3 | 52.5 | 6 |
def stock_profit_sheet_by_yearly_em(symbol: str = "SH600519") -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,896 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_profit_sheet_by_quarterly_em
|
(
symbol: str = "SH600519",
)
|
return big_df
|
东方财富-股票-财务分析-利润表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按单季度
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-利润表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按单季度
:rtype: pandas.DataFrame
| 208 | 249 |
def stock_profit_sheet_by_quarterly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
"""
东方财富-股票-财务分析-利润表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 利润表-按单季度
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "2",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "2",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L208-L249
| 25 |
[
0
] | 2.380952 |
[
11,
12,
13,
18,
19,
20,
21,
22,
23,
24,
27,
28,
29,
30,
37,
38,
39,
40,
41
] | 45.238095 | false | 8.5 | 42 | 3 | 54.761905 | 6 |
def stock_profit_sheet_by_quarterly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "2",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/lrbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "2",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,897 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_cash_flow_sheet_by_report_em
|
(
symbol: str = "SH600519",
)
|
return big_df
|
东方财富-股票-财务分析-现金流量表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按报告期
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-现金流量表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按报告期
:rtype: pandas.DataFrame
| 252 | 293 |
def stock_cash_flow_sheet_by_report_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
"""
东方财富-股票-财务分析-现金流量表-按报告期
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按报告期
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L252-L293
| 25 |
[
0
] | 2.380952 |
[
11,
12,
13,
18,
19,
20,
21,
22,
23,
24,
27,
28,
29,
30,
37,
38,
39,
40,
41
] | 45.238095 | false | 8.5 | 42 | 3 | 54.761905 | 6 |
def stock_cash_flow_sheet_by_report_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,898 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_cash_flow_sheet_by_yearly_em
|
(
symbol: str = "SH600519",
)
|
return big_df
|
东方财富-股票-财务分析-现金流量表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按年度
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-现金流量表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按年度
:rtype: pandas.DataFrame
| 296 | 337 |
def stock_cash_flow_sheet_by_yearly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
"""
东方财富-股票-财务分析-现金流量表-按年度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按年度
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L296-L337
| 25 |
[
0
] | 2.380952 |
[
11,
12,
13,
18,
19,
20,
21,
22,
23,
24,
27,
28,
29,
30,
37,
38,
39,
40,
41
] | 45.238095 | false | 8.5 | 42 | 3 | 54.761905 | 6 |
def stock_cash_flow_sheet_by_yearly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "1",
"reportType": "1",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,899 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_three_report_em.py
|
stock_cash_flow_sheet_by_quarterly_em
|
(
symbol: str = "SH600519",
)
|
return big_df
|
东方财富-股票-财务分析-现金流量表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按单季度
:rtype: pandas.DataFrame
|
东方财富-股票-财务分析-现金流量表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按单季度
:rtype: pandas.DataFrame
| 340 | 381 |
def stock_cash_flow_sheet_by_quarterly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
"""
东方财富-股票-财务分析-现金流量表-按单季度
https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/Index?type=web&code=sh600519#lrb-0
:param symbol: 股票代码; 带市场标识
:type symbol: str
:return: 现金流量表-按单季度
:rtype: pandas.DataFrame
"""
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "2",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "2",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_three_report_em.py#L340-L381
| 25 |
[
0
] | 2.380952 |
[
11,
12,
13,
18,
19,
20,
21,
22,
23,
24,
27,
28,
29,
30,
37,
38,
39,
40,
41
] | 45.238095 | false | 8.5 | 42 | 3 | 54.761905 | 6 |
def stock_cash_flow_sheet_by_quarterly_em(
symbol: str = "SH600519",
) -> pd.DataFrame:
company_type = 4
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbDateAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "2",
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
temp_df["REPORT_DATE"] = pd.to_datetime(temp_df["REPORT_DATE"]).dt.date
temp_df["REPORT_DATE"] = temp_df["REPORT_DATE"].astype(str)
need_date = temp_df["REPORT_DATE"].tolist()
sep_list = [
",".join(need_date[i : i + 5]) for i in range(0, len(need_date), 5)
]
big_df = pd.DataFrame()
for item in tqdm(sep_list, leave=False):
url = "https://emweb.securities.eastmoney.com/PC_HSF10/NewFinanceAnalysis/xjllbAjaxNew"
params = {
"companyType": company_type,
"reportDateType": "0",
"reportType": "2",
"dates": item,
"code": symbol,
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
return big_df
| 17,900 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hsgt_exchange_rate.py
|
stock_sgt_settlement_exchange_rate_szse
|
()
|
return temp_df
|
深港通-港股通业务信息-结算汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 结算汇率
:rtype: pandas.DataFrame
|
深港通-港股通业务信息-结算汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 结算汇率
:rtype: pandas.DataFrame
| 16 | 39 |
def stock_sgt_settlement_exchange_rate_szse() -> pd.DataFrame:
"""
深港通-港股通业务信息-结算汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 结算汇率
:rtype: pandas.DataFrame
"""
url = "https://www.szse.cn/api/report/ShowReport"
params = {
'SHOWTYPE': 'xlsx',
'CATALOGID': 'SGT_LSHL',
'TABKEY': 'tab2',
'random': '0.9184251620553985',
}
r = requests.get(url, params=params)
import warnings
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
temp_df = pd.read_excel(r.content, engine="openpyxl")
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['买入结算汇兑比率'] = pd.to_numeric(temp_df['买入结算汇兑比率'], errors='coerce')
temp_df['卖出结算汇兑比率'] = pd.to_numeric(temp_df['卖出结算汇兑比率'], errors='coerce')
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hsgt_exchange_rate.py#L16-L39
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 29.166667 |
[
7,
8,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
] | 50 | false | 13.043478 | 24 | 2 | 50 | 4 |
def stock_sgt_settlement_exchange_rate_szse() -> pd.DataFrame:
url = "https://www.szse.cn/api/report/ShowReport"
params = {
'SHOWTYPE': 'xlsx',
'CATALOGID': 'SGT_LSHL',
'TABKEY': 'tab2',
'random': '0.9184251620553985',
}
r = requests.get(url, params=params)
import warnings
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
temp_df = pd.read_excel(r.content, engine="openpyxl")
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['买入结算汇兑比率'] = pd.to_numeric(temp_df['买入结算汇兑比率'], errors='coerce')
temp_df['卖出结算汇兑比率'] = pd.to_numeric(temp_df['卖出结算汇兑比率'], errors='coerce')
return temp_df
| 17,901 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hsgt_exchange_rate.py
|
stock_sgt_reference_exchange_rate_szse
|
()
|
return temp_df
|
深港通-港股通业务信息-参考汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 参考汇率
:rtype: pandas.DataFrame
|
深港通-港股通业务信息-参考汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 参考汇率
:rtype: pandas.DataFrame
| 42 | 65 |
def stock_sgt_reference_exchange_rate_szse() -> pd.DataFrame:
"""
深港通-港股通业务信息-参考汇率
https://www.szse.cn/szhk/hkbussiness/exchangerate/index.html
:return: 参考汇率
:rtype: pandas.DataFrame
"""
url = "https://www.szse.cn/api/report/ShowReport"
params = {
'SHOWTYPE': 'xlsx',
'CATALOGID': 'SGT_LSHL',
'TABKEY': 'tab1',
'random': '0.9184251620553985',
}
r = requests.get(url, params=params)
import warnings
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
temp_df = pd.read_excel(r.content, engine="openpyxl")
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['参考汇率买入价'] = pd.to_numeric(temp_df['参考汇率买入价'], errors='coerce')
temp_df['参考汇率卖出价'] = pd.to_numeric(temp_df['参考汇率卖出价'], errors='coerce')
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hsgt_exchange_rate.py#L42-L65
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 29.166667 |
[
7,
8,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
] | 50 | false | 13.043478 | 24 | 2 | 50 | 4 |
def stock_sgt_reference_exchange_rate_szse() -> pd.DataFrame:
url = "https://www.szse.cn/api/report/ShowReport"
params = {
'SHOWTYPE': 'xlsx',
'CATALOGID': 'SGT_LSHL',
'TABKEY': 'tab1',
'random': '0.9184251620553985',
}
r = requests.get(url, params=params)
import warnings
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
temp_df = pd.read_excel(r.content, engine="openpyxl")
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['参考汇率买入价'] = pd.to_numeric(temp_df['参考汇率买入价'], errors='coerce')
temp_df['参考汇率卖出价'] = pd.to_numeric(temp_df['参考汇率卖出价'], errors='coerce')
return temp_df
| 17,902 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hsgt_exchange_rate.py
|
stock_sgt_reference_exchange_rate_sse
|
()
|
return temp_df
|
沪港通-港股通信息披露-参考汇率
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 参考汇率
:rtype: pandas.DataFrame
|
沪港通-港股通信息披露-参考汇率
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 参考汇率
:rtype: pandas.DataFrame
| 68 | 114 |
def stock_sgt_reference_exchange_rate_sse() -> pd.DataFrame:
"""
沪港通-港股通信息披露-参考汇率
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 参考汇率
:rtype: pandas.DataFrame
"""
current_date = datetime.now().date().isoformat().replace("-", "")
url = "http://query.sse.com.cn/commonSoaQuery.do"
params = {
'isPagination': 'true',
'updateDate': '20120601',
'updateDateEnd': current_date,
'sqlId': 'FW_HGT_GGTHL',
'pageHelp.cacheSize': '1',
'pageHelp.pageSize': '10000',
'pageHelp.pageNo': '1',
'pageHelp.beginPage': '1',
'pageHelp.endPage': '1',
'_': '1664523262778',
}
headers = {
'Host': 'query.sse.com.cn',
'Referer': 'http://www.sse.com.cn/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result'])
temp_df.rename(columns={
'currencyType': "货币种类",
'buyPrice': "参考汇率买入价",
'updateDate': "-",
'validDate': "适用日期",
'sellPrice': "参考汇率卖出价"
}, inplace=True)
temp_df = temp_df[[
"适用日期",
"参考汇率买入价",
"参考汇率卖出价",
"货币种类",
]]
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['参考汇率买入价'] = pd.to_numeric(temp_df['参考汇率买入价'], errors='coerce')
temp_df['参考汇率卖出价'] = pd.to_numeric(temp_df['参考汇率卖出价'], errors='coerce')
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hsgt_exchange_rate.py#L68-L114
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.893617 |
[
7,
8,
9,
21,
26,
27,
28,
29,
36,
42,
43,
44,
45,
46
] | 29.787234 | false | 13.043478 | 47 | 1 | 70.212766 | 4 |
def stock_sgt_reference_exchange_rate_sse() -> pd.DataFrame:
current_date = datetime.now().date().isoformat().replace("-", "")
url = "http://query.sse.com.cn/commonSoaQuery.do"
params = {
'isPagination': 'true',
'updateDate': '20120601',
'updateDateEnd': current_date,
'sqlId': 'FW_HGT_GGTHL',
'pageHelp.cacheSize': '1',
'pageHelp.pageSize': '10000',
'pageHelp.pageNo': '1',
'pageHelp.beginPage': '1',
'pageHelp.endPage': '1',
'_': '1664523262778',
}
headers = {
'Host': 'query.sse.com.cn',
'Referer': 'http://www.sse.com.cn/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result'])
temp_df.rename(columns={
'currencyType': "货币种类",
'buyPrice': "参考汇率买入价",
'updateDate': "-",
'validDate': "适用日期",
'sellPrice': "参考汇率卖出价"
}, inplace=True)
temp_df = temp_df[[
"适用日期",
"参考汇率买入价",
"参考汇率卖出价",
"货币种类",
]]
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['参考汇率买入价'] = pd.to_numeric(temp_df['参考汇率买入价'], errors='coerce')
temp_df['参考汇率卖出价'] = pd.to_numeric(temp_df['参考汇率卖出价'], errors='coerce')
return temp_df
| 17,903 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hsgt_exchange_rate.py
|
stock_sgt_settlement_exchange_rate_sse
|
()
|
return temp_df
|
沪港通-港股通信息披露-结算汇兑
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 结算汇兑比率
:rtype: pandas.DataFrame
|
沪港通-港股通信息披露-结算汇兑
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 结算汇兑比率
:rtype: pandas.DataFrame
| 117 | 163 |
def stock_sgt_settlement_exchange_rate_sse() -> pd.DataFrame:
"""
沪港通-港股通信息披露-结算汇兑
http://www.sse.com.cn/services/hkexsc/disclo/ratios/
:return: 结算汇兑比率
:rtype: pandas.DataFrame
"""
current_date = datetime.now().date().isoformat().replace("-", "")
url = "http://query.sse.com.cn/commonSoaQuery.do"
params = {
'isPagination': 'true',
'updateDate': '20120601',
'updateDateEnd': current_date,
'sqlId': 'FW_HGT_JSHDBL',
'pageHelp.cacheSize': '1',
'pageHelp.pageSize': '10000',
'pageHelp.pageNo': '1',
'pageHelp.beginPage': '1',
'pageHelp.endPage': '1',
'_': '1664523262778',
}
headers = {
'Host': 'query.sse.com.cn',
'Referer': 'http://www.sse.com.cn/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result'])
temp_df.rename(columns={
'currencyType': "货币种类",
'buyPrice': "买入结算汇兑比率",
'updateDate': "-",
'validDate': "适用日期",
'sellPrice': "卖出结算汇兑比率"
}, inplace=True)
temp_df = temp_df[[
"适用日期",
"买入结算汇兑比率",
"卖出结算汇兑比率",
"货币种类",
]]
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['买入结算汇兑比率'] = pd.to_numeric(temp_df['买入结算汇兑比率'], errors='coerce')
temp_df['卖出结算汇兑比率'] = pd.to_numeric(temp_df['卖出结算汇兑比率'], errors='coerce')
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hsgt_exchange_rate.py#L117-L163
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.893617 |
[
7,
8,
9,
21,
26,
27,
28,
29,
36,
42,
43,
44,
45,
46
] | 29.787234 | false | 13.043478 | 47 | 1 | 70.212766 | 4 |
def stock_sgt_settlement_exchange_rate_sse() -> pd.DataFrame:
current_date = datetime.now().date().isoformat().replace("-", "")
url = "http://query.sse.com.cn/commonSoaQuery.do"
params = {
'isPagination': 'true',
'updateDate': '20120601',
'updateDateEnd': current_date,
'sqlId': 'FW_HGT_JSHDBL',
'pageHelp.cacheSize': '1',
'pageHelp.pageSize': '10000',
'pageHelp.pageNo': '1',
'pageHelp.beginPage': '1',
'pageHelp.endPage': '1',
'_': '1664523262778',
}
headers = {
'Host': 'query.sse.com.cn',
'Referer': 'http://www.sse.com.cn/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result'])
temp_df.rename(columns={
'currencyType': "货币种类",
'buyPrice': "买入结算汇兑比率",
'updateDate': "-",
'validDate': "适用日期",
'sellPrice': "卖出结算汇兑比率"
}, inplace=True)
temp_df = temp_df[[
"适用日期",
"买入结算汇兑比率",
"卖出结算汇兑比率",
"货币种类",
]]
temp_df.sort_values('适用日期', inplace=True, ignore_index=True)
temp_df['适用日期'] = pd.to_datetime(temp_df['适用日期']).dt.date
temp_df['买入结算汇兑比率'] = pd.to_numeric(temp_df['买入结算汇兑比率'], errors='coerce')
temp_df['卖出结算汇兑比率'] = pd.to_numeric(temp_df['卖出结算汇兑比率'], errors='coerce')
return temp_df
| 17,904 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
_get_file_content_ths
|
(file: str = "ths.js")
|
return file_data
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
| 17 | 28 |
def _get_file_content_ths(file: str = "ths.js") -> str:
"""
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
"""
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L17-L28
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 66.666667 |
[
8,
9,
10,
11
] | 33.333333 | false | 5.167959 | 12 | 2 | 66.666667 | 5 |
def _get_file_content_ths(file: str = "ths.js") -> str:
setting_file_path = get_ths_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 17,905 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_cxg_ths
|
(symbol: str = "创月新高") -> pd.D
|
return big_df
|
同花顺-数据中心-技术选股-创新高
http://data.10jqka.com.cn/rank/cxg/
:param symbol: choice of {"创月新高", "半年新高", "一年新高", "历史新高"}
:type symbol: str
:return: 创新高数据
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-创新高
http://data.10jqka.com.cn/rank/cxg/
:param symbol: choice of {"创月新高", "半年新高", "一年新高", "历史新高"}
:type symbol: str
:return: 创新高数据
:rtype: pandas.DataFrame
| 31 | 92 |
def stock_rank_cxg_ths(symbol: str = "创月新高") -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-创新高
http://data.10jqka.com.cn/rank/cxg/
:param symbol: choice of {"创月新高", "半年新高", "一年新高", "历史新高"}
:type symbol: str
:return: 创新高数据
:rtype: pandas.DataFrame
"""
symbol_map = {
"创月新高": "4",
"半年新高": "3",
"一年新高": "2",
"历史新高": "1",
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxg/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxg/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"换手率",
"最新价",
"前期高点",
"前期高点日期",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].str.strip("%")
big_df["换手率"] = big_df["换手率"].str.strip("%")
big_df["前期高点日期"] = pd.to_datetime(big_df["前期高点日期"]).dt.date
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["前期高点"] = pd.to_numeric(big_df["前期高点"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L31-L92
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.516129 |
[
9,
15,
16,
17,
18,
19,
23,
24,
25,
26,
27,
30,
31,
32,
33,
34,
35,
39,
40,
41,
42,
43,
53,
54,
55,
56,
57,
58,
59,
60,
61
] | 50 | false | 5.167959 | 62 | 3 | 50 | 6 |
def stock_rank_cxg_ths(symbol: str = "创月新高") -> pd.DataFrame:
symbol_map = {
"创月新高": "4",
"半年新高": "3",
"一年新高": "2",
"历史新高": "1",
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxg/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxg/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"换手率",
"最新价",
"前期高点",
"前期高点日期",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].str.strip("%")
big_df["换手率"] = big_df["换手率"].str.strip("%")
big_df["前期高点日期"] = pd.to_datetime(big_df["前期高点日期"]).dt.date
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["前期高点"] = pd.to_numeric(big_df["前期高点"])
return big_df
| 17,906 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_cxd_ths
|
(symbol: str = "创月新低") -> pd.D
|
return big_df
|
同花顺-数据中心-技术选股-创新低
http://data.10jqka.com.cn/rank/cxd/
:param symbol: choice of {"创月新低", "半年新低", "一年新低", "历史新低"}
:type symbol: str
:return: 创新低数据
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-创新低
http://data.10jqka.com.cn/rank/cxd/
:param symbol: choice of {"创月新低", "半年新低", "一年新低", "历史新低"}
:type symbol: str
:return: 创新低数据
:rtype: pandas.DataFrame
| 95 | 156 |
def stock_rank_cxd_ths(symbol: str = "创月新低") -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-创新低
http://data.10jqka.com.cn/rank/cxd/
:param symbol: choice of {"创月新低", "半年新低", "一年新低", "历史新低"}
:type symbol: str
:return: 创新低数据
:rtype: pandas.DataFrame
"""
symbol_map = {
"创月新低": "4",
"半年新低": "3",
"一年新低": "2",
"历史新低": "1",
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxd/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxd/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"换手率",
"最新价",
"前期低点",
"前期低点日期",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].str.strip("%")
big_df["换手率"] = big_df["换手率"].str.strip("%")
big_df["前期低点日期"] = pd.to_datetime(big_df["前期低点日期"]).dt.date
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["前期低点"] = pd.to_numeric(big_df["前期低点"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L95-L156
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.516129 |
[
9,
15,
16,
17,
18,
19,
23,
24,
25,
26,
27,
30,
31,
32,
33,
34,
35,
39,
40,
41,
42,
43,
53,
54,
55,
56,
57,
58,
59,
60,
61
] | 50 | false | 5.167959 | 62 | 3 | 50 | 6 |
def stock_rank_cxd_ths(symbol: str = "创月新低") -> pd.DataFrame:
symbol_map = {
"创月新低": "4",
"半年新低": "3",
"一年新低": "2",
"历史新低": "1",
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxd/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxd/board/{symbol_map[symbol]}/field/stockcode/order/asc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"换手率",
"最新价",
"前期低点",
"前期低点日期",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].str.strip("%")
big_df["换手率"] = big_df["换手率"].str.strip("%")
big_df["前期低点日期"] = pd.to_datetime(big_df["前期低点日期"]).dt.date
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["前期低点"] = pd.to_numeric(big_df["前期低点"])
return big_df
| 17,907 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_lxsz_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-连续上涨
http://data.10jqka.com.cn/rank/lxsz/
:return: 连续上涨
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-连续上涨
http://data.10jqka.com.cn/rank/lxsz/
:return: 连续上涨
:rtype: pandas.DataFrame
| 159 | 214 |
def stock_rank_lxsz_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-连续上涨
http://data.10jqka.com.cn/rank/lxsz/
:return: 连续上涨
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxsz/field/lxts/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxsz/field/lxts/order/desc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"最高价",
"最低价",
"连涨天数",
"连续涨跌幅",
"累计换手率",
"所属行业",
]
big_df["连续涨跌幅"] = big_df["连续涨跌幅"].str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].str.strip("%")
big_df["连续涨跌幅"] = pd.to_numeric(big_df["连续涨跌幅"])
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["连涨天数"] = pd.to_numeric(big_df["连涨天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L159-L214
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.5 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
47,
48,
49,
50,
51,
52,
53,
54,
55
] | 53.571429 | false | 5.167959 | 56 | 3 | 46.428571 | 4 |
def stock_rank_lxsz_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxsz/field/lxts/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxsz/field/lxts/order/desc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"最高价",
"最低价",
"连涨天数",
"连续涨跌幅",
"累计换手率",
"所属行业",
]
big_df["连续涨跌幅"] = big_df["连续涨跌幅"].str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].str.strip("%")
big_df["连续涨跌幅"] = pd.to_numeric(big_df["连续涨跌幅"])
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["连涨天数"] = pd.to_numeric(big_df["连涨天数"])
return big_df
| 17,908 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_lxxd_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-连续下跌
http://data.10jqka.com.cn/rank/lxxd/
:return: 连续下跌
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-连续下跌
http://data.10jqka.com.cn/rank/lxxd/
:return: 连续下跌
:rtype: pandas.DataFrame
| 217 | 272 |
def stock_rank_lxxd_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-连续下跌
http://data.10jqka.com.cn/rank/lxxd/
:return: 连续下跌
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxxd/field/lxts/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxxd/field/lxts/order/desc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"最高价",
"最低价",
"连涨天数",
"连续涨跌幅",
"累计换手率",
"所属行业",
]
big_df["连续涨跌幅"] = big_df["连续涨跌幅"].str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].str.strip("%")
big_df["连续涨跌幅"] = pd.to_numeric(big_df["连续涨跌幅"])
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["连涨天数"] = pd.to_numeric(big_df["连涨天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L217-L272
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.5 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
47,
48,
49,
50,
51,
52,
53,
54,
55
] | 53.571429 | false | 5.167959 | 56 | 3 | 46.428571 | 4 |
def stock_rank_lxxd_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxxd/field/lxts/order/desc/page/1/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/lxxd/field/lxts/order/desc/page/{page}/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"收盘价",
"最高价",
"最低价",
"连涨天数",
"连续涨跌幅",
"累计换手率",
"所属行业",
]
big_df["连续涨跌幅"] = big_df["连续涨跌幅"].str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].str.strip("%")
big_df["连续涨跌幅"] = pd.to_numeric(big_df["连续涨跌幅"])
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["收盘价"] = pd.to_numeric(big_df["收盘价"])
big_df["最高价"] = pd.to_numeric(big_df["最高价"])
big_df["最低价"] = pd.to_numeric(big_df["最低价"])
big_df["连涨天数"] = pd.to_numeric(big_df["连涨天数"])
return big_df
| 17,909 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_cxfl_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-持续放量
http://data.10jqka.com.cn/rank/cxfl/
:return: 持续放量
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-持续放量
http://data.10jqka.com.cn/rank/cxfl/
:return: 持续放量
:rtype: pandas.DataFrame
| 275 | 329 |
def stock_rank_cxfl_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-持续放量
http://data.10jqka.com.cn/rank/cxfl/
:return: 持续放量
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxfl/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxfl/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"最新价",
"成交量",
"基准日成交量",
"放量天数",
"阶段涨跌幅",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["阶段涨跌幅"] = big_df["阶段涨跌幅"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["阶段涨跌幅"] = pd.to_numeric(big_df["阶段涨跌幅"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["放量天数"] = pd.to_numeric(big_df["放量天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L275-L329
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
47,
48,
49,
50,
51,
52,
53,
54
] | 52.727273 | false | 5.167959 | 55 | 3 | 47.272727 | 4 |
def stock_rank_cxfl_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxfl/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxfl/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"最新价",
"成交量",
"基准日成交量",
"放量天数",
"阶段涨跌幅",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["阶段涨跌幅"] = big_df["阶段涨跌幅"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["阶段涨跌幅"] = pd.to_numeric(big_df["阶段涨跌幅"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["放量天数"] = pd.to_numeric(big_df["放量天数"])
return big_df
| 17,910 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_cxsl_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-持续缩量
http://data.10jqka.com.cn/rank/cxsl/
:return: 持续缩量
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-持续缩量
http://data.10jqka.com.cn/rank/cxsl/
:return: 持续缩量
:rtype: pandas.DataFrame
| 332 | 386 |
def stock_rank_cxsl_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-持续缩量
http://data.10jqka.com.cn/rank/cxsl/
:return: 持续缩量
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxsl/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxsl/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"最新价",
"成交量",
"基准日成交量",
"缩量天数",
"阶段涨跌幅",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["阶段涨跌幅"] = big_df["阶段涨跌幅"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["阶段涨跌幅"] = pd.to_numeric(big_df["阶段涨跌幅"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["缩量天数"] = pd.to_numeric(big_df["缩量天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L332-L386
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
47,
48,
49,
50,
51,
52,
53,
54
] | 52.727273 | false | 5.167959 | 55 | 3 | 47.272727 | 4 |
def stock_rank_cxsl_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxsl/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/cxsl/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"涨跌幅",
"最新价",
"成交量",
"基准日成交量",
"缩量天数",
"阶段涨跌幅",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["阶段涨跌幅"] = big_df["阶段涨跌幅"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["阶段涨跌幅"] = pd.to_numeric(big_df["阶段涨跌幅"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["缩量天数"] = pd.to_numeric(big_df["缩量天数"])
return big_df
| 17,911 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_xstp_ths
|
(symbol: str = "500日均线") -> pd
|
return big_df
|
同花顺-数据中心-技术选股-向上突破
http://data.10jqka.com.cn/rank/xstp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向上突破
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-向上突破
http://data.10jqka.com.cn/rank/xstp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向上突破
:rtype: pandas.DataFrame
| 389 | 452 |
def stock_rank_xstp_ths(symbol: str = "500日均线") -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-向上突破
http://data.10jqka.com.cn/rank/xstp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向上突破
:rtype: pandas.DataFrame
"""
symbol_map = {
"5日均线": 5,
"10日均线": 10,
"20日均线": 20,
"30日均线": 30,
"60日均线": 60,
"90日均线": 90,
"250日均线": 250,
"500日均线": 500,
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xstp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xstp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"成交额",
"成交量",
"涨跌幅",
"换手率",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["换手率"] = big_df["换手率"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L389-L452
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.0625 |
[
9,
19,
20,
21,
22,
23,
27,
28,
29,
30,
31,
34,
35,
36,
37,
38,
39,
43,
44,
45,
46,
47,
57,
58,
59,
60,
61,
62,
63
] | 45.3125 | false | 5.167959 | 64 | 3 | 54.6875 | 6 |
def stock_rank_xstp_ths(symbol: str = "500日均线") -> pd.DataFrame:
symbol_map = {
"5日均线": 5,
"10日均线": 10,
"20日均线": 20,
"30日均线": 30,
"60日均线": 60,
"90日均线": 90,
"250日均线": 250,
"500日均线": 500,
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xstp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xstp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"成交额",
"成交量",
"涨跌幅",
"换手率",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["换手率"] = big_df["换手率"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
return big_df
| 17,912 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_xxtp_ths
|
(symbol: str = "500日均线") -> pd
|
return big_df
|
同花顺-数据中心-技术选股-向下突破
http://data.10jqka.com.cn/rank/xxtp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向下突破
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-向下突破
http://data.10jqka.com.cn/rank/xxtp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向下突破
:rtype: pandas.DataFrame
| 455 | 518 |
def stock_rank_xxtp_ths(symbol: str = "500日均线") -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-向下突破
http://data.10jqka.com.cn/rank/xxtp/
:param symbol: choice of {"5日均线", "10日均线", "20日均线", "30日均线", "60日均线", "90日均线", "250日均线", "500日均线"}
:type symbol: str
:return: 向下突破
:rtype: pandas.DataFrame
"""
symbol_map = {
"5日均线": 5,
"10日均线": 10,
"20日均线": 20,
"30日均线": 30,
"60日均线": 60,
"90日均线": 90,
"250日均线": 250,
"500日均线": 500,
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xxtp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xxtp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"成交额",
"成交量",
"涨跌幅",
"换手率",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["换手率"] = big_df["换手率"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L455-L518
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.0625 |
[
9,
19,
20,
21,
22,
23,
27,
28,
29,
30,
31,
34,
35,
36,
37,
38,
39,
43,
44,
45,
46,
47,
57,
58,
59,
60,
61,
62,
63
] | 45.3125 | false | 5.167959 | 64 | 3 | 54.6875 | 6 |
def stock_rank_xxtp_ths(symbol: str = "500日均线") -> pd.DataFrame:
symbol_map = {
"5日均线": 5,
"10日均线": 10,
"20日均线": 20,
"30日均线": 30,
"60日均线": 60,
"90日均线": 90,
"250日均线": 250,
"500日均线": 500,
}
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xxtp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/xxtp/board/{symbol_map[symbol]}/order/asc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"成交额",
"成交量",
"涨跌幅",
"换手率",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.strip("%")
big_df["换手率"] = big_df["换手率"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"])
big_df["换手率"] = pd.to_numeric(big_df["换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
return big_df
| 17,913 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_ljqs_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-量价齐升
http://data.10jqka.com.cn/rank/ljqs/
:return: 量价齐升
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-量价齐升
http://data.10jqka.com.cn/rank/ljqs/
:return: 量价齐升
:rtype: pandas.DataFrame
| 521 | 573 |
def stock_rank_ljqs_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-量价齐升
http://data.10jqka.com.cn/rank/ljqs/
:return: 量价齐升
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqs/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqs/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"量价齐升天数",
"阶段涨幅",
"累计换手率",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["阶段涨幅"] = big_df["阶段涨幅"].astype(str).str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].astype(str).str.strip("%")
big_df["阶段涨幅"] = pd.to_numeric(big_df["阶段涨幅"], errors="coerce")
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["量价齐升天数"] = pd.to_numeric(big_df["量价齐升天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L521-L573
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 13.207547 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
45,
46,
47,
48,
49,
50,
51,
52
] | 54.716981 | false | 5.167959 | 53 | 3 | 45.283019 | 4 |
def stock_rank_ljqs_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqs/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqs/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"量价齐升天数",
"阶段涨幅",
"累计换手率",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["阶段涨幅"] = big_df["阶段涨幅"].astype(str).str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].astype(str).str.strip("%")
big_df["阶段涨幅"] = pd.to_numeric(big_df["阶段涨幅"], errors="coerce")
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["量价齐升天数"] = pd.to_numeric(big_df["量价齐升天数"])
return big_df
| 17,914 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_ljqd_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-量价齐跌
http://data.10jqka.com.cn/rank/ljqd/
:return: 量价齐跌
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-量价齐跌
http://data.10jqka.com.cn/rank/ljqd/
:return: 量价齐跌
:rtype: pandas.DataFrame
| 576 | 628 |
def stock_rank_ljqd_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-量价齐跌
http://data.10jqka.com.cn/rank/ljqd/
:return: 量价齐跌
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqd/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqd/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"量价齐跌天数",
"阶段涨幅",
"累计换手率",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["阶段涨幅"] = big_df["阶段涨幅"].astype(str).str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].astype(str).str.strip("%")
big_df["阶段涨幅"] = pd.to_numeric(big_df["阶段涨幅"], errors="coerce")
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["量价齐跌天数"] = pd.to_numeric(big_df["量价齐跌天数"])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L576-L628
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 13.207547 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
45,
46,
47,
48,
49,
50,
51,
52
] | 54.716981 | false | 5.167959 | 53 | 3 | 45.283019 | 4 |
def stock_rank_ljqd_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqd/field/count/order/desc/ajax/1/free/1/page/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/rank/ljqd/field/count/order/desc/ajax/1/free/1/page/{page}/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"股票代码",
"股票简称",
"最新价",
"量价齐跌天数",
"阶段涨幅",
"累计换手率",
"所属行业",
]
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["阶段涨幅"] = big_df["阶段涨幅"].astype(str).str.strip("%")
big_df["累计换手率"] = big_df["累计换手率"].astype(str).str.strip("%")
big_df["阶段涨幅"] = pd.to_numeric(big_df["阶段涨幅"], errors="coerce")
big_df["累计换手率"] = pd.to_numeric(big_df["累计换手率"])
big_df["最新价"] = pd.to_numeric(big_df["最新价"])
big_df["量价齐跌天数"] = pd.to_numeric(big_df["量价齐跌天数"])
return big_df
| 17,915 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_technology_ths.py
|
stock_rank_xzjp_ths
|
()
|
return big_df
|
同花顺-数据中心-技术选股-险资举牌
http://data.10jqka.com.cn/financial/xzjp/
:return: 险资举牌
:rtype: pandas.DataFrame
|
同花顺-数据中心-技术选股-险资举牌
http://data.10jqka.com.cn/financial/xzjp/
:return: 险资举牌
:rtype: pandas.DataFrame
| 631 | 692 |
def stock_rank_xzjp_ths() -> pd.DataFrame:
"""
同花顺-数据中心-技术选股-险资举牌
http://data.10jqka.com.cn/financial/xzjp/
:return: 险资举牌
:rtype: pandas.DataFrame
"""
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/ajax/xzjp/field/DECLAREDATE/order/desc/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/ajax/xzjp/field/DECLAREDATE/order/desc/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"举牌公告日",
"股票代码",
"股票简称",
"现价",
"涨跌幅",
"举牌方",
"增持数量",
"交易均价",
"增持数量占总股本比例",
"变动后持股总数",
"变动后持股比例",
"历史数据",
]
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.zfill(6)
big_df["增持数量占总股本比例"] = big_df["增持数量占总股本比例"].astype(str).str.strip("%")
big_df["变动后持股比例"] = big_df["变动后持股比例"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
big_df["增持数量占总股本比例"] = pd.to_numeric(big_df["增持数量占总股本比例"])
big_df["变动后持股比例"] = pd.to_numeric(big_df["变动后持股比例"])
big_df["举牌公告日"] = pd.to_datetime(big_df["举牌公告日"]).dt.date
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["现价"] = pd.to_numeric(big_df["现价"])
big_df["交易均价"] = pd.to_numeric(big_df["交易均价"])
del big_df["历史数据"]
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_technology_ths.py#L631-L692
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.290323 |
[
7,
8,
9,
10,
11,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26,
27,
31,
32,
33,
34,
35,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61
] | 53.225806 | false | 5.167959 | 62 | 3 | 46.774194 | 4 |
def stock_rank_xzjp_ths() -> pd.DataFrame:
js_code = py_mini_racer.MiniRacer()
js_content = _get_file_content_ths("ths.js")
js_code.eval(js_content)
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/ajax/xzjp/field/DECLAREDATE/order/desc/ajax/1/free/1/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
try:
total_page = soup.find(
"span", attrs={"class": "page_info"}
).text.split("/")[1]
except AttributeError as e:
total_page = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
v_code = js_code.call("v")
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",
"Cookie": f"v={v_code}",
}
url = f"http://data.10jqka.com.cn/ajax/xzjp/field/DECLAREDATE/order/desc/ajax/1/free/1/"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text, converters={"股票代码": str})[0]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"序号",
"举牌公告日",
"股票代码",
"股票简称",
"现价",
"涨跌幅",
"举牌方",
"增持数量",
"交易均价",
"增持数量占总股本比例",
"变动后持股总数",
"变动后持股比例",
"历史数据",
]
big_df["涨跌幅"] = big_df["涨跌幅"].astype(str).str.zfill(6)
big_df["增持数量占总股本比例"] = big_df["增持数量占总股本比例"].astype(str).str.strip("%")
big_df["变动后持股比例"] = big_df["变动后持股比例"].astype(str).str.strip("%")
big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
big_df["增持数量占总股本比例"] = pd.to_numeric(big_df["增持数量占总股本比例"])
big_df["变动后持股比例"] = pd.to_numeric(big_df["变动后持股比例"])
big_df["举牌公告日"] = pd.to_datetime(big_df["举牌公告日"]).dt.date
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df["现价"] = pd.to_numeric(big_df["现价"])
big_df["交易均价"] = pd.to_numeric(big_df["交易均价"])
del big_df["历史数据"]
return big_df
| 17,916 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_account_em.py
|
stock_account_statistics_em
|
()
|
return temp_df
|
东方财富网-数据中心-特色数据-股票账户统计
http://data.eastmoney.com/cjsj/gpkhsj.html
:return: 股票账户统计数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-股票账户统计
http://data.eastmoney.com/cjsj/gpkhsj.html
:return: 股票账户统计数据
:rtype: pandas.DataFrame
| 13 | 75 |
def stock_account_statistics_em() -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-股票账户统计
http://data.eastmoney.com/cjsj/gpkhsj.html
:return: 股票账户统计数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
'reportName': 'RPT_STOCK_OPEN_DATA',
'columns': 'ALL',
'pageSize': '500',
'sortColumns': 'STATISTICS_DATE',
'sortTypes': '-1',
'source': 'WEB',
'client': 'WEB',
'p': '1',
'pageNo': '1',
'pageNum': '1',
'pageNumber': '1',
'_': '1640749656405',
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result']['data'])
temp_df.columns = [
"数据日期",
"新增投资者-数量",
"新增投资者-环比",
"新增投资者-同比",
"期末投资者-总量",
"期末投资者-A股账户",
"期末投资者-B股账户",
"上证指数-收盘",
"上证指数-涨跌幅",
"沪深总市值",
"沪深户均市值",
"-"
]
temp_df = temp_df[[
"数据日期",
"新增投资者-数量",
"新增投资者-环比",
"新增投资者-同比",
"期末投资者-总量",
"期末投资者-A股账户",
"期末投资者-B股账户",
"沪深总市值",
"沪深户均市值",
"上证指数-收盘",
"上证指数-涨跌幅",
]]
temp_df['新增投资者-数量'] = pd.to_numeric(temp_df['新增投资者-数量'])
temp_df['新增投资者-环比'] = pd.to_numeric(temp_df['新增投资者-环比'])
temp_df['新增投资者-同比'] = pd.to_numeric(temp_df['新增投资者-同比'])
temp_df['期末投资者-总量'] = pd.to_numeric(temp_df['期末投资者-总量'])
temp_df['期末投资者-A股账户'] = pd.to_numeric(temp_df['期末投资者-A股账户'])
temp_df['期末投资者-B股账户'] = pd.to_numeric(temp_df['期末投资者-B股账户'])
temp_df['沪深总市值'] = pd.to_numeric(temp_df['沪深总市值'])
temp_df['沪深户均市值'] = pd.to_numeric(temp_df['沪深户均市值'])
temp_df['上证指数-收盘'] = pd.to_numeric(temp_df['上证指数-收盘'])
temp_df['上证指数-涨跌幅'] = pd.to_numeric(temp_df['上证指数-涨跌幅'])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_account_em.py#L13-L75
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.111111 |
[
7,
8,
22,
23,
24,
25,
39,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62
] | 28.571429 | false | 20 | 63 | 1 | 71.428571 | 4 |
def stock_account_statistics_em() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
'reportName': 'RPT_STOCK_OPEN_DATA',
'columns': 'ALL',
'pageSize': '500',
'sortColumns': 'STATISTICS_DATE',
'sortTypes': '-1',
'source': 'WEB',
'client': 'WEB',
'p': '1',
'pageNo': '1',
'pageNum': '1',
'pageNumber': '1',
'_': '1640749656405',
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json['result']['data'])
temp_df.columns = [
"数据日期",
"新增投资者-数量",
"新增投资者-环比",
"新增投资者-同比",
"期末投资者-总量",
"期末投资者-A股账户",
"期末投资者-B股账户",
"上证指数-收盘",
"上证指数-涨跌幅",
"沪深总市值",
"沪深户均市值",
"-"
]
temp_df = temp_df[[
"数据日期",
"新增投资者-数量",
"新增投资者-环比",
"新增投资者-同比",
"期末投资者-总量",
"期末投资者-A股账户",
"期末投资者-B股账户",
"沪深总市值",
"沪深户均市值",
"上证指数-收盘",
"上证指数-涨跌幅",
]]
temp_df['新增投资者-数量'] = pd.to_numeric(temp_df['新增投资者-数量'])
temp_df['新增投资者-环比'] = pd.to_numeric(temp_df['新增投资者-环比'])
temp_df['新增投资者-同比'] = pd.to_numeric(temp_df['新增投资者-同比'])
temp_df['期末投资者-总量'] = pd.to_numeric(temp_df['期末投资者-总量'])
temp_df['期末投资者-A股账户'] = pd.to_numeric(temp_df['期末投资者-A股账户'])
temp_df['期末投资者-B股账户'] = pd.to_numeric(temp_df['期末投资者-B股账户'])
temp_df['沪深总市值'] = pd.to_numeric(temp_df['沪深总市值'])
temp_df['沪深户均市值'] = pd.to_numeric(temp_df['沪深户均市值'])
temp_df['上证指数-收盘'] = pd.to_numeric(temp_df['上证指数-收盘'])
temp_df['上证指数-涨跌幅'] = pd.to_numeric(temp_df['上证指数-涨跌幅'])
return temp_df
| 17,917 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_em
|
()
|
return big_df
|
东方财富网-数据中心-特色数据-千股千评
http://data.eastmoney.com/stockcomment/
:return: 千股千评数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评
http://data.eastmoney.com/stockcomment/
:return: 千股千评数据
:rtype: pandas.DataFrame
| 15 | 110 |
def stock_comment_em() -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评
http://data.eastmoney.com/stockcomment/
:return: 千股千评数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "SECURITY_CODE",
"sortTypes": "1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_DMSK_TS_STOCKNEW",
"quoteColumns": "f2~01~SECURITY_CODE~CLOSE_PRICE,f8~01~SECURITY_CODE~TURNOVERRATE,f3~01~SECURITY_CODE~CHANGE_RATE,f9~01~SECURITY_CODE~PE_DYNAMIC",
"columns": "ALL",
"filter": "",
"token": "894050c76af8597a853f5b408b759f5d",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"代码",
"-",
"交易日",
"名称",
"-",
"-",
"-",
"最新价",
"涨跌幅",
"-",
"换手率",
"主力成本",
"市盈率",
"-",
"-",
"机构参与度",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"综合得分",
"上升",
"目前排名",
"关注指数",
"-",
]
big_df = big_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"换手率",
"市盈率",
"主力成本",
"机构参与度",
"综合得分",
"上升",
"目前排名",
"关注指数",
"交易日",
]
]
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")
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_datetime(big_df["交易日"]).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L15-L110
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 7.291667 |
[
7,
8,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
30,
31,
32,
65,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95
] | 29.166667 | false | 9.923664 | 96 | 2 | 70.833333 | 4 |
def stock_comment_em() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"sortColumns": "SECURITY_CODE",
"sortTypes": "1",
"pageSize": "500",
"pageNumber": "1",
"reportName": "RPT_DMSK_TS_STOCKNEW",
"quoteColumns": "f2~01~SECURITY_CODE~CLOSE_PRICE,f8~01~SECURITY_CODE~TURNOVERRATE,f3~01~SECURITY_CODE~CHANGE_RATE,f9~01~SECURITY_CODE~PE_DYNAMIC",
"columns": "ALL",
"filter": "",
"token": "894050c76af8597a853f5b408b759f5d",
}
r = requests.get(url, params=params)
data_json = r.json()
total_page = data_json["result"]["pages"]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"pageNumber": page})
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"-",
"代码",
"-",
"交易日",
"名称",
"-",
"-",
"-",
"最新价",
"涨跌幅",
"-",
"换手率",
"主力成本",
"市盈率",
"-",
"-",
"机构参与度",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"综合得分",
"上升",
"目前排名",
"关注指数",
"-",
]
big_df = big_df[
[
"序号",
"代码",
"名称",
"最新价",
"涨跌幅",
"换手率",
"市盈率",
"主力成本",
"机构参与度",
"综合得分",
"上升",
"目前排名",
"关注指数",
"交易日",
]
]
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")
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_datetime(big_df["交易日"]).dt.date
return big_df
| 17,918 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_zlkp_jgcyd_em
|
(symbol: str = "600000")
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-主力控盘-机构参与度
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 主力控盘-机构参与度
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-主力控盘-机构参与度
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 主力控盘-机构参与度
:rtype: pandas.DataFrame
| 113 | 142 |
def stock_comment_detail_zlkp_jgcyd_em(symbol: str = "600000") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-主力控盘-机构参与度
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 主力控盘-机构参与度
:rtype: pandas.DataFrame
"""
url = f"https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_DMSK_TS_STOCKEVALUATE",
"filter": f'(SECURITY_CODE="{symbol}")',
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"sortColumns": "TRADE_DATE",
"sortTypes": "-1",
"_": "1655387358195",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df = temp_df[["TRADE_DATE", "ORG_PARTICIPATE"]]
temp_df.columns = ["date", "value"]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.sort_values(["date"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["value"] = pd.to_numeric(temp_df["value"]) * 100
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L113-L142
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 30 |
[
9,
10,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
] | 40 | false | 9.923664 | 30 | 1 | 60 | 6 |
def stock_comment_detail_zlkp_jgcyd_em(symbol: str = "600000") -> pd.DataFrame:
url = f"https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_DMSK_TS_STOCKEVALUATE",
"filter": f'(SECURITY_CODE="{symbol}")',
"columns": "ALL",
"source": "WEB",
"client": "WEB",
"sortColumns": "TRADE_DATE",
"sortTypes": "-1",
"_": "1655387358195",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df = temp_df[["TRADE_DATE", "ORG_PARTICIPATE"]]
temp_df.columns = ["date", "value"]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.sort_values(["date"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["value"] = pd.to_numeric(temp_df["value"]) * 100
return temp_df
| 17,919 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_zhpj_lspf_em
|
(symbol: str = "600000")
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-综合评价-历史评分
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 综合评价-历史评分
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-综合评价-历史评分
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 综合评价-历史评分
:rtype: pandas.DataFrame
| 145 | 171 |
def stock_comment_detail_zhpj_lspf_em(symbol: str = "600000") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-综合评价-历史评分
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 综合评价-历史评分
:rtype: pandas.DataFrame
"""
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["zhpj"]["HistoryScore"]["XData"],
data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Score"],
data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Price"],
]
).T
temp_df.columns = ["日期", "评分", "股价"]
temp_df["日期"] = str(datetime.now().year) + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["评分"] = pd.to_numeric(temp_df["评分"])
temp_df["股价"] = pd.to_numeric(temp_df["股价"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L145-L171
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 33.333333 |
[
9,
10,
11,
12,
19,
20,
21,
22,
23,
24,
25,
26
] | 44.444444 | false | 9.923664 | 27 | 1 | 55.555556 | 6 |
def stock_comment_detail_zhpj_lspf_em(symbol: str = "600000") -> pd.DataFrame:
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["zhpj"]["HistoryScore"]["XData"],
data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Score"],
data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Price"],
]
).T
temp_df.columns = ["日期", "评分", "股价"]
temp_df["日期"] = str(datetime.now().year) + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["评分"] = pd.to_numeric(temp_df["评分"])
temp_df["股价"] = pd.to_numeric(temp_df["股价"])
return temp_df
| 17,920 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_scrd_focus_em
|
(symbol: str = "600000")
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-市场热度-用户关注指数
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-用户关注指数
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-市场热度-用户关注指数
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-用户关注指数
:rtype: pandas.DataFrame
| 174 | 200 |
def stock_comment_detail_scrd_focus_em(symbol: str = "600000") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-市场热度-用户关注指数
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-用户关注指数
:rtype: pandas.DataFrame
"""
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["focus"][1]["XData"],
data_json["ApiResults"]["scrd"]["focus"][1]["Ydata"]["StockFocus"],
data_json["ApiResults"]["scrd"]["focus"][1]["Ydata"]["ClosePrice"],
]
).T
temp_df.columns = ["日期", "用户关注指数", "收盘价"]
temp_df["日期"] = str(datetime.now().year) + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["用户关注指数"] = pd.to_numeric(temp_df["用户关注指数"])
temp_df["收盘价"] = pd.to_numeric(temp_df["收盘价"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L174-L200
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 33.333333 |
[
9,
10,
11,
12,
19,
20,
21,
22,
23,
24,
25,
26
] | 44.444444 | false | 9.923664 | 27 | 1 | 55.555556 | 6 |
def stock_comment_detail_scrd_focus_em(symbol: str = "600000") -> pd.DataFrame:
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["focus"][1]["XData"],
data_json["ApiResults"]["scrd"]["focus"][1]["Ydata"]["StockFocus"],
data_json["ApiResults"]["scrd"]["focus"][1]["Ydata"]["ClosePrice"],
]
).T
temp_df.columns = ["日期", "用户关注指数", "收盘价"]
temp_df["日期"] = str(datetime.now().year) + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["用户关注指数"] = pd.to_numeric(temp_df["用户关注指数"])
temp_df["收盘价"] = pd.to_numeric(temp_df["收盘价"])
return temp_df
| 17,921 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_scrd_desire_em
|
(
symbol: str = "600000",
)
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-市场热度-市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场参与意愿
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-市场热度-市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场参与意愿
:rtype: pandas.DataFrame
| 203 | 247 |
def stock_comment_detail_scrd_desire_em(
symbol: str = "600000",
) -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-市场热度-市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场参与意愿
:rtype: pandas.DataFrame
"""
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["desire"][0][0]["UpdateTime"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["desire"][1]["XData"],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"MajorPeopleNumChg"
],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"PeopleNumChange"
],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"RetailPeopleNumChg"
],
]
).T
temp_df.columns = ["日期时间", "大户", "全部", "散户"]
temp_df["日期时间"] = date_str + " " + temp_df["日期时间"]
temp_df["日期时间"] = pd.to_datetime(temp_df["日期时间"])
temp_df.sort_values(["日期时间"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["大户"] = pd.to_numeric(temp_df["大户"])
temp_df["全部"] = pd.to_numeric(temp_df["全部"])
temp_df["散户"] = pd.to_numeric(temp_df["散户"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L203-L247
| 25 |
[
0
] | 2.222222 |
[
11,
12,
13,
14,
20,
34,
35,
36,
38,
39,
40,
41,
42,
44
] | 31.111111 | false | 9.923664 | 45 | 1 | 68.888889 | 6 |
def stock_comment_detail_scrd_desire_em(
symbol: str = "600000",
) -> pd.DataFrame:
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["desire"][0][0]["UpdateTime"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["desire"][1]["XData"],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"MajorPeopleNumChg"
],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"PeopleNumChange"
],
data_json["ApiResults"]["scrd"]["desire"][1]["Ydata"][
"RetailPeopleNumChg"
],
]
).T
temp_df.columns = ["日期时间", "大户", "全部", "散户"]
temp_df["日期时间"] = date_str + " " + temp_df["日期时间"]
temp_df["日期时间"] = pd.to_datetime(temp_df["日期时间"])
temp_df.sort_values(["日期时间"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["大户"] = pd.to_numeric(temp_df["大户"])
temp_df["全部"] = pd.to_numeric(temp_df["全部"])
temp_df["散户"] = pd.to_numeric(temp_df["散户"])
return temp_df
| 17,922 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_scrd_desire_daily_em
|
(
symbol: str = "600000",
)
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-市场热度-日度市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-日度市场参与意愿
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-市场热度-日度市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-日度市场参与意愿
:rtype: pandas.DataFrame
| 250 | 290 |
def stock_comment_detail_scrd_desire_daily_em(
symbol: str = "600000",
) -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-市场热度-日度市场参与意愿
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-日度市场参与意愿
:rtype: pandas.DataFrame
"""
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["desire"][0][0]["UpdateTime"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["desire"][2]["XData"],
data_json["ApiResults"]["scrd"]["desire"][2]["Ydata"][
"PeopleNumChg"
],
data_json["ApiResults"]["scrd"]["desire"][2]["Ydata"][
"TotalPeopleNumChange"
],
]
).T
temp_df.columns = ["日期", "当日意愿下降", "五日累计意愿"]
temp_df["日期"] = date_str[:4] + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["当日意愿下降"] = pd.to_numeric(temp_df["当日意愿下降"])
temp_df["五日累计意愿"] = pd.to_numeric(temp_df["五日累计意愿"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L250-L290
| 25 |
[
0
] | 2.439024 |
[
11,
12,
13,
14,
20,
31,
32,
33,
35,
36,
37,
38,
40
] | 31.707317 | false | 9.923664 | 41 | 1 | 68.292683 | 6 |
def stock_comment_detail_scrd_desire_daily_em(
symbol: str = "600000",
) -> pd.DataFrame:
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["desire"][0][0]["UpdateTime"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["desire"][2]["XData"],
data_json["ApiResults"]["scrd"]["desire"][2]["Ydata"][
"PeopleNumChg"
],
data_json["ApiResults"]["scrd"]["desire"][2]["Ydata"][
"TotalPeopleNumChange"
],
]
).T
temp_df.columns = ["日期", "当日意愿下降", "五日累计意愿"]
temp_df["日期"] = date_str[:4] + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["当日意愿下降"] = pd.to_numeric(temp_df["当日意愿下降"])
temp_df["五日累计意愿"] = pd.to_numeric(temp_df["五日累计意愿"])
return temp_df
| 17,923 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_comment_em.py
|
stock_comment_detail_scrd_cost_em
|
(symbol: str = "600000")
|
return temp_df
|
东方财富网-数据中心-特色数据-千股千评-市场热度-市场成本
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场成本
:rtype: pandas.DataFrame
|
东方财富网-数据中心-特色数据-千股千评-市场热度-市场成本
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场成本
:rtype: pandas.DataFrame
| 293 | 329 |
def stock_comment_detail_scrd_cost_em(symbol: str = "600000") -> pd.DataFrame:
"""
东方财富网-数据中心-特色数据-千股千评-市场热度-市场成本
https://data.eastmoney.com/stockcomment/stock/600000.html
:param symbol: 股票代码
:type symbol: str
:return: 市场热度-市场成本
:rtype: pandas.DataFrame
"""
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["cost"][0][0]["UpdateDate"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["cost"][1]["XData"],
data_json["ApiResults"]["scrd"]["cost"][1]["Ydata"]["AvgBuyPrice"],
data_json["ApiResults"]["scrd"]["cost"][1]["Ydata"][
"FiveDayAvgBuyPrice"
],
]
).T
temp_df.columns = ["日期", "市场成本", "5日市场成本"]
temp_df["日期"] = date_str[:4] + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["市场成本"] = pd.to_numeric(temp_df["市场成本"])
temp_df["5日市场成本"] = pd.to_numeric(temp_df["5日市场成本"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_comment_em.py#L293-L329
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 24.324324 |
[
9,
10,
11,
12,
18,
27,
28,
29,
31,
32,
33,
34,
36
] | 35.135135 | false | 9.923664 | 37 | 1 | 64.864865 | 6 |
def stock_comment_detail_scrd_cost_em(symbol: str = "600000") -> pd.DataFrame:
url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
r = requests.get(url)
data_json = r.json()
date_str = (
data_json["ApiResults"]["scrd"]["cost"][0][0]["UpdateDate"]
.split(" ")[0]
.replace("/", "-")
)
temp_df = pd.DataFrame(
[
data_json["ApiResults"]["scrd"]["cost"][1]["XData"],
data_json["ApiResults"]["scrd"]["cost"][1]["Ydata"]["AvgBuyPrice"],
data_json["ApiResults"]["scrd"]["cost"][1]["Ydata"][
"FiveDayAvgBuyPrice"
],
]
).T
temp_df.columns = ["日期", "市场成本", "5日市场成本"]
temp_df["日期"] = date_str[:4] + "-" + temp_df["日期"]
temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date
temp_df.sort_values(["日期"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["市场成本"] = pd.to_numeric(temp_df["市场成本"])
temp_df["5日市场成本"] = pd.to_numeric(temp_df["5日市场成本"])
return temp_df
| 17,924 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_hot_tgb.py
|
stock_hot_tgb
|
()
|
return temp_df
|
淘股吧-热门股票
https://www.taoguba.com.cn/stock/moreHotStock
:return: 热门股票
:rtype: pandas.DataFrame
|
淘股吧-热门股票
https://www.taoguba.com.cn/stock/moreHotStock
:return: 热门股票
:rtype: pandas.DataFrame
| 12 | 27 |
def stock_hot_tgb() -> pd.DataFrame:
"""
淘股吧-热门股票
https://www.taoguba.com.cn/stock/moreHotStock
:return: 热门股票
:rtype: pandas.DataFrame
"""
url = "https://www.taoguba.com.cn/stock/moreHotStock"
r = requests.get(url)
temp_df = pd.concat([pd.read_html(r.text, header=0)[0], pd.read_html(r.text, header=0)[1]])
temp_df = temp_df[[
"个股代码",
"个股名称",
]]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_hot_tgb.py#L12-L27
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 43.75 |
[
7,
8,
9,
10,
14,
15
] | 37.5 | false | 38.461538 | 16 | 1 | 62.5 | 4 |
def stock_hot_tgb() -> pd.DataFrame:
url = "https://www.taoguba.com.cn/stock/moreHotStock"
r = requests.get(url)
temp_df = pd.concat([pd.read_html(r.text, header=0)[0], pd.read_html(r.text, header=0)[1]])
temp_df = temp_df[[
"个股代码",
"个股名称",
]]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
| 17,925 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_cls_alerts.py
|
stock_zh_a_alerts_cls
|
()
|
return temp_df
|
财联社-今日快讯
https://www.cls.cn/searchPage?keyword=%E5%BF%AB%E8%AE%AF&type=all
:return: 财联社-今日快讯
:rtype: pandas.DataFrame
|
财联社-今日快讯
https://www.cls.cn/searchPage?keyword=%E5%BF%AB%E8%AE%AF&type=all
:return: 财联社-今日快讯
:rtype: pandas.DataFrame
| 16 | 67 |
def stock_zh_a_alerts_cls() -> pd.DataFrame:
"""
财联社-今日快讯
https://www.cls.cn/searchPage?keyword=%E5%BF%AB%E8%AE%AF&type=all
:return: 财联社-今日快讯
:rtype: pandas.DataFrame
"""
warnings.warn(
"该接口将被移除,请使用 ak.stock_telegraph_cls() 接口替代", DeprecationWarning
)
url = "https://www.cls.cn/api/sw"
params = {
"app": "CailianpressWeb",
"os": "web",
"sv": "7.7.5",
}
r = requests.get(url, params=params)
headers = {
"Host": "www.cls.cn",
"Connection": "keep-alive",
"Content-Length": "112",
"Accept": "application/json, text/plain, */*",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
"Content-Type": "application/json;charset=UTF-8",
"Origin": "https://www.cls.cn",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
}
payload = {
"app": "CailianpressWeb",
"keyword": "快讯",
"os": "web",
"page": 0,
"rn": 10000,
"sv": "7.7.5",
"type": "telegram",
}
r = requests.post(url, headers=headers, params=params, json=payload)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["telegram"]["data"])
temp_df = temp_df[["descr", "time"]]
temp_df["descr"] = temp_df["descr"].astype(str).str.replace("</em>", "")
temp_df["descr"] = temp_df["descr"].str.replace("<em>", "")
temp_df["time"] = pd.to_datetime(temp_df["time"], unit="s").dt.date
temp_df.columns = ["快讯信息", "时间"]
temp_df = temp_df[["时间", "快讯信息"]]
temp_df.sort_values(["时间"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_cls_alerts.py#L16-L67
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 13.461538 |
[
7,
10,
11,
16,
17,
31,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 34.615385 | false | 11.864407 | 52 | 1 | 65.384615 | 4 |
def stock_zh_a_alerts_cls() -> pd.DataFrame:
warnings.warn(
"该接口将被移除,请使用 ak.stock_telegraph_cls() 接口替代", DeprecationWarning
)
url = "https://www.cls.cn/api/sw"
params = {
"app": "CailianpressWeb",
"os": "web",
"sv": "7.7.5",
}
r = requests.get(url, params=params)
headers = {
"Host": "www.cls.cn",
"Connection": "keep-alive",
"Content-Length": "112",
"Accept": "application/json, text/plain, */*",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
"Content-Type": "application/json;charset=UTF-8",
"Origin": "https://www.cls.cn",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
}
payload = {
"app": "CailianpressWeb",
"keyword": "快讯",
"os": "web",
"page": 0,
"rn": 10000,
"sv": "7.7.5",
"type": "telegram",
}
r = requests.post(url, headers=headers, params=params, json=payload)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["telegram"]["data"])
temp_df = temp_df[["descr", "time"]]
temp_df["descr"] = temp_df["descr"].astype(str).str.replace("</em>", "")
temp_df["descr"] = temp_df["descr"].str.replace("<em>", "")
temp_df["time"] = pd.to_datetime(temp_df["time"], unit="s").dt.date
temp_df.columns = ["快讯信息", "时间"]
temp_df = temp_df[["时间", "快讯信息"]]
temp_df.sort_values(["时间"], inplace=True)
temp_df.reset_index(inplace=True, drop=True)
return temp_df
| 17,926 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_cls_alerts.py
|
stock_telegraph_cls
|
()
|
return big_df
|
财联社-电报
https://www.cls.cn/telegraph
:return: 财联社-电报
:rtype: pandas.DataFrame
|
财联社-电报
https://www.cls.cn/telegraph
:return: 财联社-电报
:rtype: pandas.DataFrame
| 70 | 114 |
def stock_telegraph_cls() -> pd.DataFrame:
"""
财联社-电报
https://www.cls.cn/telegraph
:return: 财联社-电报
:rtype: pandas.DataFrame
"""
session = requests.session()
url = "https://m.cls.cn/telegraph"
session.get(url) # 获取 cookies
params = {
"refresh_type": "1",
"rn": "10",
"last_time": "",
"app": "CailianpressWap",
"sv": "1",
}
ts = pd.Timestamp(pd.Timestamp.now())
current_time = int(ts.timestamp())
params.update({"last_time": current_time})
url = "https://m.cls.cn/nodeapi/telegraphs"
r = session.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["roll_data"])
next_time = temp_df["modified_time"].values[-1]
n = 1
big_df = temp_df.copy()
while n < 15:
params.update({"last_time": next_time})
r = session.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["roll_data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
next_time = temp_df["modified_time"].values[-1]
n += 1
big_df = big_df[["title", "content", "ctime"]]
big_df["ctime"] = pd.to_datetime(
big_df["ctime"], unit="s", utc=True
).dt.tz_convert("Asia/Shanghai")
big_df.columns = ["标题", "内容", "发布时间"]
big_df.sort_values(["发布时间"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
big_df["发布日期"] = big_df["发布时间"].dt.date
big_df["发布时间"] = big_df["发布时间"].dt.time
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_cls_alerts.py#L70-L114
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.555556 |
[
7,
8,
9,
10,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
39,
40,
41,
42,
43,
44
] | 66.666667 | false | 11.864407 | 45 | 2 | 33.333333 | 4 |
def stock_telegraph_cls() -> pd.DataFrame:
session = requests.session()
url = "https://m.cls.cn/telegraph"
session.get(url) # 获取 cookies
params = {
"refresh_type": "1",
"rn": "10",
"last_time": "",
"app": "CailianpressWap",
"sv": "1",
}
ts = pd.Timestamp(pd.Timestamp.now())
current_time = int(ts.timestamp())
params.update({"last_time": current_time})
url = "https://m.cls.cn/nodeapi/telegraphs"
r = session.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["roll_data"])
next_time = temp_df["modified_time"].values[-1]
n = 1
big_df = temp_df.copy()
while n < 15:
params.update({"last_time": next_time})
r = session.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["roll_data"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
next_time = temp_df["modified_time"].values[-1]
n += 1
big_df = big_df[["title", "content", "ctime"]]
big_df["ctime"] = pd.to_datetime(
big_df["ctime"], unit="s", utc=True
).dt.tz_convert("Asia/Shanghai")
big_df.columns = ["标题", "内容", "发布时间"]
big_df.sort_values(["发布时间"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
big_df["发布日期"] = big_df["发布时间"].dt.date
big_df["发布时间"] = big_df["发布时间"].dt.time
return big_df
| 17,927 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
stock_lhb_detail_daily_sina
|
(
trade_date: str = "20200730", symbol: str = "当日无价格涨跌幅限制的A股,出现异常波动停牌的股票"
)
|
return temp_df
|
龙虎榜-每日详情
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml
:param trade_date: 交易日, e.g., trade_date="20200729"
:type trade_date: str
:param symbol: 指定标题
:type symbol: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
|
龙虎榜-每日详情
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml
:param trade_date: 交易日, e.g., trade_date="20200729"
:type trade_date: str
:param symbol: 指定标题
:type symbol: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
| 14 | 53 |
def stock_lhb_detail_daily_sina(
trade_date: str = "20200730", symbol: str = "当日无价格涨跌幅限制的A股,出现异常波动停牌的股票"
) -> pd.DataFrame:
"""
龙虎榜-每日详情
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml
:param trade_date: 交易日, e.g., trade_date="20200729"
:type trade_date: str
:param symbol: 指定标题
:type symbol: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
"""
trade_date = "-".join([trade_date[:4], trade_date[4:6], trade_date[6:]])
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml"
params = {"tradedate": trade_date}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
table_name_list = [
item.get_text().strip()
for item in soup.find_all(
"span", attrs={"style": "font-weight:bold;font-size:14px;"}
)
if item.get_text().strip() != ""
]
if symbol == "返回当前交易日所有可查询的指标":
return table_name_list
else:
position_num = table_name_list.index(symbol)
if len(table_name_list) == position_num + 1:
temp_df_1 = pd.read_html(r.text, flavor='bs4', header=1)[position_num].iloc[0:, :]
temp_df_2 = pd.read_html(r.text, flavor='bs4', header=1)[position_num + 1].iloc[0:, :]
temp_df_3 = pd.read_html(r.text, flavor='bs4', header=1)[position_num + 2].iloc[0:, :]
temp_df = pd.concat([temp_df_1, temp_df_2, temp_df_3], ignore_index=True)
else:
temp_df = pd.read_html(r.text, flavor='bs4', header=1)[position_num].iloc[0:, :]
temp_df["股票代码"] = temp_df["股票代码"].astype(str).str.zfill(6)
del temp_df["查看详情"]
temp_df.columns = ["序号", "股票代码", "股票名称", "收盘价", "对应值", "成交量", "成交额"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L14-L53
| 25 |
[
0
] | 2.5 |
[
13,
14,
15,
16,
17,
18,
25,
26,
28,
29,
30,
31,
32,
33,
35,
36,
37,
38,
39
] | 47.5 | false | 10.25641 | 40 | 4 | 52.5 | 8 |
def stock_lhb_detail_daily_sina(
trade_date: str = "20200730", symbol: str = "当日无价格涨跌幅限制的A股,出现异常波动停牌的股票"
) -> pd.DataFrame:
trade_date = "-".join([trade_date[:4], trade_date[4:6], trade_date[6:]])
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lhb/index.phtml"
params = {"tradedate": trade_date}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
table_name_list = [
item.get_text().strip()
for item in soup.find_all(
"span", attrs={"style": "font-weight:bold;font-size:14px;"}
)
if item.get_text().strip() != ""
]
if symbol == "返回当前交易日所有可查询的指标":
return table_name_list
else:
position_num = table_name_list.index(symbol)
if len(table_name_list) == position_num + 1:
temp_df_1 = pd.read_html(r.text, flavor='bs4', header=1)[position_num].iloc[0:, :]
temp_df_2 = pd.read_html(r.text, flavor='bs4', header=1)[position_num + 1].iloc[0:, :]
temp_df_3 = pd.read_html(r.text, flavor='bs4', header=1)[position_num + 2].iloc[0:, :]
temp_df = pd.concat([temp_df_1, temp_df_2, temp_df_3], ignore_index=True)
else:
temp_df = pd.read_html(r.text, flavor='bs4', header=1)[position_num].iloc[0:, :]
temp_df["股票代码"] = temp_df["股票代码"].astype(str).str.zfill(6)
del temp_df["查看详情"]
temp_df.columns = ["序号", "股票代码", "股票名称", "收盘价", "对应值", "成交量", "成交额"]
return temp_df
| 17,928 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
_find_last_page
|
(url: str = None, recent_day: str = "60")
|
return previous_page
| 56 | 82 |
def _find_last_page(url: str = None, recent_day: str = "60"):
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
params = {
"last": recent_day,
"p": "1",
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
try:
previous_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
except:
previous_page = 1
if previous_page != 1:
while True:
params = {
"last": recent_day,
"p": previous_page,
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
last_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
if last_page != previous_page:
previous_page = last_page
continue
else:
break
return previous_page
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L56-L82
| 25 |
[
0
] | 3.703704 |
[
1,
2,
6,
7,
8,
9,
10,
11,
12,
13,
14,
18,
19,
20,
21,
22,
23,
25,
26
] | 70.37037 | false | 10.25641 | 27 | 5 | 29.62963 | 0 |
def _find_last_page(url: str = None, recent_day: str = "60"):
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
params = {
"last": recent_day,
"p": "1",
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
try:
previous_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
except:
previous_page = 1
if previous_page != 1:
while True:
params = {
"last": recent_day,
"p": previous_page,
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
last_page = int(soup.find_all(attrs={"class": "page"})[-2].text)
if last_page != previous_page:
previous_page = last_page
continue
else:
break
return previous_page
| 17,929 |
||
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
stock_lhb_ggtj_sina
|
(recent_day: str = "30")
|
return big_df
|
龙虎榜-个股上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
|
龙虎榜-个股上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
| 85 | 107 |
def stock_lhb_ggtj_sina(recent_day: str = "30") -> pd.DataFrame:
"""
龙虎榜-个股上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-每日详情
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": recent_day,
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df.columns = ["股票代码", "股票名称", "上榜次数", "累积购买额", "累积卖出额", "净额", "买入席位数", "卖出席位数"]
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L85-L107
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 39.130435 |
[
9,
10,
11,
12,
13,
17,
18,
19,
20,
21,
22
] | 47.826087 | false | 10.25641 | 23 | 2 | 52.173913 | 6 |
def stock_lhb_ggtj_sina(recent_day: str = "30") -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/ggtj/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": recent_day,
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
big_df.columns = ["股票代码", "股票名称", "上榜次数", "累积购买额", "累积卖出额", "净额", "买入席位数", "卖出席位数"]
return big_df
| 17,930 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
stock_lhb_yytj_sina
|
(recent_day: str = "5")
|
return big_df
|
龙虎榜-营业部上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-营业部上榜统计
:rtype: pandas.DataFrame
|
龙虎榜-营业部上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-营业部上榜统计
:rtype: pandas.DataFrame
| 110 | 134 |
def stock_lhb_yytj_sina(recent_day: str = "5") -> pd.DataFrame:
"""
龙虎榜-营业部上榜统计
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-营业部上榜统计
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": "5",
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = ["营业部名称", "上榜次数", "累积购买额", "买入席位数", "累积卖出额", "卖出席位数", "买入前三股票"]
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_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L110-L134
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 36 |
[
9,
10,
11,
12,
13,
17,
18,
19,
20,
21,
22,
23,
24
] | 52 | false | 10.25641 | 25 | 2 | 48 | 6 |
def stock_lhb_yytj_sina(recent_day: str = "5") -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/yytj/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": "5",
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = ["营业部名称", "上榜次数", "累积购买额", "买入席位数", "累积卖出额", "卖出席位数", "买入前三股票"]
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_df
| 17,931 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
stock_lhb_jgzz_sina
|
(recent_day: str = "5")
|
return big_df
|
龙虎榜-机构席位追踪
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-机构席位追踪
:rtype: pandas.DataFrame
|
龙虎榜-机构席位追踪
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-机构席位追踪
:rtype: pandas.DataFrame
| 137 | 163 |
def stock_lhb_jgzz_sina(recent_day: str = "5") -> pd.DataFrame:
"""
龙虎榜-机构席位追踪
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml
:param recent_day: choice of {"5": 最近 5 天; "10": 最近 10 天; "30": 最近 30 天; "60": 最近 60 天;}
:type recent_day: str
:return: 龙虎榜-机构席位追踪
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": recent_day,
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
del big_df["当前价"]
del big_df["涨跌幅"]
big_df.columns = ["股票代码", "股票名称", "累积买入额", "买入次数", "累积卖出额", "卖出次数", "净额"]
big_df['买入次数'] = pd.to_numeric(big_df['买入次数'], errors="coerce")
big_df['卖出次数'] = pd.to_numeric(big_df['卖出次数'], errors="coerce")
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L137-L163
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 33.333333 |
[
9,
10,
11,
12,
13,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
] | 55.555556 | false | 10.25641 | 27 | 2 | 44.444444 | 6 |
def stock_lhb_jgzz_sina(recent_day: str = "5") -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgzz/index.phtml"
last_page_num = _find_last_page(url, recent_day)
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"last": recent_day,
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
del big_df["当前价"]
del big_df["涨跌幅"]
big_df.columns = ["股票代码", "股票名称", "累积买入额", "买入次数", "累积卖出额", "卖出次数", "净额"]
big_df['买入次数'] = pd.to_numeric(big_df['买入次数'], errors="coerce")
big_df['卖出次数'] = pd.to_numeric(big_df['卖出次数'], errors="coerce")
return big_df
| 17,932 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_feature/stock_lhb_sina.py
|
stock_lhb_jgmx_sina
|
()
|
return big_df
|
龙虎榜-机构席位成交明细
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml
:return: 龙虎榜-机构席位成交明细
:rtype: pandas.DataFrame
|
龙虎榜-机构席位成交明细
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml
:return: 龙虎榜-机构席位成交明细
:rtype: pandas.DataFrame
| 166 | 192 |
def stock_lhb_jgmx_sina() -> pd.DataFrame:
"""
龙虎榜-机构席位成交明细
http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml
:return: 龙虎榜-机构席位成交明细
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml"
params = {
"p": "1",
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
try:
last_page_num = int(soup.find_all(attrs={"class": "page"})[-2].text)
except:
last_page_num = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_feature/stock_lhb_sina.py#L166-L192
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 25.925926 |
[
7,
8,
11,
12,
13,
14,
15,
16,
17,
18,
19,
22,
23,
24,
25,
26
] | 59.259259 | false | 10.25641 | 27 | 3 | 40.740741 | 4 |
def stock_lhb_jgmx_sina() -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vLHBData/kind/jgmx/index.phtml"
params = {
"p": "1",
}
r = requests.get(url, params=params)
soup = BeautifulSoup(r.text, "lxml")
try:
last_page_num = int(soup.find_all(attrs={"class": "page"})[-2].text)
except:
last_page_num = 1
big_df = pd.DataFrame()
for page in tqdm(range(1, last_page_num + 1), leave=False):
params = {
"p": page,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0].iloc[0:, :]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["股票代码"] = big_df["股票代码"].astype(str).str.zfill(6)
return big_df
| 17,933 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.