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/economic/macro_uk.py
|
macro_uk_bank_rate
|
()
|
return temp_df
|
东方财富-经济数据-英国-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_4_3.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_4_3.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
| 106 | 114 |
def macro_uk_bank_rate() -> pd.DataFrame:
"""
东方财富-经济数据-英国-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_4_3.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00342253")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L106-L114
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_bank_rate() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00342253")
return temp_df
| 18,034 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_core_cpi_yearly
|
()
|
return temp_df
|
东方财富-经济数据-英国-核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_4.html
:return: 核心消费者物价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_4.html
:return: 核心消费者物价指数年率
:rtype: pandas.DataFrame
| 118 | 126 |
def macro_uk_core_cpi_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_4.html
:return: 核心消费者物价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00010279")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L118-L126
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_core_cpi_yearly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00010279")
return temp_df
| 18,035 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_core_cpi_monthly
|
()
|
return temp_df
|
东方财富-经济数据-英国-核心消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_5.html
:return: 核心消费者物价指数月率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-核心消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_5.html
:return: 核心消费者物价指数月率
:rtype: pandas.DataFrame
| 130 | 138 |
def macro_uk_core_cpi_monthly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-核心消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_5.html
:return: 核心消费者物价指数月率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00010291")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L130-L138
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_core_cpi_monthly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00010291")
return temp_df
| 18,036 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_cpi_yearly
|
()
|
return temp_df
|
东方财富-经济数据-英国-消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_6.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_6.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
| 142 | 150 |
def macro_uk_cpi_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_4_6.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00010267")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L142-L150
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_cpi_yearly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00010267")
return temp_df
| 18,037 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_cpi_monthly
|
()
|
return temp_df
|
东方财富-经济数据-英国-消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_7.html
:return: 消费者物价指数月率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_7.html
:return: 消费者物价指数月率
:rtype: pandas.DataFrame
| 154 | 162 |
def macro_uk_cpi_monthly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-消费者物价指数月率
https://data.eastmoney.com/cjsj/foreign_4_7.html
:return: 消费者物价指数月率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00010291")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L154-L162
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_cpi_monthly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00010291")
return temp_df
| 18,038 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_retail_monthly
|
()
|
return temp_df
|
东方财富-经济数据-英国-零售销售月率
https://data.eastmoney.com/cjsj/foreign_4_8.html
:return: 零售销售月率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-零售销售月率
https://data.eastmoney.com/cjsj/foreign_4_8.html
:return: 零售销售月率
:rtype: pandas.DataFrame
| 166 | 174 |
def macro_uk_retail_monthly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-零售销售月率
https://data.eastmoney.com/cjsj/foreign_4_8.html
:return: 零售销售月率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00158298")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L166-L174
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_retail_monthly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00158298")
return temp_df
| 18,039 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_retail_yearly
|
()
|
return temp_df
|
东方财富-经济数据-英国-零售销售年率
https://data.eastmoney.com/cjsj/foreign_4_9.html
:return: 零售销售年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-零售销售年率
https://data.eastmoney.com/cjsj/foreign_4_9.html
:return: 零售销售年率
:rtype: pandas.DataFrame
| 178 | 186 |
def macro_uk_retail_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-零售销售年率
https://data.eastmoney.com/cjsj/foreign_4_9.html
:return: 零售销售年率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00158297")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L178-L186
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_retail_yearly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00158297")
return temp_df
| 18,040 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_rightmove_yearly
|
()
|
return temp_df
|
东方财富-经济数据-英国-Rightmove 房价指数年率
https://data.eastmoney.com/cjsj/foreign_4_10.html
:return: Rightmove 房价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-Rightmove 房价指数年率
https://data.eastmoney.com/cjsj/foreign_4_10.html
:return: Rightmove 房价指数年率
:rtype: pandas.DataFrame
| 190 | 198 |
def macro_uk_rightmove_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-Rightmove 房价指数年率
https://data.eastmoney.com/cjsj/foreign_4_10.html
:return: Rightmove 房价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00341608")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L190-L198
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_rightmove_yearly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00341608")
return temp_df
| 18,041 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_rightmove_monthly
|
()
|
return temp_df
|
东方财富-经济数据-英国-Rightmove 房价指数月率
https://data.eastmoney.com/cjsj/foreign_4_11.html
:return: Rightmove 房价指数月率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-Rightmove 房价指数月率
https://data.eastmoney.com/cjsj/foreign_4_11.html
:return: Rightmove 房价指数月率
:rtype: pandas.DataFrame
| 202 | 210 |
def macro_uk_rightmove_monthly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-Rightmove 房价指数月率
https://data.eastmoney.com/cjsj/foreign_4_11.html
:return: Rightmove 房价指数月率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00341607")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L202-L210
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_rightmove_monthly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00341607")
return temp_df
| 18,042 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_gdp_quarterly
|
()
|
return temp_df
|
东方财富-经济数据-英国-GDP 季率初值
https://data.eastmoney.com/cjsj/foreign_4_12.html
:return: GDP 季率初值
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-GDP 季率初值
https://data.eastmoney.com/cjsj/foreign_4_12.html
:return: GDP 季率初值
:rtype: pandas.DataFrame
| 214 | 222 |
def macro_uk_gdp_quarterly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-GDP 季率初值
https://data.eastmoney.com/cjsj/foreign_4_12.html
:return: GDP 季率初值
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00158277")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L214-L222
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_gdp_quarterly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00158277")
return temp_df
| 18,043 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_gdp_yearly
|
()
|
return temp_df
|
东方财富-经济数据-英国-GDP 年率初值
https://data.eastmoney.com/cjsj/foreign_4_13.html
:return: GDP 年率初值
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-GDP 年率初值
https://data.eastmoney.com/cjsj/foreign_4_13.html
:return: GDP 年率初值
:rtype: pandas.DataFrame
| 226 | 234 |
def macro_uk_gdp_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-英国-GDP 年率初值
https://data.eastmoney.com/cjsj/foreign_4_13.html
:return: GDP 年率初值
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00158276")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L226-L234
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_gdp_yearly() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00158276")
return temp_df
| 18,044 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_uk.py
|
macro_uk_unemployment_rate
|
()
|
return temp_df
|
东方财富-经济数据-英国-失业率
https://data.eastmoney.com/cjsj/foreign_4_14.html
:return: 失业率
:rtype: pandas.DataFrame
|
东方财富-经济数据-英国-失业率
https://data.eastmoney.com/cjsj/foreign_4_14.html
:return: 失业率
:rtype: pandas.DataFrame
| 238 | 246 |
def macro_uk_unemployment_rate() -> pd.DataFrame:
"""
东方财富-经济数据-英国-失业率
https://data.eastmoney.com/cjsj/foreign_4_14.html
:return: 失业率
:rtype: pandas.DataFrame
"""
temp_df = macro_uk_core(symbol="EMG00010348")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_uk.py#L238-L246
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 21.73913 | 9 | 1 | 77.777778 | 4 |
def macro_uk_unemployment_rate() -> pd.DataFrame:
temp_df = macro_uk_core(symbol="EMG00010348")
return temp_df
| 18,045 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_core
|
(symbol: str = "EMG00341602")
|
return temp_df
|
东方财富-数据中心-经济数据一览-宏观经济-瑞士-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-宏观经济-瑞士-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
| 13 | 67 |
def macro_swiss_core(symbol: str = "EMG00341602") -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-宏观经济-瑞士-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_CH",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L13-L67
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 16.363636 |
[
9,
10,
25,
26,
27,
28,
42,
50,
51,
52,
53,
54
] | 21.818182 | false | 25 | 55 | 1 | 78.181818 | 6 |
def macro_swiss_core(symbol: str = "EMG00341602") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_CH",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
| 18,046 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_svme
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-SVME采购经理人指数
http://data.eastmoney.com/cjsj/foreign_2_0.html
:return: SVME采购经理人指数
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-SVME采购经理人指数
http://data.eastmoney.com/cjsj/foreign_2_0.html
:return: SVME采购经理人指数
:rtype: pandas.DataFrame
| 71 | 79 |
def macro_swiss_svme():
"""
东方财富-经济数据-瑞士-SVME采购经理人指数
http://data.eastmoney.com/cjsj/foreign_2_0.html
:return: SVME采购经理人指数
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341602")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L71-L79
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_svme():
temp_df = macro_swiss_core(symbol="EMG00341602")
return temp_df
| 18,047 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_trade
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-贸易帐
http://data.eastmoney.com/cjsj/foreign_2_1.html
:return: 贸易帐
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-贸易帐
http://data.eastmoney.com/cjsj/foreign_2_1.html
:return: 贸易帐
:rtype: pandas.DataFrame
| 83 | 91 |
def macro_swiss_trade():
"""
东方财富-经济数据-瑞士-贸易帐
http://data.eastmoney.com/cjsj/foreign_2_1.html
:return: 贸易帐
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341603")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L83-L91
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_trade():
temp_df = macro_swiss_core(symbol="EMG00341603")
return temp_df
| 18,048 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_cpi_yearly
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-消费者物价指数年率
http://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-消费者物价指数年率
http://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
| 95 | 103 |
def macro_swiss_cpi_yearly():
"""
东方财富-经济数据-瑞士-消费者物价指数年率
http://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 消费者物价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341604")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L95-L103
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_cpi_yearly():
temp_df = macro_swiss_core(symbol="EMG00341604")
return temp_df
| 18,049 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_gdp_quarterly
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-GDP季率
http://data.eastmoney.com/cjsj/foreign_2_3.html
:return: GDP季率
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-GDP季率
http://data.eastmoney.com/cjsj/foreign_2_3.html
:return: GDP季率
:rtype: pandas.DataFrame
| 107 | 115 |
def macro_swiss_gdp_quarterly():
"""
东方财富-经济数据-瑞士-GDP季率
http://data.eastmoney.com/cjsj/foreign_2_3.html
:return: GDP季率
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341600")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L107-L115
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_gdp_quarterly():
temp_df = macro_swiss_core(symbol="EMG00341600")
return temp_df
| 18,050 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_gbd_yearly
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-GDP 年率
http://data.eastmoney.com/cjsj/foreign_2_4.html
:return: GDP年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-GDP 年率
http://data.eastmoney.com/cjsj/foreign_2_4.html
:return: GDP年率
:rtype: pandas.DataFrame
| 119 | 127 |
def macro_swiss_gbd_yearly():
"""
东方财富-经济数据-瑞士-GDP 年率
http://data.eastmoney.com/cjsj/foreign_2_4.html
:return: GDP年率
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341601")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L119-L127
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_gbd_yearly():
temp_df = macro_swiss_core(symbol="EMG00341601")
return temp_df
| 18,051 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_swiss.py
|
macro_swiss_gbd_bank_rate
|
()
|
return temp_df
|
东方财富-经济数据-瑞士-央行公布利率决议
http://data.eastmoney.com/cjsj/foreign_2_5.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
|
东方财富-经济数据-瑞士-央行公布利率决议
http://data.eastmoney.com/cjsj/foreign_2_5.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
| 131 | 139 |
def macro_swiss_gbd_bank_rate():
"""
东方财富-经济数据-瑞士-央行公布利率决议
http://data.eastmoney.com/cjsj/foreign_2_5.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
"""
temp_df = macro_swiss_core(symbol="EMG00341606")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_swiss.py#L131-L139
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 25 | 9 | 1 | 77.777778 | 4 |
def macro_swiss_gbd_bank_rate():
temp_df = macro_swiss_core(symbol="EMG00341606")
return temp_df
| 18,052 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_core
|
(symbol: str = "EMG00179154")
|
return temp_df
|
东方财富-数据中心-经济数据一览-宏观经济-德国-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-宏观经济-德国-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
| 11 | 65 |
def macro_germany_core(symbol: str = "EMG00179154") -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-宏观经济-德国-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_GER",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L11-L65
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 16.363636 |
[
9,
10,
25,
26,
27,
28,
42,
50,
51,
52,
53,
54
] | 21.818182 | false | 22.807018 | 55 | 1 | 78.181818 | 6 |
def macro_germany_core(symbol: str = "EMG00179154") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_GER",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
| 18,053 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_ifo
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-IFO商业景气指数
https://data.eastmoney.com/cjsj/foreign_1_0.html
:return: IFO商业景气指数
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-IFO商业景气指数
https://data.eastmoney.com/cjsj/foreign_1_0.html
:return: IFO商业景气指数
:rtype: pandas.DataFrame
| 69 | 77 |
def macro_germany_ifo() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-IFO商业景气指数
https://data.eastmoney.com/cjsj/foreign_1_0.html
:return: IFO商业景气指数
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00179154")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L69-L77
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_ifo() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00179154")
return temp_df
| 18,054 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_cpi_monthly
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-消费者物价指数月率终值
https://data.eastmoney.com/cjsj/foreign_1_1.html
:return: 消费者物价指数月率终值
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-消费者物价指数月率终值
https://data.eastmoney.com/cjsj/foreign_1_1.html
:return: 消费者物价指数月率终值
:rtype: pandas.DataFrame
| 81 | 89 |
def macro_germany_cpi_monthly() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-消费者物价指数月率终值
https://data.eastmoney.com/cjsj/foreign_1_1.html
:return: 消费者物价指数月率终值
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00009758")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L81-L89
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_cpi_monthly() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00009758")
return temp_df
| 18,055 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_cpi_yearly
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-消费者物价指数年率终值
https://data.eastmoney.com/cjsj/foreign_1_2.html
:return: 消费者物价指数年率终值
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-消费者物价指数年率终值
https://data.eastmoney.com/cjsj/foreign_1_2.html
:return: 消费者物价指数年率终值
:rtype: pandas.DataFrame
| 93 | 101 |
def macro_germany_cpi_yearly() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-消费者物价指数年率终值
https://data.eastmoney.com/cjsj/foreign_1_2.html
:return: 消费者物价指数年率终值
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00009756")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L93-L101
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_cpi_yearly() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00009756")
return temp_df
| 18,056 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_trade_adjusted
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-贸易帐(季调后)
https://data.eastmoney.com/cjsj/foreign_1_3.html
:return: 贸易帐(季调后)
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-贸易帐(季调后)
https://data.eastmoney.com/cjsj/foreign_1_3.html
:return: 贸易帐(季调后)
:rtype: pandas.DataFrame
| 105 | 113 |
def macro_germany_trade_adjusted() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-贸易帐(季调后)
https://data.eastmoney.com/cjsj/foreign_1_3.html
:return: 贸易帐(季调后)
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00009753")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L105-L113
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_trade_adjusted() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00009753")
return temp_df
| 18,057 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_gdp
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-GDP
https://data.eastmoney.com/cjsj/foreign_1_4.html
:return: GDP
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-GDP
https://data.eastmoney.com/cjsj/foreign_1_4.html
:return: GDP
:rtype: pandas.DataFrame
| 117 | 125 |
def macro_germany_gdp() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-GDP
https://data.eastmoney.com/cjsj/foreign_1_4.html
:return: GDP
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00009720")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L117-L125
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_gdp() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00009720")
return temp_df
| 18,058 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_retail_sale_monthly
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-实际零售销售月率
https://data.eastmoney.com/cjsj/foreign_1_5.html
:return: 实际零售销售月率
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-实际零售销售月率
https://data.eastmoney.com/cjsj/foreign_1_5.html
:return: 实际零售销售月率
:rtype: pandas.DataFrame
| 129 | 137 |
def macro_germany_retail_sale_monthly() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-实际零售销售月率
https://data.eastmoney.com/cjsj/foreign_1_5.html
:return: 实际零售销售月率
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG01333186")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L129-L137
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_retail_sale_monthly() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG01333186")
return temp_df
| 18,059 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_retail_sale_yearly
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-实际零售销售年率
https://data.eastmoney.com/cjsj/foreign_1_6.html
:return: 实际零售销售年率
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-实际零售销售年率
https://data.eastmoney.com/cjsj/foreign_1_6.html
:return: 实际零售销售年率
:rtype: pandas.DataFrame
| 141 | 149 |
def macro_germany_retail_sale_yearly() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-实际零售销售年率
https://data.eastmoney.com/cjsj/foreign_1_6.html
:return: 实际零售销售年率
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG01333192")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L141-L149
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_retail_sale_yearly() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG01333192")
return temp_df
| 18,060 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_germany.py
|
macro_germany_zew
|
()
|
return temp_df
|
东方财富-数据中心-经济数据一览-德国-ZEW 经济景气指数
https://data.eastmoney.com/cjsj/foreign_1_7.html
:return: ZEW 经济景气指数
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-德国-ZEW 经济景气指数
https://data.eastmoney.com/cjsj/foreign_1_7.html
:return: ZEW 经济景气指数
:rtype: pandas.DataFrame
| 153 | 161 |
def macro_germany_zew() -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-德国-ZEW 经济景气指数
https://data.eastmoney.com/cjsj/foreign_1_7.html
:return: ZEW 经济景气指数
:rtype: pandas.DataFrame
"""
temp_df = macro_germany_core(symbol="EMG00172577")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_germany.py#L153-L161
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 22.807018 | 9 | 1 | 77.777778 | 4 |
def macro_germany_zew() -> pd.DataFrame:
temp_df = macro_germany_core(symbol="EMG00172577")
return temp_df
| 18,061 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_core
|
(symbol: str = "EMG00341602")
|
return temp_df
|
东方财富-数据中心-经济数据一览-宏观经济-日本-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
|
东方财富-数据中心-经济数据一览-宏观经济-日本-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
| 12 | 66 |
def macro_japan_core(symbol: str = "EMG00341602") -> pd.DataFrame:
"""
东方财富-数据中心-经济数据一览-宏观经济-日本-核心代码
https://data.eastmoney.com/cjsj/foreign_1_0.html
:param symbol: 代码
:type symbol: str
:return: 指定 symbol 的数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_JPAN",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L12-L66
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 16.363636 |
[
9,
10,
25,
26,
27,
28,
42,
50,
51,
52,
53,
54
] | 21.818182 | false | 23.809524 | 55 | 1 | 78.181818 | 6 |
def macro_japan_core(symbol: str = "EMG00341602") -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"reportName": "RPT_ECONOMICVALUE_JPAN",
"columns": "ALL",
"filter": f'(INDICATOR_ID="{symbol}")',
"pageNumber": "1",
"pageSize": "5000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1667639896816",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(
columns={
"COUNTRY": "-",
"INDICATOR_ID": "-",
"INDICATOR_NAME": "-",
"REPORT_DATE_CH": "时间",
"REPORT_DATE": "-",
"PUBLISH_DATE": "发布日期",
"VALUE": "现值",
"PRE_VALUE": "前值",
"INDICATOR_IDOLD": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"时间",
"前值",
"现值",
"发布日期",
]
]
temp_df["前值"] = pd.to_numeric(temp_df["前值"])
temp_df["现值"] = pd.to_numeric(temp_df["现值"])
temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date
temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True)
return temp_df
| 18,062 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_bank_rate
|
()
|
return temp_df
|
东方财富-经济数据-日本-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_3_0.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
|
东方财富-经济数据-日本-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_3_0.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
| 70 | 78 |
def macro_japan_bank_rate() -> pd.DataFrame:
"""
东方财富-经济数据-日本-央行公布利率决议
https://data.eastmoney.com/cjsj/foreign_3_0.html
:return: 央行公布利率决议
:rtype: pandas.DataFrame
"""
temp_df = macro_japan_core(symbol="EMG00342252")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L70-L78
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 23.809524 | 9 | 1 | 77.777778 | 4 |
def macro_japan_bank_rate() -> pd.DataFrame:
temp_df = macro_japan_core(symbol="EMG00342252")
return temp_df
| 18,063 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_cpi_yearly
|
()
|
return temp_df
|
东方财富-经济数据-日本-全国消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_3_1.html
:return: 全国消费者物价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-日本-全国消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_3_1.html
:return: 全国消费者物价指数年率
:rtype: pandas.DataFrame
| 82 | 90 |
def macro_japan_cpi_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-日本-全国消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_3_1.html
:return: 全国消费者物价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_japan_core(symbol="EMG00005004")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L82-L90
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 23.809524 | 9 | 1 | 77.777778 | 4 |
def macro_japan_cpi_yearly() -> pd.DataFrame:
temp_df = macro_japan_core(symbol="EMG00005004")
return temp_df
| 18,064 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_core_cpi_yearly
|
()
|
return temp_df
|
东方财富-经济数据-日本-全国核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 全国核心消费者物价指数年率
:rtype: pandas.DataFrame
|
东方财富-经济数据-日本-全国核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 全国核心消费者物价指数年率
:rtype: pandas.DataFrame
| 94 | 102 |
def macro_japan_core_cpi_yearly() -> pd.DataFrame:
"""
东方财富-经济数据-日本-全国核心消费者物价指数年率
https://data.eastmoney.com/cjsj/foreign_2_2.html
:return: 全国核心消费者物价指数年率
:rtype: pandas.DataFrame
"""
temp_df = macro_japan_core(symbol="EMG00158099")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L94-L102
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 23.809524 | 9 | 1 | 77.777778 | 4 |
def macro_japan_core_cpi_yearly() -> pd.DataFrame:
temp_df = macro_japan_core(symbol="EMG00158099")
return temp_df
| 18,065 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_unemployment_rate
|
()
|
return temp_df
|
东方财富-经济数据-日本-失业率
https://data.eastmoney.com/cjsj/foreign_2_3.html
:return: 失业率
:rtype: pandas.DataFrame
|
东方财富-经济数据-日本-失业率
https://data.eastmoney.com/cjsj/foreign_2_3.html
:return: 失业率
:rtype: pandas.DataFrame
| 106 | 114 |
def macro_japan_unemployment_rate() -> pd.DataFrame:
"""
东方财富-经济数据-日本-失业率
https://data.eastmoney.com/cjsj/foreign_2_3.html
:return: 失业率
:rtype: pandas.DataFrame
"""
temp_df = macro_japan_core(symbol="EMG00005047")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L106-L114
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 23.809524 | 9 | 1 | 77.777778 | 4 |
def macro_japan_unemployment_rate() -> pd.DataFrame:
temp_df = macro_japan_core(symbol="EMG00005047")
return temp_df
| 18,066 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_japan.py
|
macro_japan_head_indicator
|
()
|
return temp_df
|
东方财富-经济数据-日本-领先指标终值
https://data.eastmoney.com/cjsj/foreign_3_4.html
:return: 领先指标终值
:rtype: pandas.DataFrame
|
东方财富-经济数据-日本-领先指标终值
https://data.eastmoney.com/cjsj/foreign_3_4.html
:return: 领先指标终值
:rtype: pandas.DataFrame
| 118 | 126 |
def macro_japan_head_indicator() -> pd.DataFrame:
"""
东方财富-经济数据-日本-领先指标终值
https://data.eastmoney.com/cjsj/foreign_3_4.html
:return: 领先指标终值
:rtype: pandas.DataFrame
"""
temp_df = macro_japan_core(symbol="EMG00005117")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_japan.py#L118-L126
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 77.777778 |
[
7,
8
] | 22.222222 | false | 23.809524 | 9 | 1 | 77.777778 | 4 |
def macro_japan_head_indicator() -> pd.DataFrame:
temp_df = macro_japan_core(symbol="EMG00005117")
return temp_df
| 18,067 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_constitute.py
|
macro_cons_gold
|
()
|
return big_df
|
全球最大黄金 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_gold
:return: 持仓报告
:rtype: pandas.DataFrame
|
全球最大黄金 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_gold
:return: 持仓报告
:rtype: pandas.DataFrame
| 16 | 77 |
def macro_cons_gold() -> pd.DataFrame:
"""
全球最大黄金 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_gold
:return: 持仓报告
:rtype: pandas.DataFrame
"""
t = time.time()
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"category": "etf",
"attr_id": "1",
"max_date": "",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df.columns = [
"日期",
"总库存",
"增持/减持",
"总价值",
]
big_df["商品"] = "黄金"
big_df = big_df[
[
"商品",
"日期",
"总库存",
"增持/减持",
"总价值",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_constitute.py#L16-L77
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.290323 |
[
7,
8,
14,
15,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
38,
39,
45,
46,
55,
56,
57,
58,
59,
60,
61
] | 40.322581 | false | 11.111111 | 62 | 3 | 59.677419 | 4 |
def macro_cons_gold() -> pd.DataFrame:
t = time.time()
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"category": "etf",
"attr_id": "1",
"max_date": "",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df.columns = [
"日期",
"总库存",
"增持/减持",
"总价值",
]
big_df["商品"] = "黄金"
big_df = big_df[
[
"商品",
"日期",
"总库存",
"增持/减持",
"总价值",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,068 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_constitute.py
|
macro_cons_silver
|
()
|
return big_df
|
全球最大白银 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_sliver
:return: 持仓报告
:rtype: pandas.DataFrame
|
全球最大白银 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_sliver
:return: 持仓报告
:rtype: pandas.DataFrame
| 80 | 141 |
def macro_cons_silver() -> pd.DataFrame:
"""
全球最大白银 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今
https://datacenter.jin10.com/reportType/dc_etf_sliver
:return: 持仓报告
:rtype: pandas.DataFrame
"""
t = time.time()
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"category": "etf",
"attr_id": "2",
"max_date": "",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df.columns = [
"日期",
"总库存",
"增持/减持",
"总价值",
]
big_df["商品"] = "白银"
big_df = big_df[
[
"商品",
"日期",
"总库存",
"增持/减持",
"总价值",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_constitute.py#L80-L141
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.290323 |
[
7,
8,
14,
15,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
38,
39,
45,
46,
55,
56,
57,
58,
59,
60,
61
] | 40.322581 | false | 11.111111 | 62 | 3 | 59.677419 | 4 |
def macro_cons_silver() -> pd.DataFrame:
t = time.time()
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"category": "etf",
"attr_id": "2",
"max_date": "",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df.columns = [
"日期",
"总库存",
"增持/减持",
"总价值",
]
big_df["商品"] = "白银"
big_df = big_df[
[
"商品",
"日期",
"总库存",
"增持/减持",
"总价值",
]
]
big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,069 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_constitute.py
|
macro_cons_opec_month
|
()
|
return big_df
|
欧佩克报告-月度, 数据区间从 20170118-至今
这里返回的具体索引日期的数据为上一个月的数据, 由于某些国家的数据有缺失
只选择有数据的国家返回
20200312:fix:由于 “厄瓜多尔” 已经有几个月没有更新数据,在这里加以剔除
https://datacenter.jin10.com/reportType/dc_opec_report
:return: 欧佩克报告-月度
:rtype: pandas.DataFrame
|
欧佩克报告-月度, 数据区间从 20170118-至今
这里返回的具体索引日期的数据为上一个月的数据, 由于某些国家的数据有缺失
只选择有数据的国家返回
20200312:fix:由于 “厄瓜多尔” 已经有几个月没有更新数据,在这里加以剔除
https://datacenter.jin10.com/reportType/dc_opec_report
:return: 欧佩克报告-月度
:rtype: pandas.DataFrame
| 144 | 230 |
def macro_cons_opec_month() -> pd.DataFrame:
"""
欧佩克报告-月度, 数据区间从 20170118-至今
这里返回的具体索引日期的数据为上一个月的数据, 由于某些国家的数据有缺失
只选择有数据的国家返回
20200312:fix:由于 “厄瓜多尔” 已经有几个月没有更新数据,在这里加以剔除
https://datacenter.jin10.com/reportType/dc_opec_report
:return: 欧佩克报告-月度
:rtype: pandas.DataFrame
"""
t = time.time()
big_df = pd.DataFrame()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_opec_report",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
res = requests.get(
f"https://datacenter-api.jin10.com/reports/dates?category=opec&_={str(int(round(t * 1000)))}",
headers=headers,
) # 日期序列
all_date_list = res.json()["data"]
bar = tqdm(reversed(all_date_list))
for item in bar:
bar.set_description(f"Please wait for a moment, now downloading {item}'s data")
res = requests.get(
f"https://datacenter-api.jin10.com/reports/list?category=opec&date={item}&_={str(int(round(t * 1000)))}",
headers=headers,
)
temp_df = pd.DataFrame(
res.json()["data"]["values"],
columns=pd.DataFrame(res.json()["data"]["keys"])["name"].tolist(),
).T
temp_df.columns = temp_df.iloc[0, :]
temp_df = temp_df.iloc[1:, :]
try:
temp_df = temp_df[
[
"阿尔及利亚",
"安哥拉",
"加蓬",
"伊朗",
"伊拉克",
"科威特",
"利比亚",
"尼日利亚",
"沙特",
"阿联酋",
"委内瑞拉",
"欧佩克产量",
]
].iloc[-2, :]
except:
temp_df = temp_df[
[
"阿尔及利亚",
"安哥拉",
"加蓬",
"伊朗",
"伊拉克",
"科威特",
"利比亚",
"尼日利亚",
"沙特",
"阿联酋",
"委内瑞拉",
"欧佩克产量",
]
].iloc[-1, :]
temp_df.dropna(inplace=True)
big_df[temp_df.name] = temp_df
big_df = big_df.T
big_df = big_df.astype(float)
big_df.reset_index(inplace=True)
big_df.rename(columns={"index": "日期"}, inplace=True)
big_df.columns.name = None
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_constitute.py#L144-L230
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 11.494253 |
[
10,
11,
12,
27,
31,
32,
33,
34,
35,
39,
43,
44,
45,
46,
62,
63,
79,
80,
81,
82,
83,
84,
85,
86
] | 27.586207 | false | 11.111111 | 87 | 3 | 72.413793 | 7 |
def macro_cons_opec_month() -> pd.DataFrame:
t = time.time()
big_df = pd.DataFrame()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_opec_report",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
res = requests.get(
f"https://datacenter-api.jin10.com/reports/dates?category=opec&_={str(int(round(t * 1000)))}",
headers=headers,
) # 日期序列
all_date_list = res.json()["data"]
bar = tqdm(reversed(all_date_list))
for item in bar:
bar.set_description(f"Please wait for a moment, now downloading {item}'s data")
res = requests.get(
f"https://datacenter-api.jin10.com/reports/list?category=opec&date={item}&_={str(int(round(t * 1000)))}",
headers=headers,
)
temp_df = pd.DataFrame(
res.json()["data"]["values"],
columns=pd.DataFrame(res.json()["data"]["keys"])["name"].tolist(),
).T
temp_df.columns = temp_df.iloc[0, :]
temp_df = temp_df.iloc[1:, :]
try:
temp_df = temp_df[
[
"阿尔及利亚",
"安哥拉",
"加蓬",
"伊朗",
"伊拉克",
"科威特",
"利比亚",
"尼日利亚",
"沙特",
"阿联酋",
"委内瑞拉",
"欧佩克产量",
]
].iloc[-2, :]
except:
temp_df = temp_df[
[
"阿尔及利亚",
"安哥拉",
"加蓬",
"伊朗",
"伊拉克",
"科威特",
"利比亚",
"尼日利亚",
"沙特",
"阿联酋",
"委内瑞拉",
"欧佩克产量",
]
].iloc[-1, :]
temp_df.dropna(inplace=True)
big_df[temp_df.name] = temp_df
big_df = big_df.T
big_df = big_df.astype(float)
big_df.reset_index(inplace=True)
big_df.rename(columns={"index": "日期"}, inplace=True)
big_df.columns.name = None
return big_df
| 18,070 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_usa_interest_rate
|
()
|
return big_df
|
美联储利率决议报告, 数据区间从 19820927-至今
https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_usa_interest_rate_decision_all.js?v=1578581921
:return: 美联储利率决议报告-今值(%)
:rtype: pandas.Series
|
美联储利率决议报告, 数据区间从 19820927-至今
https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_usa_interest_rate_decision_all.js?v=1578581921
:return: 美联储利率决议报告-今值(%)
:rtype: pandas.Series
| 28 | 100 |
def macro_bank_usa_interest_rate() -> pd.DataFrame:
"""
美联储利率决议报告, 数据区间从 19820927-至今
https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_usa_interest_rate_decision_all.js?v=1578581921
:return: 美联储利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "24",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "美联储利率决议"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L28-L100
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_usa_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "24",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "美联储利率决议"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,071 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_euro_interest_rate
|
()
|
return big_df
|
欧洲央行决议报告, 数据区间从 19990101-至今
https://datacenter.jin10.com/reportType/dc_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_interest_rate_decision_all.js?v=1578581663
:return: 欧洲央行决议报告-今值(%)
:rtype: pandas.Series
|
欧洲央行决议报告, 数据区间从 19990101-至今
https://datacenter.jin10.com/reportType/dc_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_interest_rate_decision_all.js?v=1578581663
:return: 欧洲央行决议报告-今值(%)
:rtype: pandas.Series
| 104 | 176 |
def macro_bank_euro_interest_rate() -> pd.DataFrame:
"""
欧洲央行决议报告, 数据区间从 19990101-至今
https://datacenter.jin10.com/reportType/dc_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_interest_rate_decision_all.js?v=1578581663
:return: 欧洲央行决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "21",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "欧元区利率决议"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L104-L176
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_euro_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "21",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "欧元区利率决议"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,072 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_newzealand_interest_rate
|
()
|
return big_df
|
新西兰联储决议报告, 数据区间从 19990401-至今
https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075
:return: 新西兰联储决议报告-今值(%)
:rtype: pandas.Series
|
新西兰联储决议报告, 数据区间从 19990401-至今
https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075
:return: 新西兰联储决议报告-今值(%)
:rtype: pandas.Series
| 180 | 252 |
def macro_bank_newzealand_interest_rate() -> pd.DataFrame:
"""
新西兰联储决议报告, 数据区间从 19990401-至今
https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075
:return: 新西兰联储决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "23",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "新西兰利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L180-L252
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_newzealand_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "23",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "新西兰利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,073 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_china_interest_rate
|
()
|
return big_df
|
中国人民银行利率报告, 数据区间从 19910501-至今
https://datacenter.jin10.com/reportType/dc_china_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_china_interest_rate_decision_all.js?v=1578582163
:return: 中国人民银行利率报告-今值(%)
:rtype: pandas.Series
|
中国人民银行利率报告, 数据区间从 19910501-至今
https://datacenter.jin10.com/reportType/dc_china_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_china_interest_rate_decision_all.js?v=1578582163
:return: 中国人民银行利率报告-今值(%)
:rtype: pandas.Series
| 256 | 328 |
def macro_bank_china_interest_rate() -> pd.DataFrame:
"""
中国人民银行利率报告, 数据区间从 19910501-至今
https://datacenter.jin10.com/reportType/dc_china_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_china_interest_rate_decision_all.js?v=1578582163
:return: 中国人民银行利率报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "91",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "中国人民银行利率报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L256-L328
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_china_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "91",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "中国人民银行利率报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,074 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_switzerland_interest_rate
|
()
|
return big_df
|
瑞士央行利率决议报告, 数据区间从 20080313-至今
https://datacenter.jin10.com/reportType/dc_switzerland_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_switzerland_interest_rate_decision_all.js?v=1578582240
:return: 瑞士央行利率决议报告-今值(%)
:rtype: pandas.Series
|
瑞士央行利率决议报告, 数据区间从 20080313-至今
https://datacenter.jin10.com/reportType/dc_switzerland_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_switzerland_interest_rate_decision_all.js?v=1578582240
:return: 瑞士央行利率决议报告-今值(%)
:rtype: pandas.Series
| 332 | 404 |
def macro_bank_switzerland_interest_rate() -> pd.DataFrame:
"""
瑞士央行利率决议报告, 数据区间从 20080313-至今
https://datacenter.jin10.com/reportType/dc_switzerland_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_switzerland_interest_rate_decision_all.js?v=1578582240
:return: 瑞士央行利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "25",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "瑞士央行利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L332-L404
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_switzerland_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "25",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "瑞士央行利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,075 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_english_interest_rate
|
()
|
return big_df
|
英国央行决议报告, 数据区间从 19700101-至今
https://datacenter.jin10.com/reportType/dc_english_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_english_interest_rate_decision_all.js?v=1578582331
:return: 英国央行决议报告-今值(%)
:rtype: pandas.Series
|
英国央行决议报告, 数据区间从 19700101-至今
https://datacenter.jin10.com/reportType/dc_english_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_english_interest_rate_decision_all.js?v=1578582331
:return: 英国央行决议报告-今值(%)
:rtype: pandas.Series
| 408 | 480 |
def macro_bank_english_interest_rate() -> pd.DataFrame:
"""
英国央行决议报告, 数据区间从 19700101-至今
https://datacenter.jin10.com/reportType/dc_english_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_english_interest_rate_decision_all.js?v=1578582331
:return: 英国央行决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "26",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "英国利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L408-L480
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_english_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "26",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "英国利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,076 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_australia_interest_rate
|
()
|
return big_df
|
澳洲联储决议报告, 数据区间从 19800201-至今
https://datacenter.jin10.com/reportType/dc_australia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_australia_interest_rate_decision_all.js?v=1578582414
:return: 澳洲联储决议报告-今值(%)
:rtype: pandas.Series
|
澳洲联储决议报告, 数据区间从 19800201-至今
https://datacenter.jin10.com/reportType/dc_australia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_australia_interest_rate_decision_all.js?v=1578582414
:return: 澳洲联储决议报告-今值(%)
:rtype: pandas.Series
| 484 | 556 |
def macro_bank_australia_interest_rate() -> pd.DataFrame:
"""
澳洲联储决议报告, 数据区间从 19800201-至今
https://datacenter.jin10.com/reportType/dc_australia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_australia_interest_rate_decision_all.js?v=1578582414
:return: 澳洲联储决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "27",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "澳大利亚利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L484-L556
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_australia_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "27",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "澳大利亚利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,077 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_japan_interest_rate
|
()
|
return big_df
|
日本利率决议报告, 数据区间从 20080214-至今
https://datacenter.jin10.com/reportType/dc_japan_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_japan_interest_rate_decision_all.js?v=1578582485
:return: 日本利率决议报告-今值(%)
:rtype: pandas.Series
|
日本利率决议报告, 数据区间从 20080214-至今
https://datacenter.jin10.com/reportType/dc_japan_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_japan_interest_rate_decision_all.js?v=1578582485
:return: 日本利率决议报告-今值(%)
:rtype: pandas.Series
| 560 | 632 |
def macro_bank_japan_interest_rate() -> pd.DataFrame:
"""
日本利率决议报告, 数据区间从 20080214-至今
https://datacenter.jin10.com/reportType/dc_japan_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_japan_interest_rate_decision_all.js?v=1578582485
:return: 日本利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "22",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "日本利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L560-L632
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_japan_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "22",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "日本利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,078 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_russia_interest_rate
|
()
|
return big_df
|
俄罗斯利率决议报告, 数据区间从 20030601-至今
https://datacenter.jin10.com/reportType/dc_russia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_russia_interest_rate_decision_all.js?v=1578582572
:return: 俄罗斯利率决议报告-今值(%)
:rtype: pandas.Series
|
俄罗斯利率决议报告, 数据区间从 20030601-至今
https://datacenter.jin10.com/reportType/dc_russia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_russia_interest_rate_decision_all.js?v=1578582572
:return: 俄罗斯利率决议报告-今值(%)
:rtype: pandas.Series
| 636 | 708 |
def macro_bank_russia_interest_rate() -> pd.DataFrame:
"""
俄罗斯利率决议报告, 数据区间从 20030601-至今
https://datacenter.jin10.com/reportType/dc_russia_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_russia_interest_rate_decision_all.js?v=1578582572
:return: 俄罗斯利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "64",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "俄罗斯利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L636-L708
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_russia_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "64",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "俄罗斯利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,079 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_india_interest_rate
|
()
|
return big_df
|
印度利率决议报告, 数据区间从 20000801-至今
https://datacenter.jin10.com/reportType/dc_india_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_india_interest_rate_decision_all.js?v=1578582645
:return: 印度利率决议报告-今值(%)
:rtype: pandas.Series
|
印度利率决议报告, 数据区间从 20000801-至今
https://datacenter.jin10.com/reportType/dc_india_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_india_interest_rate_decision_all.js?v=1578582645
:return: 印度利率决议报告-今值(%)
:rtype: pandas.Series
| 712 | 784 |
def macro_bank_india_interest_rate() -> pd.DataFrame:
"""
印度利率决议报告, 数据区间从 20000801-至今
https://datacenter.jin10.com/reportType/dc_india_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_india_interest_rate_decision_all.js?v=1578582645
:return: 印度利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "68",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "印度利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L712-L784
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_india_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "68",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "印度利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,080 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_bank.py
|
macro_bank_brazil_interest_rate
|
()
|
return big_df
|
巴西利率决议报告, 数据区间从 20080201-至今
https://datacenter.jin10.com/reportType/dc_brazil_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_brazil_interest_rate_decision_all.js?v=1578582718
:return: 巴西利率决议报告-今值(%)
:rtype: pandas.Series
|
巴西利率决议报告, 数据区间从 20080201-至今
https://datacenter.jin10.com/reportType/dc_brazil_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_brazil_interest_rate_decision_all.js?v=1578582718
:return: 巴西利率决议报告-今值(%)
:rtype: pandas.Series
| 788 | 860 |
def macro_bank_brazil_interest_rate() -> pd.DataFrame:
"""
巴西利率决议报告, 数据区间从 20080201-至今
https://datacenter.jin10.com/reportType/dc_brazil_interest_rate_decision
https://cdn.jin10.com/dc/reports/dc_brazil_interest_rate_decision_all.js?v=1578582718
:return: 巴西利率决议报告-今值(%)
:rtype: pandas.Series
"""
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "55",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "巴西利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_bank.py#L788-L860
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.958904 |
[
8,
9,
24,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
48,
49,
50,
57,
66,
67,
68,
69,
70,
71,
72
] | 34.246575 | false | 5.414013 | 73 | 3 | 65.753425 | 5 |
def macro_bank_brazil_interest_rate() -> pd.DataFrame:
t = time.time()
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "55",
"_": str(int(round(t * 1000))),
}
big_df = pd.DataFrame()
while True:
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
if not data_json["data"]["values"]:
break
temp_df = pd.DataFrame(data_json["data"]["values"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
last_date_str = temp_df.iat[-1, 0]
last_date_str = (
(
datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
- datetime.timedelta(days=1)
)
.date()
.isoformat()
)
params.update({"max_date": f"{last_date_str}"})
big_df["商品"] = "巴西利率决议报告"
big_df.columns = [
"日期",
"今值",
"预测值",
"前值",
"商品",
]
big_df = big_df[
[
"商品",
"日期",
"今值",
"预测值",
"前值",
]
]
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.sort_values(["日期"], inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,081 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_gdp_yoy
|
()
|
return big_df
|
欧元区季度 GDP 年率报告, 数据区间从 20131114-至今
https://datacenter.jin10.com/reportType/dc_eurozone_gdp_yoy
:return: 欧元区季度 GDP 年率报告
:rtype: pandas.DataFrame
|
欧元区季度 GDP 年率报告, 数据区间从 20131114-至今
https://datacenter.jin10.com/reportType/dc_eurozone_gdp_yoy
:return: 欧元区季度 GDP 年率报告
:rtype: pandas.DataFrame
| 23 | 75 |
def macro_euro_gdp_yoy() -> pd.DataFrame:
"""
欧元区季度 GDP 年率报告, 数据区间从 20131114-至今
https://datacenter.jin10.com/reportType/dc_eurozone_gdp_yoy
:return: 欧元区季度 GDP 年率报告
:rtype: pandas.DataFrame
"""
ec = 84
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区季度GDP年率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L23-L75
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 13.207547 |
[
7,
8,
9,
10,
17,
18,
19,
20,
21,
22,
23,
24,
30,
36,
37,
38,
42,
44,
46,
47,
48,
49,
50,
51,
52
] | 47.169811 | false | 5.104408 | 53 | 4 | 52.830189 | 4 |
def macro_euro_gdp_yoy() -> pd.DataFrame:
ec = 84
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区季度GDP年率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,082 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_cpi_mom
|
()
|
return big_df
|
欧元区 CPI 月率报告, 数据区间从 19900301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_mom_all.js?v=1578578318
:return: 欧元区CPI月率报告
:rtype: pandas.Series
|
欧元区 CPI 月率报告, 数据区间从 19900301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_mom_all.js?v=1578578318
:return: 欧元区CPI月率报告
:rtype: pandas.Series
| 79 | 130 |
def macro_euro_cpi_mom() -> pd.DataFrame:
"""
欧元区 CPI 月率报告, 数据区间从 19900301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_mom_all.js?v=1578578318
:return: 欧元区CPI月率报告
:rtype: pandas.Series
"""
ec = 84
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区CPI月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L79-L130
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_cpi_mom() -> pd.DataFrame:
ec = 84
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区CPI月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,083 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_cpi_yoy
|
()
|
return big_df
|
欧元区CPI年率报告, 数据区间从19910201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_yoy
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_yoy_all.js?v=1578578404
:return: 欧元区CPI年率报告-今值(%)
:rtype: pandas.Series
|
欧元区CPI年率报告, 数据区间从19910201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_yoy
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_yoy_all.js?v=1578578404
:return: 欧元区CPI年率报告-今值(%)
:rtype: pandas.Series
| 134 | 185 |
def macro_euro_cpi_yoy() -> pd.DataFrame:
"""
欧元区CPI年率报告, 数据区间从19910201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_cpi_yoy
https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_yoy_all.js?v=1578578404
:return: 欧元区CPI年率报告-今值(%)
:rtype: pandas.Series
"""
ec = 8
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区CPI年率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L134-L185
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_cpi_yoy() -> pd.DataFrame:
ec = 8
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区CPI年率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,084 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_ppi_mom
|
()
|
return big_df
|
欧元区PPI月率报告, 数据区间从19810301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_ppi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_ppi_mom_all.js?v=1578578493
:return: 欧元区PPI月率报告-今值(%)
:rtype: pandas.Series
|
欧元区PPI月率报告, 数据区间从19810301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_ppi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_ppi_mom_all.js?v=1578578493
:return: 欧元区PPI月率报告-今值(%)
:rtype: pandas.Series
| 189 | 240 |
def macro_euro_ppi_mom() -> pd.DataFrame:
"""
欧元区PPI月率报告, 数据区间从19810301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_ppi_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_ppi_mom_all.js?v=1578578493
:return: 欧元区PPI月率报告-今值(%)
:rtype: pandas.Series
"""
ec = 36
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区PPI月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L189-L240
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_ppi_mom() -> pd.DataFrame:
ec = 36
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区PPI月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,085 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_retail_sales_mom
|
()
|
return big_df
|
欧元区零售销售月率报告, 数据区间从20000301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_retail_sales_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_retail_sales_mom_all.js?v=1578578576
:return: 欧元区零售销售月率报告-今值(%)
:rtype: pandas.Series
|
欧元区零售销售月率报告, 数据区间从20000301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_retail_sales_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_retail_sales_mom_all.js?v=1578578576
:return: 欧元区零售销售月率报告-今值(%)
:rtype: pandas.Series
| 244 | 295 |
def macro_euro_retail_sales_mom() -> pd.DataFrame:
"""
欧元区零售销售月率报告, 数据区间从20000301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_retail_sales_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_retail_sales_mom_all.js?v=1578578576
:return: 欧元区零售销售月率报告-今值(%)
:rtype: pandas.Series
"""
ec = 38
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区零售销售月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L244-L295
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_retail_sales_mom() -> pd.DataFrame:
ec = 38
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区零售销售月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,086 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_employment_change_qoq
|
()
|
return big_df
|
欧元区季调后就业人数季率报告, 数据区间从20083017-至今
https://datacenter.jin10.com/reportType/dc_eurozone_employment_change_qoq
https://cdn.jin10.com/dc/reports/dc_eurozone_employment_change_qoq_all.js?v=1578578699
:return: 欧元区季调后就业人数季率报告-今值(%)
:rtype: pandas.Series
|
欧元区季调后就业人数季率报告, 数据区间从20083017-至今
https://datacenter.jin10.com/reportType/dc_eurozone_employment_change_qoq
https://cdn.jin10.com/dc/reports/dc_eurozone_employment_change_qoq_all.js?v=1578578699
:return: 欧元区季调后就业人数季率报告-今值(%)
:rtype: pandas.Series
| 299 | 350 |
def macro_euro_employment_change_qoq() -> pd.DataFrame:
"""
欧元区季调后就业人数季率报告, 数据区间从20083017-至今
https://datacenter.jin10.com/reportType/dc_eurozone_employment_change_qoq
https://cdn.jin10.com/dc/reports/dc_eurozone_employment_change_qoq_all.js?v=1578578699
:return: 欧元区季调后就业人数季率报告-今值(%)
:rtype: pandas.Series
"""
ec = 14
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区季调后就业人数季率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L299-L350
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_employment_change_qoq() -> pd.DataFrame:
ec = 14
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区季调后就业人数季率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,087 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_unemployment_rate_mom
|
()
|
return big_df
|
欧元区失业率报告, 数据区间从19980501-至今
https://datacenter.jin10.com/reportType/dc_eurozone_unemployment_rate_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_unemployment_rate_mom_all.js?v=1578578767
:return: 欧元区失业率报告-今值(%)
:rtype: pandas.Series
|
欧元区失业率报告, 数据区间从19980501-至今
https://datacenter.jin10.com/reportType/dc_eurozone_unemployment_rate_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_unemployment_rate_mom_all.js?v=1578578767
:return: 欧元区失业率报告-今值(%)
:rtype: pandas.Series
| 354 | 405 |
def macro_euro_unemployment_rate_mom() -> pd.DataFrame:
"""
欧元区失业率报告, 数据区间从19980501-至今
https://datacenter.jin10.com/reportType/dc_eurozone_unemployment_rate_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_unemployment_rate_mom_all.js?v=1578578767
:return: 欧元区失业率报告-今值(%)
:rtype: pandas.Series
"""
ec = 46
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区失业率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L354-L405
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_unemployment_rate_mom() -> pd.DataFrame:
ec = 46
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区失业率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,088 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_trade_balance
|
()
|
return big_df
|
欧元区未季调贸易帐报告, 数据区间从19990201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_trade_balance_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_trade_balance_mom_all.js?v=1578577862
:return: 欧元区未季调贸易帐报告-今值(亿欧元)
:rtype: pandas.Series
|
欧元区未季调贸易帐报告, 数据区间从19990201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_trade_balance_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_trade_balance_mom_all.js?v=1578577862
:return: 欧元区未季调贸易帐报告-今值(亿欧元)
:rtype: pandas.Series
| 409 | 460 |
def macro_euro_trade_balance() -> pd.DataFrame:
"""
欧元区未季调贸易帐报告, 数据区间从19990201-至今
https://datacenter.jin10.com/reportType/dc_eurozone_trade_balance_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_trade_balance_mom_all.js?v=1578577862
:return: 欧元区未季调贸易帐报告-今值(亿欧元)
:rtype: pandas.Series
"""
ec = 43
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区未季调贸易帐"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L409-L460
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_trade_balance() -> pd.DataFrame:
ec = 43
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区未季调贸易帐"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,089 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_current_account_mom
|
()
|
return big_df
|
欧元区经常帐报告, 数据区间从20080221-至今, 前两个值需要去掉
https://datacenter.jin10.com/reportType/dc_eurozone_current_account_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_current_account_mom_all.js?v=1578577976
:return: 欧元区经常帐报告-今值(亿欧元)
:rtype: pandas.Series
|
欧元区经常帐报告, 数据区间从20080221-至今, 前两个值需要去掉
https://datacenter.jin10.com/reportType/dc_eurozone_current_account_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_current_account_mom_all.js?v=1578577976
:return: 欧元区经常帐报告-今值(亿欧元)
:rtype: pandas.Series
| 464 | 515 |
def macro_euro_current_account_mom() -> pd.DataFrame:
"""
欧元区经常帐报告, 数据区间从20080221-至今, 前两个值需要去掉
https://datacenter.jin10.com/reportType/dc_eurozone_current_account_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_current_account_mom_all.js?v=1578577976
:return: 欧元区经常帐报告-今值(亿欧元)
:rtype: pandas.Series
"""
ec = 11
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区经常帐"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L464-L515
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_current_account_mom() -> pd.DataFrame:
ec = 11
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区经常帐"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,090 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_industrial_production_mom
|
()
|
return big_df
|
欧元区工业产出月率报告, 数据区间从19910301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_industrial_production_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_industrial_production_mom_all.js?v=1578577377
:return: 欧元区工业产出月率报告-今值(%)
:rtype: pandas.Series
|
欧元区工业产出月率报告, 数据区间从19910301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_industrial_production_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_industrial_production_mom_all.js?v=1578577377
:return: 欧元区工业产出月率报告-今值(%)
:rtype: pandas.Series
| 519 | 570 |
def macro_euro_industrial_production_mom() -> pd.DataFrame:
"""
欧元区工业产出月率报告, 数据区间从19910301-至今
https://datacenter.jin10.com/reportType/dc_eurozone_industrial_production_mom
https://cdn.jin10.com/dc/reports/dc_eurozone_industrial_production_mom_all.js?v=1578577377
:return: 欧元区工业产出月率报告-今值(%)
:rtype: pandas.Series
"""
ec = 19
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区工业产出月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L519-L570
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_industrial_production_mom() -> pd.DataFrame:
ec = 19
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区工业产出月率"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,091 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_manufacturing_pmi
|
()
|
return big_df
|
欧元区制造业PMI初值报告, 数据区间从20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_manufacturing_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_manufacturing_pmi_all.js?v=1578577537
:return: 欧元区制造业PMI初值报告-今值
:rtype: pandas.Series
|
欧元区制造业PMI初值报告, 数据区间从20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_manufacturing_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_manufacturing_pmi_all.js?v=1578577537
:return: 欧元区制造业PMI初值报告-今值
:rtype: pandas.Series
| 574 | 625 |
def macro_euro_manufacturing_pmi() -> pd.DataFrame:
"""
欧元区制造业PMI初值报告, 数据区间从20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_manufacturing_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_manufacturing_pmi_all.js?v=1578577537
:return: 欧元区制造业PMI初值报告-今值
:rtype: pandas.Series
"""
ec = 30
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区制造业PMI初值"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L574-L625
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_manufacturing_pmi() -> pd.DataFrame:
ec = 30
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区制造业PMI初值"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,092 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_services_pmi
|
()
|
return big_df
|
欧元区服务业PMI终值报告, 数据区间从 20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_services_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_services_pmi_all.js?v=1578577639
:return: 欧元区服务业PMI终值报告-今值
:rtype: pandas.Series
|
欧元区服务业PMI终值报告, 数据区间从 20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_services_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_services_pmi_all.js?v=1578577639
:return: 欧元区服务业PMI终值报告-今值
:rtype: pandas.Series
| 629 | 680 |
def macro_euro_services_pmi() -> pd.DataFrame:
"""
欧元区服务业PMI终值报告, 数据区间从 20080222-至今
https://datacenter.jin10.com/reportType/dc_eurozone_services_pmi
https://cdn.jin10.com/dc/reports/dc_eurozone_services_pmi_all.js?v=1578577639
:return: 欧元区服务业PMI终值报告-今值
:rtype: pandas.Series
"""
ec = 41
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区服务业PMI终值"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L629-L680
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.384615 |
[
8,
9,
10,
11,
18,
19,
20,
21,
22,
23,
24,
25,
31,
37,
38,
39,
43,
44,
45,
46,
47,
48,
49,
50,
51
] | 48.076923 | false | 5.104408 | 52 | 4 | 51.923077 | 5 |
def macro_euro_services_pmi() -> pd.DataFrame:
ec = 41
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区服务业PMI终值"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,093 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_zew_economic_sentiment
|
()
|
return big_df
|
欧元区ZEW经济景气指数报告, 数据区间从20080212-至今
https://datacenter.jin10.com/reportType/dc_eurozone_zew_economic_sentiment
https://cdn.jin10.com/dc/reports/dc_eurozone_zew_economic_sentiment_all.js?v=1578577013
:return: 欧元区ZEW经济景气指数报告-今值
:rtype: pandas.Series
|
欧元区ZEW经济景气指数报告, 数据区间从20080212-至今
https://datacenter.jin10.com/reportType/dc_eurozone_zew_economic_sentiment
https://cdn.jin10.com/dc/reports/dc_eurozone_zew_economic_sentiment_all.js?v=1578577013
:return: 欧元区ZEW经济景气指数报告-今值
:rtype: pandas.Series
| 684 | 734 |
def macro_euro_zew_economic_sentiment() -> pd.DataFrame:
"""
欧元区ZEW经济景气指数报告, 数据区间从20080212-至今
https://datacenter.jin10.com/reportType/dc_eurozone_zew_economic_sentiment
https://cdn.jin10.com/dc/reports/dc_eurozone_zew_economic_sentiment_all.js?v=1578577013
:return: 欧元区ZEW经济景气指数报告-今值
:rtype: pandas.Series
"""
ec = 48
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区ZEW经济景气指数"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L684-L734
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.686275 |
[
8,
9,
10,
11,
17,
18,
19,
20,
21,
22,
23,
24,
30,
36,
37,
38,
42,
43,
44,
45,
46,
47,
48,
49,
50
] | 49.019608 | false | 5.104408 | 51 | 4 | 50.980392 | 5 |
def macro_euro_zew_economic_sentiment() -> pd.DataFrame:
ec = 48
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区ZEW经济景气指数"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,094 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_sentix_investor_confidence
|
()
|
return big_df
|
欧元区Sentix投资者信心指数报告, 数据区间从20020801-至今
https://datacenter.jin10.com/reportType/dc_eurozone_sentix_investor_confidence
https://cdn.jin10.com/dc/reports/dc_eurozone_sentix_investor_confidence_all.js?v=1578577195
:return: 欧元区Sentix投资者信心指数报告-今值
:rtype: pandas.Series
|
欧元区Sentix投资者信心指数报告, 数据区间从20020801-至今
https://datacenter.jin10.com/reportType/dc_eurozone_sentix_investor_confidence
https://cdn.jin10.com/dc/reports/dc_eurozone_sentix_investor_confidence_all.js?v=1578577195
:return: 欧元区Sentix投资者信心指数报告-今值
:rtype: pandas.Series
| 738 | 788 |
def macro_euro_sentix_investor_confidence() -> pd.DataFrame:
"""
欧元区Sentix投资者信心指数报告, 数据区间从20020801-至今
https://datacenter.jin10.com/reportType/dc_eurozone_sentix_investor_confidence
https://cdn.jin10.com/dc/reports/dc_eurozone_sentix_investor_confidence_all.js?v=1578577195
:return: 欧元区Sentix投资者信心指数报告-今值
:rtype: pandas.Series
"""
ec = 40
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区Sentix投资者信心指数"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L738-L788
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 15.686275 |
[
8,
9,
10,
11,
17,
18,
19,
20,
21,
22,
23,
24,
30,
36,
37,
38,
42,
43,
44,
45,
46,
47,
48,
49,
50
] | 49.019608 | false | 5.104408 | 51 | 4 | 50.980392 | 5 |
def macro_euro_sentix_investor_confidence() -> pd.DataFrame:
ec = 40
url = "https://datacenter-api.jin10.com/reports/dates"
params = {"category": "ec", "attr_id": ec, "_": "1667473128417"}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
date_list = data_json["data"]
date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0]
big_df = pd.DataFrame()
for date in tqdm(date_point_list, leave=False):
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": f"{date}",
"category": "ec",
"attr_id": ec,
"_": "1667475232449",
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["data"]["values"],
columns=[item["name"] for item in data_json["data"]["keys"]],
)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["商品"] = "欧元区Sentix投资者信心指数"
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_datetime(big_df["日期"]).dt.date
big_df.sort_values(["日期"], ignore_index=True, inplace=True)
return big_df
| 18,095 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_lme_holding
|
()
|
return big_df
|
伦敦金属交易所(LME)-持仓报告, 数据区间从 20151022-至今
https://datacenter.jin10.com/reportType/dc_lme_traders_report
https://cdn.jin10.com/data_center/reports/lme_position.json?_=1591533934658
:return: 伦敦金属交易所(LME)-持仓报告
:rtype: pandas.DataFrame
|
伦敦金属交易所(LME)-持仓报告, 数据区间从 20151022-至今
https://datacenter.jin10.com/reportType/dc_lme_traders_report
https://cdn.jin10.com/data_center/reports/lme_position.json?_=1591533934658
:return: 伦敦金属交易所(LME)-持仓报告
:rtype: pandas.DataFrame
| 792 | 815 |
def macro_euro_lme_holding() -> pd.DataFrame:
"""
伦敦金属交易所(LME)-持仓报告, 数据区间从 20151022-至今
https://datacenter.jin10.com/reportType/dc_lme_traders_report
https://cdn.jin10.com/data_center/reports/lme_position.json?_=1591533934658
:return: 伦敦金属交易所(LME)-持仓报告
:rtype: pandas.DataFrame
"""
t = time.time()
params = {"_": str(int(round(t * 1000)))}
r = requests.get(
"https://cdn.jin10.com/data_center/reports/lme_position.json", params=params
)
json_data = r.json()
temp_df = pd.DataFrame(json_data["values"]).T
temp_df.fillna(value="[0, 0, 0]", inplace=True)
big_df = pd.DataFrame()
for item in temp_df.columns:
for i in range(3):
inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i])
inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"]
big_df = pd.concat([big_df, inner_temp_df], axis=1)
big_df.sort_index(inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L792-L815
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 33.333333 |
[
8,
9,
10,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
] | 58.333333 | false | 5.104408 | 24 | 3 | 41.666667 | 5 |
def macro_euro_lme_holding() -> pd.DataFrame:
t = time.time()
params = {"_": str(int(round(t * 1000)))}
r = requests.get(
"https://cdn.jin10.com/data_center/reports/lme_position.json", params=params
)
json_data = r.json()
temp_df = pd.DataFrame(json_data["values"]).T
temp_df.fillna(value="[0, 0, 0]", inplace=True)
big_df = pd.DataFrame()
for item in temp_df.columns:
for i in range(3):
inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i])
inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"]
big_df = pd.concat([big_df, inner_temp_df], axis=1)
big_df.sort_index(inplace=True)
return big_df
| 18,096 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_euro.py
|
macro_euro_lme_stock
|
()
|
return big_df
|
伦敦金属交易所(LME)-库存报告, 数据区间从 20140702-至今
https://datacenter.jin10.com/reportType/dc_lme_report
https://cdn.jin10.com/data_center/reports/lme_stock.json?_=1591535304783
:return: 伦敦金属交易所(LME)-库存报告
:rtype: pandas.DataFrame
|
伦敦金属交易所(LME)-库存报告, 数据区间从 20140702-至今
https://datacenter.jin10.com/reportType/dc_lme_report
https://cdn.jin10.com/data_center/reports/lme_stock.json?_=1591535304783
:return: 伦敦金属交易所(LME)-库存报告
:rtype: pandas.DataFrame
| 819 | 841 |
def macro_euro_lme_stock() -> pd.DataFrame:
"""
伦敦金属交易所(LME)-库存报告, 数据区间从 20140702-至今
https://datacenter.jin10.com/reportType/dc_lme_report
https://cdn.jin10.com/data_center/reports/lme_stock.json?_=1591535304783
:return: 伦敦金属交易所(LME)-库存报告
:rtype: pandas.DataFrame
"""
t = time.time()
params = {"_": str(int(round(t * 1000)))}
r = requests.get(
"https://cdn.jin10.com/data_center/reports/lme_stock.json", params=params
)
json_data = r.json()
temp_df = pd.DataFrame(json_data["values"]).T
big_df = pd.DataFrame()
for item in temp_df.columns:
for i in range(3):
inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i])
inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"]
big_df = pd.concat([big_df, inner_temp_df], axis=1)
big_df.sort_index(inplace=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_euro.py#L819-L841
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 34.782609 |
[
8,
9,
10,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22
] | 56.521739 | false | 5.104408 | 23 | 3 | 43.478261 | 5 |
def macro_euro_lme_stock() -> pd.DataFrame:
t = time.time()
params = {"_": str(int(round(t * 1000)))}
r = requests.get(
"https://cdn.jin10.com/data_center/reports/lme_stock.json", params=params
)
json_data = r.json()
temp_df = pd.DataFrame(json_data["values"]).T
big_df = pd.DataFrame()
for item in temp_df.columns:
for i in range(3):
inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i])
inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"]
big_df = pd.concat([big_df, inner_temp_df], axis=1)
big_df.sort_index(inplace=True)
return big_df
| 18,097 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_qyspjg
|
()
|
return temp_df
|
东方财富-经济数据一览-中国-企业商品价格指数
https://data.eastmoney.com/cjsj/qyspjg.html
:return: 企业商品价格指数
:rtype: pandas.DataFrame
|
东方财富-经济数据一览-中国-企业商品价格指数
https://data.eastmoney.com/cjsj/qyspjg.html
:return: 企业商品价格指数
:rtype: pandas.DataFrame
| 33 | 102 |
def macro_china_qyspjg() -> pd.DataFrame:
"""
东方财富-经济数据一览-中国-企业商品价格指数
https://data.eastmoney.com/cjsj/qyspjg.html
:return: 企业商品价格指数
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,FARM_BASE,FARM_BASE_SAME,FARM_BASE_SEQUENTIAL,MINERAL_BASE,MINERAL_BASE_SAME,MINERAL_BASE_SEQUENTIAL,ENERGY_BASE,ENERGY_BASE_SAME,ENERGY_BASE_SEQUENTIAL",
"pageNumber": "1",
"pageSize": "2000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"reportName": "RPT_ECONOMY_GOODS_INDEX",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1669047266881",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(columns={
'REPORT_DATE': "-",
'TIME': "月份",
'BASE': "总指数-指数值",
'BASE_SAME': "总指数-同比增长",
'BASE_SEQUENTIAL': "总指数-环比增长",
'FARM_BASE': "农产品-指数值",
'FARM_BASE_SAME':"农产品-同比增长",
'FARM_BASE_SEQUENTIAL':"农产品-环比增长",
'MINERAL_BASE':"矿产品-指数值",
'MINERAL_BASE_SAME':"矿产品-同比增长",
'MINERAL_BASE_SEQUENTIAL':"矿产品-环比增长",
'ENERGY_BASE':"煤油电-指数值",
'ENERGY_BASE_SAME':"煤油电-同比增长",
'ENERGY_BASE_SEQUENTIAL': "煤油电-环比增长"
}, inplace=True)
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")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_china.py#L33-L102
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10 |
[
7,
8,
22,
23,
24,
25,
42,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69
] | 28.571429 | false | 5.033557 | 70 | 1 | 71.428571 | 4 |
def macro_china_qyspjg() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,FARM_BASE,FARM_BASE_SAME,FARM_BASE_SEQUENTIAL,MINERAL_BASE,MINERAL_BASE_SAME,MINERAL_BASE_SEQUENTIAL,ENERGY_BASE,ENERGY_BASE_SAME,ENERGY_BASE_SEQUENTIAL",
"pageNumber": "1",
"pageSize": "2000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"reportName": "RPT_ECONOMY_GOODS_INDEX",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1669047266881",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["result"]["data"])
temp_df.rename(columns={
'REPORT_DATE': "-",
'TIME': "月份",
'BASE': "总指数-指数值",
'BASE_SAME': "总指数-同比增长",
'BASE_SEQUENTIAL': "总指数-环比增长",
'FARM_BASE': "农产品-指数值",
'FARM_BASE_SAME':"农产品-同比增长",
'FARM_BASE_SEQUENTIAL':"农产品-环比增长",
'MINERAL_BASE':"矿产品-指数值",
'MINERAL_BASE_SAME':"矿产品-同比增长",
'MINERAL_BASE_SEQUENTIAL':"矿产品-环比增长",
'ENERGY_BASE':"煤油电-指数值",
'ENERGY_BASE_SAME':"煤油电-同比增长",
'ENERGY_BASE_SEQUENTIAL': "煤油电-环比增长"
}, inplace=True)
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")
return temp_df
| 18,098 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_fdi
|
()
|
return temp_df
|
东方财富-经济数据一览-中国-外商直接投资数据
https://data.eastmoney.com/cjsj/fdi.html
:return: 外商直接投资数据
:rtype: pandas.DataFrame
|
东方财富-经济数据一览-中国-外商直接投资数据
https://data.eastmoney.com/cjsj/fdi.html
:return: 外商直接投资数据
:rtype: pandas.DataFrame
| 106 | 154 |
def macro_china_fdi() -> pd.DataFrame:
"""
东方财富-经济数据一览-中国-外商直接投资数据
https://data.eastmoney.com/cjsj/fdi.html
:return: 外商直接投资数据
:rtype: pandas.DataFrame
"""
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"columns": "REPORT_DATE,TIME,ACTUAL_FOREIGN,ACTUAL_FOREIGN_SAME,ACTUAL_FOREIGN_SEQUENTIAL,ACTUAL_FOREIGN_ACCUMULATE,FOREIGN_ACCUMULATE_SAME",
"pageNumber": "1",
"pageSize": "2000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"reportName": "RPT_ECONOMY_FDI",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1669047266881",
}
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["当月"], 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/economic/macro_china.py#L106-L154
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.285714 |
[
7,
8,
22,
23,
24,
26,
35,
43,
44,
45,
46,
47,
48
] | 26.530612 | false | 5.033557 | 49 | 1 | 73.469388 | 4 |
def macro_china_fdi() -> pd.DataFrame:
url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
params = {
"columns": "REPORT_DATE,TIME,ACTUAL_FOREIGN,ACTUAL_FOREIGN_SAME,ACTUAL_FOREIGN_SEQUENTIAL,ACTUAL_FOREIGN_ACCUMULATE,FOREIGN_ACCUMULATE_SAME",
"pageNumber": "1",
"pageSize": "2000",
"sortColumns": "REPORT_DATE",
"sortTypes": "-1",
"source": "WEB",
"client": "WEB",
"reportName": "RPT_ECONOMY_FDI",
"p": "1",
"pageNo": "1",
"pageNum": "1",
"_": "1669047266881",
}
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["当月"], 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
| 18,099 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_shrzgm
|
()
|
return temp_df
|
商务数据中心-国内贸易-社会融资规模增量统计
http://data.mofcom.gov.cn/gnmy/shrzgm.shtml
:return: 社会融资规模增量统计
:rtype: pandas.DataFrame
|
商务数据中心-国内贸易-社会融资规模增量统计
http://data.mofcom.gov.cn/gnmy/shrzgm.shtml
:return: 社会融资规模增量统计
:rtype: pandas.DataFrame
| 158 | 203 |
def macro_china_shrzgm() -> pd.DataFrame:
"""
商务数据中心-国内贸易-社会融资规模增量统计
http://data.mofcom.gov.cn/gnmy/shrzgm.shtml
:return: 社会融资规模增量统计
:rtype: pandas.DataFrame
"""
url = "http://data.mofcom.gov.cn/datamofcom/front/gnmy/shrzgmQuery"
r = requests.post(url)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
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.sort_values(["月份"], inplace=True)
temp_df.reset_index(drop=True, inplace=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_china.py#L158-L203
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.217391 |
[
7,
8,
9,
10,
11,
22,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
] | 36.956522 | false | 5.033557 | 46 | 1 | 63.043478 | 4 |
def macro_china_shrzgm() -> pd.DataFrame:
url = "http://data.mofcom.gov.cn/datamofcom/front/gnmy/shrzgmQuery"
r = requests.post(url)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
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.sort_values(["月份"], inplace=True)
temp_df.reset_index(drop=True, inplace=True)
return temp_df
| 18,100 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_gdp_yearly
|
()
|
return temp_df
|
金十数据中心-中国 GDP 年率报告, 数据区间从 20110120-至今
https://datacenter.jin10.com/reportType/dc_chinese_gdp_yoy
:return: 中国 GDP 年率报告
:rtype: pandas.DataFrame
|
金十数据中心-中国 GDP 年率报告, 数据区间从 20110120-至今
https://datacenter.jin10.com/reportType/dc_chinese_gdp_yoy
:return: 中国 GDP 年率报告
:rtype: pandas.DataFrame
| 207 | 262 |
def macro_china_gdp_yearly() -> pd.DataFrame:
"""
金十数据中心-中国 GDP 年率报告, 数据区间从 20110120-至今
https://datacenter.jin10.com/reportType/dc_chinese_gdp_yoy
:return: 中国 GDP 年率报告
:rtype: pandas.DataFrame
"""
t = time.time()
r = requests.get(
JS_CHINA_GDP_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(r.text[r.text.find("{") : r.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国GDP年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "57",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = pd.concat([temp_df, temp_se])
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
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/economic/macro_china.py#L207-L262
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.5 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
27,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55
] | 44.642857 | false | 5.033557 | 56 | 3 | 55.357143 | 4 |
def macro_china_gdp_yearly() -> pd.DataFrame:
t = time.time()
r = requests.get(
JS_CHINA_GDP_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(r.text[r.text.find("{") : r.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国GDP年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "57",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = pd.concat([temp_df, temp_se])
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
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
| 18,101 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_cpi_yearly
|
()
|
return temp_df
|
中国年度 CPI 数据, 数据区间从 19860201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_yoy
:return: 中国年度 CPI 数据
:rtype: pandas.DataFrame
|
中国年度 CPI 数据, 数据区间从 19860201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_yoy
:return: 中国年度 CPI 数据
:rtype: pandas.DataFrame
| 266 | 320 |
def macro_china_cpi_yearly() -> pd.DataFrame:
"""
中国年度 CPI 数据, 数据区间从 19860201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_yoy
:return: 中国年度 CPI 数据
:rtype: pandas.DataFrame
"""
t = time.time()
res = requests.get(
JS_CHINA_CPI_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国CPI年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df["date"] = pd.to_datetime(date_list)
temp_df = value_df[["date", "今值(%)"]]
temp_df.columns = ["date", "value"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "56",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.columns = ["date", "value"]
temp_df = pd.concat([temp_df, temp_se], ignore_index=True)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.dropna(inplace=True)
temp_df.sort_values(["date"], inplace=True)
temp_df.drop_duplicates(subset="date", inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_china.py#L266-L320
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
28,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54
] | 43.636364 | false | 5.033557 | 55 | 3 | 56.363636 | 4 |
def macro_china_cpi_yearly() -> pd.DataFrame:
t = time.time()
res = requests.get(
JS_CHINA_CPI_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国CPI年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df["date"] = pd.to_datetime(date_list)
temp_df = value_df[["date", "今值(%)"]]
temp_df.columns = ["date", "value"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "56",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.columns = ["date", "value"]
temp_df = pd.concat([temp_df, temp_se], ignore_index=True)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df.dropna(inplace=True)
temp_df.sort_values(["date"], inplace=True)
temp_df.drop_duplicates(subset="date", inplace=True)
temp_df.reset_index(inplace=True, drop=True)
temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce")
return temp_df
| 18,102 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_cpi_monthly
|
()
|
return temp_df
|
中国月度 CPI 数据, 数据区间从 19960201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_mom
:return: 中国月度 CPI 数据
:rtype: pandas.Series
|
中国月度 CPI 数据, 数据区间从 19960201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_mom
:return: 中国月度 CPI 数据
:rtype: pandas.Series
| 324 | 381 |
def macro_china_cpi_monthly() -> pd.DataFrame:
"""
中国月度 CPI 数据, 数据区间从 19960201-至今
https://datacenter.jin10.com/reportType/dc_chinese_cpi_mom
:return: 中国月度 CPI 数据
:rtype: pandas.Series
"""
t = time.time()
res = requests.get(
JS_CHINA_CPI_MONTHLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国CPI月率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "72",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = temp_df.append(temp_se)
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
temp_df.set_index("index", inplace=True)
temp_df = temp_df.squeeze()
temp_df.index.name = None
temp_df.name = "cpi"
temp_df = temp_df.astype("float")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_china.py#L324-L381
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.068966 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
27,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57
] | 46.551724 | false | 5.033557 | 58 | 3 | 53.448276 | 4 |
def macro_china_cpi_monthly() -> pd.DataFrame:
t = time.time()
res = requests.get(
JS_CHINA_CPI_MONTHLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国CPI月率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "72",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = temp_df.append(temp_se)
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
temp_df.set_index("index", inplace=True)
temp_df = temp_df.squeeze()
temp_df.index.name = None
temp_df.name = "cpi"
temp_df = temp_df.astype("float")
return temp_df
| 18,103 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_china.py
|
macro_china_ppi_yearly
|
()
|
return temp_df
|
中国年度 PPI 数据, 数据区间从 19950801-至今
https://datacenter.jin10.com/reportType/dc_chinese_ppi_yoy
:return: 中国年度PPI数据
:rtype: pandas.Series
|
中国年度 PPI 数据, 数据区间从 19950801-至今
https://datacenter.jin10.com/reportType/dc_chinese_ppi_yoy
:return: 中国年度PPI数据
:rtype: pandas.Series
| 385 | 442 |
def macro_china_ppi_yearly() -> pd.DataFrame:
"""
中国年度 PPI 数据, 数据区间从 19950801-至今
https://datacenter.jin10.com/reportType/dc_chinese_ppi_yoy
:return: 中国年度PPI数据
:rtype: pandas.Series
"""
t = time.time()
res = requests.get(
JS_CHINA_PPI_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国PPI年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "60",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = temp_df.append(temp_se)
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
temp_df.set_index("index", inplace=True)
temp_df = temp_df.squeeze()
temp_df.index.name = None
temp_df.name = "ppi"
temp_df = temp_df.astype("float")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_china.py#L385-L442
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.068966 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
27,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57
] | 46.551724 | false | 5.033557 | 58 | 3 | 53.448276 | 4 |
def macro_china_ppi_yearly() -> pd.DataFrame:
t = time.time()
res = requests.get(
JS_CHINA_PPI_YEARLY_URL.format(
str(int(round(t * 1000))), str(int(round(t * 1000)) + 90)
)
)
json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1])
date_list = [item["date"] for item in json_data["list"]]
value_list = [item["datas"]["中国PPI年率报告"] for item in json_data["list"]]
value_df = pd.DataFrame(value_list)
value_df.columns = json_data["kinds"]
value_df.index = pd.to_datetime(date_list)
temp_df = value_df["今值(%)"]
url = "https://datacenter-api.jin10.com/reports/list_v2"
params = {
"max_date": "",
"category": "ec",
"attr_id": "60",
"_": str(int(round(t * 1000))),
}
headers = {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"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",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
temp_se = pd.DataFrame(r.json()["data"]["values"]).iloc[:, :2]
temp_se.index = pd.to_datetime(temp_se.iloc[:, 0])
temp_se = temp_se.iloc[:, 1]
temp_df = temp_df.append(temp_se)
temp_df.dropna(inplace=True)
temp_df.sort_index(inplace=True)
temp_df = temp_df.reset_index()
temp_df.drop_duplicates(subset="index", inplace=True)
temp_df.set_index("index", inplace=True)
temp_df = temp_df.squeeze()
temp_df.index.name = None
temp_df.name = "ppi"
temp_df = temp_df.astype("float")
return temp_df
| 18,104 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/marco_cnbs.py
|
macro_cnbs
|
()
|
return temp_df
|
国家金融与发展实验室-中国宏观杠杆率数据
http://114.115.232.154:8080/
:return: 中国宏观杠杆率数据
:rtype: pandas.DataFrame
|
国家金融与发展实验室-中国宏观杠杆率数据
http://114.115.232.154:8080/
:return: 中国宏观杠杆率数据
:rtype: pandas.DataFrame
| 11 | 43 |
def macro_cnbs() -> pd.DataFrame:
"""
国家金融与发展实验室-中国宏观杠杆率数据
http://114.115.232.154:8080/
:return: 中国宏观杠杆率数据
:rtype: pandas.DataFrame
"""
url = "http://114.115.232.154:8080/handler/download.ashx"
temp_df = pd.read_excel(
url, sheet_name="Data", header=0, skiprows=1, engine="openpyxl"
)
temp_df["Period"] = pd.to_datetime(temp_df["Period"]).dt.strftime("%Y-%m")
temp_df.dropna(axis=1, inplace=True)
temp_df.columns = [
"年份",
"居民部门",
"非金融企业部门",
"政府部门",
"中央政府",
"地方政府",
"实体经济部门",
"金融部门资产方",
"金融部门负债方",
]
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/economic/marco_cnbs.py#L11-L43
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 21.212121 |
[
7,
8,
11,
12,
13,
24,
25,
26,
27,
28,
29,
30,
31,
32
] | 42.424242 | false | 20 | 33 | 1 | 57.575758 | 4 |
def macro_cnbs() -> pd.DataFrame:
url = "http://114.115.232.154:8080/handler/download.ashx"
temp_df = pd.read_excel(
url, sheet_name="Data", header=0, skiprows=1, engine="openpyxl"
)
temp_df["Period"] = pd.to_datetime(temp_df["Period"]).dt.strftime("%Y-%m")
temp_df.dropna(axis=1, inplace=True)
temp_df.columns = [
"年份",
"居民部门",
"非金融企业部门",
"政府部门",
"中央政府",
"地方政府",
"实体经济部门",
"金融部门资产方",
"金融部门负债方",
]
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
| 18,105 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_other.py
|
crypto_js_spot
|
()
|
return data_df
|
主流加密货币的实时行情数据, 一次请求返回具体某一时刻行情数据
https://datacenter.jin10.com/reportType/dc_bitcoin_current
:return: pandas.DataFrame
|
主流加密货币的实时行情数据, 一次请求返回具体某一时刻行情数据
https://datacenter.jin10.com/reportType/dc_bitcoin_current
:return: pandas.DataFrame
| 14 | 52 |
def crypto_js_spot() -> pd.DataFrame:
"""
主流加密货币的实时行情数据, 一次请求返回具体某一时刻行情数据
https://datacenter.jin10.com/reportType/dc_bitcoin_current
:return: pandas.DataFrame
"""
url = "https://datacenter-api.jin10.com/crypto_currency/list"
params = {
"_": '1672141224307',
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_df = pd.DataFrame(data_json["data"])
data_df["reported_at"] = pd.to_datetime(data_df["reported_at"])
data_df.columns = [
"市场",
"交易品种",
"最近报价",
"涨跌额",
"涨跌幅",
"24小时最高",
"24小时最低",
"24小时成交量",
"更新时间",
]
data_df["最近报价"] = pd.to_numeric(data_df["最近报价"])
data_df["涨跌额"] = pd.to_numeric(data_df["涨跌额"])
data_df["涨跌幅"] = pd.to_numeric(data_df["涨跌幅"])
data_df["24小时最高"] = pd.to_numeric(data_df["24小时最高"])
data_df["24小时最低"] = pd.to_numeric(data_df["24小时最低"])
data_df["24小时成交量"] = pd.to_numeric(data_df["24小时成交量"])
data_df["更新时间"] = data_df["更新时间"].astype(str)
return data_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_other.py#L14-L52
| 25 |
[
0,
1,
2,
3,
4,
5
] | 15.384615 |
[
6,
7,
10,
16,
17,
18,
19,
20,
31,
32,
33,
34,
35,
36,
37,
38
] | 41.025641 | false | 16.071429 | 39 | 1 | 58.974359 | 3 |
def crypto_js_spot() -> pd.DataFrame:
url = "https://datacenter-api.jin10.com/crypto_currency/list"
params = {
"_": '1672141224307',
}
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "x-csrf-token",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_df = pd.DataFrame(data_json["data"])
data_df["reported_at"] = pd.to_datetime(data_df["reported_at"])
data_df.columns = [
"市场",
"交易品种",
"最近报价",
"涨跌额",
"涨跌幅",
"24小时最高",
"24小时最低",
"24小时成交量",
"更新时间",
]
data_df["最近报价"] = pd.to_numeric(data_df["最近报价"])
data_df["涨跌额"] = pd.to_numeric(data_df["涨跌额"])
data_df["涨跌幅"] = pd.to_numeric(data_df["涨跌幅"])
data_df["24小时最高"] = pd.to_numeric(data_df["24小时最高"])
data_df["24小时最低"] = pd.to_numeric(data_df["24小时最低"])
data_df["24小时成交量"] = pd.to_numeric(data_df["24小时成交量"])
data_df["更新时间"] = data_df["更新时间"].astype(str)
return data_df
| 18,106 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_other.py
|
macro_fx_sentiment
|
(
start_date: str = "20221011", end_date: str = "20221017"
)
|
return temp_df
|
金十数据-外汇-投机情绪报告
外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
报告内容: 品种: 澳元兑日元、澳元兑美元、欧元兑美元、欧元兑澳元、欧元兑日元、英镑兑美元、英镑兑日元、纽元兑美元、美元兑加元、美元兑瑞郎、美元兑日元以及现货黄金兑美元。
数据: 由Shark - fx整合全球8家交易平台( 包括 Oanda、 FXCM、 Insta、 Dukas、 MyFxBook以及FiboGroup) 的多空投机仓位数据而成。
名词释义: 外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
工具使用策略: Shark-fx声明表示,基于“主流通常都是错误的”的事实,当空头头寸超过60%,交易者就应该建立多头仓位; 同理,当市场多头头寸超过60%,交易者则应该建立空头仓位。此外,当多空仓位比例接近50%的情况下,我们则倾向于建议交易者不要进场,保持观望。
https://datacenter.jin10.com/reportType/dc_ssi_trends
:param start_date: 具体交易日
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同
:type end_date: str
:return: 投机情绪报告
:rtype: pandas.DataFrame
|
金十数据-外汇-投机情绪报告
外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
报告内容: 品种: 澳元兑日元、澳元兑美元、欧元兑美元、欧元兑澳元、欧元兑日元、英镑兑美元、英镑兑日元、纽元兑美元、美元兑加元、美元兑瑞郎、美元兑日元以及现货黄金兑美元。
数据: 由Shark - fx整合全球8家交易平台( 包括 Oanda、 FXCM、 Insta、 Dukas、 MyFxBook以及FiboGroup) 的多空投机仓位数据而成。
名词释义: 外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
工具使用策略: Shark-fx声明表示,基于“主流通常都是错误的”的事实,当空头头寸超过60%,交易者就应该建立多头仓位; 同理,当市场多头头寸超过60%,交易者则应该建立空头仓位。此外,当多空仓位比例接近50%的情况下,我们则倾向于建议交易者不要进场,保持观望。
https://datacenter.jin10.com/reportType/dc_ssi_trends
:param start_date: 具体交易日
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同
:type end_date: str
:return: 投机情绪报告
:rtype: pandas.DataFrame
| 55 | 104 |
def macro_fx_sentiment(
start_date: str = "20221011", end_date: str = "20221017"
) -> pd.DataFrame:
"""
金十数据-外汇-投机情绪报告
外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
报告内容: 品种: 澳元兑日元、澳元兑美元、欧元兑美元、欧元兑澳元、欧元兑日元、英镑兑美元、英镑兑日元、纽元兑美元、美元兑加元、美元兑瑞郎、美元兑日元以及现货黄金兑美元。
数据: 由Shark - fx整合全球8家交易平台( 包括 Oanda、 FXCM、 Insta、 Dukas、 MyFxBook以及FiboGroup) 的多空投机仓位数据而成。
名词释义: 外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。
工具使用策略: Shark-fx声明表示,基于“主流通常都是错误的”的事实,当空头头寸超过60%,交易者就应该建立多头仓位; 同理,当市场多头头寸超过60%,交易者则应该建立空头仓位。此外,当多空仓位比例接近50%的情况下,我们则倾向于建议交易者不要进场,保持观望。
https://datacenter.jin10.com/reportType/dc_ssi_trends
:param start_date: 具体交易日
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同
:type end_date: str
:return: 投机情绪报告
:rtype: pandas.DataFrame
"""
start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]])
url = "https://datacenter-api.jin10.com/sentiment/datas"
params = {
"start_date": start_date,
"end_date": end_date,
"currency_pair": "",
"_": int(time.time() * 1000),
}
headers = {
"accept": "*/*",
"accept-encoding": "",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_ssi_trends",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["values"]).T
temp_df.reset_index(inplace=True)
temp_df.rename(columns={"index": "date"}, inplace=True)
for col in temp_df.columns[1:]:
temp_df[col] = pd.to_numeric(temp_df[col], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_other.py#L55-L104
| 25 |
[
0
] | 2 |
[
18,
19,
20,
21,
27,
42,
43,
44,
45,
46,
47,
48,
49
] | 26 | false | 16.071429 | 50 | 2 | 74 | 13 |
def macro_fx_sentiment(
start_date: str = "20221011", end_date: str = "20221017"
) -> pd.DataFrame:
start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]])
url = "https://datacenter-api.jin10.com/sentiment/datas"
params = {
"start_date": start_date,
"end_date": end_date,
"currency_pair": "",
"_": int(time.time() * 1000),
}
headers = {
"accept": "*/*",
"accept-encoding": "",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_ssi_trends",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["values"]).T
temp_df.reset_index(inplace=True)
temp_df.rename(columns={"index": "date"}, inplace=True)
for col in temp_df.columns[1:]:
temp_df[col] = pd.to_numeric(temp_df[col], errors="coerce")
return temp_df
| 18,107 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/economic/macro_other.py
|
index_vix
|
(
start_date: str = "20210401", end_date: str = "20210402"
)
|
return temp_df
|
金十数据-市场异动-恐慌指数; 只能获取当前交易日近一个月内的数据
https://datacenter.jin10.com/market
:param start_date: 具体交易日, 只能获取当前交易日近一个月内的数据
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同, 只能获取当前交易日近一个月内的数据
:type end_date: str
:return: 恐慌指数
:rtype: pandas.DataFrame
|
金十数据-市场异动-恐慌指数; 只能获取当前交易日近一个月内的数据
https://datacenter.jin10.com/market
:param start_date: 具体交易日, 只能获取当前交易日近一个月内的数据
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同, 只能获取当前交易日近一个月内的数据
:type end_date: str
:return: 恐慌指数
:rtype: pandas.DataFrame
| 107 | 151 |
def index_vix(
start_date: str = "20210401", end_date: str = "20210402"
) -> pd.DataFrame:
"""
金十数据-市场异动-恐慌指数; 只能获取当前交易日近一个月内的数据
https://datacenter.jin10.com/market
:param start_date: 具体交易日, 只能获取当前交易日近一个月内的数据
:type start_date: str
:param end_date: 具体交易日, 与 end_date 相同, 只能获取当前交易日近一个月内的数据
:type end_date: str
:return: 恐慌指数
:rtype: pandas.DataFrame
"""
import warnings
warnings.warn("由于目标网站未更新数据,该接口即将移除", DeprecationWarning)
url = "https://datacenter-api.jin10.com/vix/datas"
start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]])
params = {
"start_date": start_date,
"end_date": end_date,
"_": int(time.time() * 1000),
}
headers = {
"accept": "*/*",
"accept-encoding": "",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_ssi_trends",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
res = requests.get(url, params=params, headers=headers)
temp_df = pd.DataFrame(
res.json()["data"]["values"], index=["开盘价", "当前价", "涨跌", "涨跌幅"]
).T
temp_df = temp_df.astype(float)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/economic/macro_other.py#L107-L151
| 25 |
[
0
] | 2.222222 |
[
13,
15,
16,
17,
18,
19,
24,
39,
40,
43,
44
] | 24.444444 | false | 16.071429 | 45 | 1 | 75.555556 | 8 |
def index_vix(
start_date: str = "20210401", end_date: str = "20210402"
) -> pd.DataFrame:
import warnings
warnings.warn("由于目标网站未更新数据,该接口即将移除", DeprecationWarning)
url = "https://datacenter-api.jin10.com/vix/datas"
start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]])
params = {
"start_date": start_date,
"end_date": end_date,
"_": int(time.time() * 1000),
}
headers = {
"accept": "*/*",
"accept-encoding": "",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"cache-control": "no-cache",
"origin": "https://datacenter.jin10.com",
"pragma": "no-cache",
"referer": "https://datacenter.jin10.com/reportType/dc_ssi_trends",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
"x-app-id": "rU6QIu7JHe2gOUeR",
"x-csrf-token": "",
"x-version": "1.0.0",
}
res = requests.get(url, params=params, headers=headers)
temp_df = pd.DataFrame(
res.json()["data"]["values"], index=["开盘价", "当前价", "涨跌", "涨跌幅"]
).T
temp_df = temp_df.astype(float)
return temp_df
| 18,108 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
_get_file_content
|
(file: str = "covid.js")
|
return file_data
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
|
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
| 21 | 32 |
def _get_file_content(file: str = "covid.js") -> str:
"""
获取 JS 文件的内容
:param file: JS 文件名
:type file: str
:return: 文件内容
:rtype: str
"""
setting_file_path = get_covid_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/event/covid.py#L21-L32
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 66.666667 |
[
8,
9,
10,
11
] | 33.333333 | false | 6.904762 | 12 | 2 | 66.666667 | 5 |
def _get_file_content(file: str = "covid.js") -> str:
setting_file_path = get_covid_js(file)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 18,109 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_risk_area
|
(symbol: str = "高风险等级地区") -> pd.DataFra
|
卫生健康委-疫情风险等级查询
http://bmfw.www.gov.cn/yqfxdjcx/risk.html
:param symbol: choice of {"高风险等级地区", "中风险等级地区", "低风险等级地区"}
:type symbol: str
:return: 疫情风险等级查询
:rtype: pandas.DataFrame
|
卫生健康委-疫情风险等级查询
http://bmfw.www.gov.cn/yqfxdjcx/risk.html
:param symbol: choice of {"高风险等级地区", "中风险等级地区", "低风险等级地区"}
:type symbol: str
:return: 疫情风险等级查询
:rtype: pandas.DataFrame
| 35 | 104 |
def covid_19_risk_area(symbol: str = "高风险等级地区") -> pd.DataFrame:
"""
卫生健康委-疫情风险等级查询
http://bmfw.www.gov.cn/yqfxdjcx/risk.html
:param symbol: choice of {"高风险等级地区", "中风险等级地区", "低风险等级地区"}
:type symbol: str
:return: 疫情风险等级查询
:rtype: pandas.DataFrame
"""
file_data = _get_file_content(file="covid.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
decode_ajax_dict = ctx.call("generateAjaxParmas", "xxx")
decode_header_dict = ctx.call("generateHeaderParmas", "xxx")
url = "http://bmfw.www.gov.cn/bjww/interface/interfaceJson"
payload = {
"appId": "NcApplication",
"key": "3C502C97ABDA40D0A60FBEE50FAAD1DA",
"nonceHeader": "123456789abcdefg",
"paasHeader": "zdww",
"signatureHeader": eval(decode_ajax_dict)["signatureHeader"],
"timestampHeader": eval(decode_ajax_dict)["timestampHeader"],
}
headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "235",
"Content-Type": "application/json; charset=UTF-8",
"Host": "bmfw.www.gov.cn",
"Origin": "http://bmfw.www.gov.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://bmfw.www.gov.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
"x-wif-nonce": "QkjjtiLM2dCratiA",
"x-wif-paasid": "smt-application",
"x-wif-signature": eval(decode_header_dict)["signatureHeader"],
"x-wif-timestamp": eval(decode_header_dict)["timestampHeader"],
}
r = requests.post(url, json=payload, headers=headers)
data_json = r.json()
if symbol == "高风险等级地区":
temp_df = pd.DataFrame(data_json["data"]["highlist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "高风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["hcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
elif symbol == "低风险等级地区":
temp_df = pd.DataFrame(data_json["data"]["lowlist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "低风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["lcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
else:
temp_df = pd.DataFrame(data_json["data"]["middlelist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "中风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["mcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L35-L104
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 12.857143 |
[
9,
10,
11,
12,
13,
14,
15,
23,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
62,
63,
64,
65,
66,
67,
68,
69
] | 51.428571 | false | 6.904762 | 70 | 3 | 48.571429 | 6 |
def covid_19_risk_area(symbol: str = "高风险等级地区") -> pd.DataFrame:
file_data = _get_file_content(file="covid.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
decode_ajax_dict = ctx.call("generateAjaxParmas", "xxx")
decode_header_dict = ctx.call("generateHeaderParmas", "xxx")
url = "http://bmfw.www.gov.cn/bjww/interface/interfaceJson"
payload = {
"appId": "NcApplication",
"key": "3C502C97ABDA40D0A60FBEE50FAAD1DA",
"nonceHeader": "123456789abcdefg",
"paasHeader": "zdww",
"signatureHeader": eval(decode_ajax_dict)["signatureHeader"],
"timestampHeader": eval(decode_ajax_dict)["timestampHeader"],
}
headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "235",
"Content-Type": "application/json; charset=UTF-8",
"Host": "bmfw.www.gov.cn",
"Origin": "http://bmfw.www.gov.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://bmfw.www.gov.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
"x-wif-nonce": "QkjjtiLM2dCratiA",
"x-wif-paasid": "smt-application",
"x-wif-signature": eval(decode_header_dict)["signatureHeader"],
"x-wif-timestamp": eval(decode_header_dict)["timestampHeader"],
}
r = requests.post(url, json=payload, headers=headers)
data_json = r.json()
if symbol == "高风险等级地区":
temp_df = pd.DataFrame(data_json["data"]["highlist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "高风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["hcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
elif symbol == "低风险等级地区":
temp_df = pd.DataFrame(data_json["data"]["lowlist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "低风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["lcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
else:
temp_df = pd.DataFrame(data_json["data"]["middlelist"])
temp_df = temp_df.explode(["communitys"])
del temp_df["type"]
temp_df["grade"] = "中风险"
temp_df["report_date"] = data_json["data"]["end_update_time"]
temp_df["number"] = data_json["data"]["mcount"]
temp_df.reset_index(inplace=True, drop=True)
return temp_df
| 18,110 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_163
|
(indicator: str = "实时") ->
|
网易-新型冠状病毒
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&#map_block
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&
:param indicator: 参数
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
|
网易-新型冠状病毒
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&#map_block
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&
:param indicator: 参数
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
| 107 | 302 |
def covid_19_163(indicator: str = "实时") -> pd.DataFrame:
"""
网易-新型冠状病毒
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&#map_block
https://news.163.com/special/epidemic/?spssid=93326430940df93a37229666dfbc4b96&spsw=4&spss=other&
:param indicator: 参数
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
"""
url = "https://c.m.163.com/ug/api/wuhan/app/data/list-total"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
}
payload = {
"t": int(time.time() * 1000),
}
r = requests.get(url, params=payload, headers=headers)
data_json = r.json()
# data info
url = "https://news.163.com/special/epidemic/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
data_info_df = pd.DataFrame(
[
item.text.strip().split(".")[1]
for item in soup.find(
"div", attrs={"class": "data_tip_pop_text"}
).find_all("p")
]
)
data_info_df.columns = ["info"]
# 中国历史时点数据
hist_today_df = pd.DataFrame(
[item["today"] for item in data_json["data"]["chinaDayList"]],
index=[item["date"] for item in data_json["data"]["chinaDayList"]],
)
# 中国历史累计数据
hist_total_df = pd.DataFrame(
[item["total"] for item in data_json["data"]["chinaDayList"]],
index=[item["date"] for item in data_json["data"]["chinaDayList"]],
)
# 中国实时数据
current_df = pd.DataFrame.from_dict(data_json["data"]["chinaTotal"])
# 世界历史时点数据
outside_today_df = pd.DataFrame(
[item["today"] for item in data_json["data"]["areaTree"]],
index=[item["name"] for item in data_json["data"]["areaTree"]],
)
# 世界历史累计数据
outside_total_df = pd.DataFrame(
[item["total"] for item in data_json["data"]["areaTree"]],
index=[item["name"] for item in data_json["data"]["areaTree"]],
)
# 全球所有国家及地区时点数据
all_world_today_df = pd.DataFrame(
jsonpath.jsonpath(data_json["data"]["areaTree"], "$..today"),
index=jsonpath.jsonpath(data_json["data"]["areaTree"], "$..name"),
)
# 全球所有国家及地区累计数据
all_world_total_df = pd.DataFrame(
jsonpath.jsonpath(data_json["data"]["areaTree"], "$..total"),
index=jsonpath.jsonpath(data_json["data"]["areaTree"], "$..name"),
)
# 中国各地区累计数据
area_total_df = pd.DataFrame(
[
item["total"]
for item in data_json["data"]["areaTree"][2]["children"]
],
index=[
item["name"]
for item in data_json["data"]["areaTree"][2]["children"]
],
)
# 中国各地区时点数据
area_today_df = pd.DataFrame(
[
item["today"]
for item in data_json["data"]["areaTree"][2]["children"]
],
index=[
item["name"]
for item in data_json["data"]["areaTree"][2]["children"]
],
)
# 疫情学术进展
url_article = "https://vip.open.163.com/api/cms/topic/list"
payload_article = {
"topicid": "00019NGQ",
"listnum": "1000",
"liststart": "0",
"pointstart": "0",
"pointend": "255",
"useproperty": "true",
}
r_article = requests.get(url_article, params=payload_article)
article_df = pd.DataFrame(r_article.json()["data"]).iloc[:, 1:]
# 资讯
url_info = "https://ent.163.com/special/00035080/virus_report_data.js"
payload_info = {
"_": int(time.time() * 1000),
"callback": "callback",
}
r_info = requests.get(url_info, params=payload_info, headers=headers)
data_info_text = r_info.text
data_info_json = demjson.decode(data_info_text.strip(" callback(")[:-1])
if indicator == "数据说明":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return data_info_df
if indicator == "中国实时数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return current_df
if indicator == "中国历史时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return hist_today_df
if indicator == "中国历史累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return hist_total_df
if indicator == "世界历史时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return outside_today_df
if indicator == "世界历史累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return outside_total_df
if indicator == "全球所有国家及地区时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return all_world_today_df
elif indicator == "全球所有国家及地区累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return all_world_total_df
elif indicator == "中国各地区时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return area_today_df
elif indicator == "中国各地区累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return area_total_df
elif indicator == "疫情学术进展":
return article_df
elif indicator == "实时资讯新闻播报":
return pd.DataFrame(data_info_json["list"])
elif indicator == "实时医院新闻播报":
return pd.DataFrame(data_info_json["hospital"])
elif indicator == "前沿知识":
return pd.DataFrame(data_info_json["papers"])
elif indicator == "权威发布":
return pd.DataFrame(data_info_json["power"])
elif indicator == "境外输入疫情趋势":
url = "https://c.m.163.com/ug/api/wuhan/app/data/list-by-area-code"
params = {"areaCode": "66", "t": round(int(time.time() * 1000))}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
today_list = [item.get("input", 0) for item in temp_df["today"]]
total_list = [item.get("input", 0) for item in temp_df["total"]]
result_df = pd.DataFrame([today_list, total_list]).T
result_df.columns = ["境外输入新增确诊", "境外输入累计确诊"]
result_df.index = pd.to_datetime(temp_df.date)
return result_df
elif indicator == "境外输入确诊病例来源":
url = "https://c.m.163.com/ug/api/wuhan/app/index/input-data-list"
params = {"t": round(int(time.time() * 1000))}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
del temp_df["page"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L107-L302
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 5.102041 |
[
10,
11,
14,
17,
18,
21,
22,
23,
24,
32,
35,
41,
47,
50,
56,
62,
68,
74,
86,
98,
99,
107,
108,
111,
112,
116,
117,
118,
120,
121,
122,
124,
125,
126,
128,
129,
130,
132,
133,
134,
136,
137,
138,
140,
141,
142,
144,
145,
146,
148,
149,
150,
152,
153,
154,
156,
157,
158,
160,
161,
163,
164,
166,
167,
169,
170,
172,
173,
175,
176,
177,
178,
179,
180,
181,
182,
183,
184,
185,
186,
188,
189,
190,
191,
192,
193,
194,
195
] | 44.897959 | false | 6.904762 | 196 | 33 | 55.102041 | 7 |
def covid_19_163(indicator: str = "实时") -> pd.DataFrame:
url = "https://c.m.163.com/ug/api/wuhan/app/data/list-total"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
}
payload = {
"t": int(time.time() * 1000),
}
r = requests.get(url, params=payload, headers=headers)
data_json = r.json()
# data info
url = "https://news.163.com/special/epidemic/"
r = requests.get(url, headers=headers)
soup = BeautifulSoup(r.text, "lxml")
data_info_df = pd.DataFrame(
[
item.text.strip().split(".")[1]
for item in soup.find(
"div", attrs={"class": "data_tip_pop_text"}
).find_all("p")
]
)
data_info_df.columns = ["info"]
# 中国历史时点数据
hist_today_df = pd.DataFrame(
[item["today"] for item in data_json["data"]["chinaDayList"]],
index=[item["date"] for item in data_json["data"]["chinaDayList"]],
)
# 中国历史累计数据
hist_total_df = pd.DataFrame(
[item["total"] for item in data_json["data"]["chinaDayList"]],
index=[item["date"] for item in data_json["data"]["chinaDayList"]],
)
# 中国实时数据
current_df = pd.DataFrame.from_dict(data_json["data"]["chinaTotal"])
# 世界历史时点数据
outside_today_df = pd.DataFrame(
[item["today"] for item in data_json["data"]["areaTree"]],
index=[item["name"] for item in data_json["data"]["areaTree"]],
)
# 世界历史累计数据
outside_total_df = pd.DataFrame(
[item["total"] for item in data_json["data"]["areaTree"]],
index=[item["name"] for item in data_json["data"]["areaTree"]],
)
# 全球所有国家及地区时点数据
all_world_today_df = pd.DataFrame(
jsonpath.jsonpath(data_json["data"]["areaTree"], "$..today"),
index=jsonpath.jsonpath(data_json["data"]["areaTree"], "$..name"),
)
# 全球所有国家及地区累计数据
all_world_total_df = pd.DataFrame(
jsonpath.jsonpath(data_json["data"]["areaTree"], "$..total"),
index=jsonpath.jsonpath(data_json["data"]["areaTree"], "$..name"),
)
# 中国各地区累计数据
area_total_df = pd.DataFrame(
[
item["total"]
for item in data_json["data"]["areaTree"][2]["children"]
],
index=[
item["name"]
for item in data_json["data"]["areaTree"][2]["children"]
],
)
# 中国各地区时点数据
area_today_df = pd.DataFrame(
[
item["today"]
for item in data_json["data"]["areaTree"][2]["children"]
],
index=[
item["name"]
for item in data_json["data"]["areaTree"][2]["children"]
],
)
# 疫情学术进展
url_article = "https://vip.open.163.com/api/cms/topic/list"
payload_article = {
"topicid": "00019NGQ",
"listnum": "1000",
"liststart": "0",
"pointstart": "0",
"pointend": "255",
"useproperty": "true",
}
r_article = requests.get(url_article, params=payload_article)
article_df = pd.DataFrame(r_article.json()["data"]).iloc[:, 1:]
# 资讯
url_info = "https://ent.163.com/special/00035080/virus_report_data.js"
payload_info = {
"_": int(time.time() * 1000),
"callback": "callback",
}
r_info = requests.get(url_info, params=payload_info, headers=headers)
data_info_text = r_info.text
data_info_json = demjson.decode(data_info_text.strip(" callback(")[:-1])
if indicator == "数据说明":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return data_info_df
if indicator == "中国实时数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return current_df
if indicator == "中国历史时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return hist_today_df
if indicator == "中国历史累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return hist_total_df
if indicator == "世界历史时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return outside_today_df
if indicator == "世界历史累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return outside_total_df
if indicator == "全球所有国家及地区时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return all_world_today_df
elif indicator == "全球所有国家及地区累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return all_world_total_df
elif indicator == "中国各地区时点数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return area_today_df
elif indicator == "中国各地区累计数据":
print(f"数据更新时间: {data_json['data']['lastUpdateTime']}")
return area_total_df
elif indicator == "疫情学术进展":
return article_df
elif indicator == "实时资讯新闻播报":
return pd.DataFrame(data_info_json["list"])
elif indicator == "实时医院新闻播报":
return pd.DataFrame(data_info_json["hospital"])
elif indicator == "前沿知识":
return pd.DataFrame(data_info_json["papers"])
elif indicator == "权威发布":
return pd.DataFrame(data_info_json["power"])
elif indicator == "境外输入疫情趋势":
url = "https://c.m.163.com/ug/api/wuhan/app/data/list-by-area-code"
params = {"areaCode": "66", "t": round(int(time.time() * 1000))}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
today_list = [item.get("input", 0) for item in temp_df["today"]]
total_list = [item.get("input", 0) for item in temp_df["total"]]
result_df = pd.DataFrame([today_list, total_list]).T
result_df.columns = ["境外输入新增确诊", "境外输入累计确诊"]
result_df.index = pd.to_datetime(temp_df.date)
return result_df
elif indicator == "境外输入确诊病例来源":
url = "https://c.m.163.com/ug/api/wuhan/app/index/input-data-list"
params = {"t": round(int(time.time() * 1000))}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
del temp_df["page"]
return temp_df
| 18,111 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_dxy
|
(indicator: str = "浙江省") -> pd
|
20200315-丁香园接口更新分为国内和国外
https://ncov.dxy.cn/ncovh5/view/pneumonia
丁香园-全国统计-info
丁香园-分地区统计-data
丁香园-全国发热门诊一览表-hospital
丁香园-全国新闻-news
:param indicator: choice of {"info", "data", "hospital", "news"}
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
|
20200315-丁香园接口更新分为国内和国外
https://ncov.dxy.cn/ncovh5/view/pneumonia
丁香园-全国统计-info
丁香园-分地区统计-data
丁香园-全国发热门诊一览表-hospital
丁香园-全国新闻-news
:param indicator: choice of {"info", "data", "hospital", "news"}
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
| 305 | 499 |
def covid_19_dxy(indicator: str = "浙江省") -> pd.DataFrame:
"""
20200315-丁香园接口更新分为国内和国外
https://ncov.dxy.cn/ncovh5/view/pneumonia
丁香园-全国统计-info
丁香园-分地区统计-data
丁香园-全国发热门诊一览表-hospital
丁香园-全国新闻-news
:param indicator: choice of {"info", "data", "hospital", "news"}
:type indicator: str
:return: 返回指定 indicator 的数据
:rtype: pandas.DataFrame
"""
url = "https://ncov.dxy.cn/ncovh5/view/pneumonia"
r = requests.get(url)
r.encoding = "utf-8"
soup = BeautifulSoup(r.text, "lxml")
# news-china
text_data_news = str(
soup.find("script", attrs={"id": "getTimelineService1"})
)
temp_json = text_data_news[
text_data_news.find("= [{") + 2 : text_data_news.rfind("}catch")
]
json_data = pd.DataFrame(json.loads(temp_json))
chinese_news = json_data[
[
"id",
"pubDate",
"pubDateStr",
"title",
"summary",
"infoSource",
"sourceUrl",
"provinceId",
]
]
# data-domestic
data_text = str(soup.find("script", attrs={"id": "getAreaStat"}))
data_text_json = json.loads(
data_text[data_text.find("= [{") + 2 : data_text.rfind("catch") - 1]
)
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(data_text_json, "$..provinceName")
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(data_text_json, "$..cities")[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
domestic_city_df = big_df
data_df = pd.DataFrame(data_text_json).iloc[:, :7]
data_df.columns = ["地区", "地区简称", "现存确诊", "累计确诊", "-", "治愈", "死亡"]
domestic_province_df = data_df[["地区", "地区简称", "现存确诊", "累计确诊", "治愈", "死亡"]]
# data-global
data_text = str(
soup.find("script", attrs={"id": "getListByCountryTypeService2true"})
)
data_text_json = json.loads(
data_text[data_text.find("= [{") + 2 : data_text.rfind("catch") - 1]
)
global_df = pd.DataFrame(data_text_json)
# info
dxy_static = str(soup.find("script", attrs={"id": "getStatisticsService"}))
data_json = json.loads(
dxy_static[dxy_static.find("= {") + 2 : dxy_static.rfind("}c")]
)
china_statistics = pd.DataFrame(
[
time.strftime(
"%Y-%m-%d %H:%M:%S",
time.localtime(data_json["modifyTime"] / 1000),
),
data_json["currentConfirmedCount"],
data_json["confirmedCount"],
data_json["suspectedCount"],
data_json["curedCount"],
data_json["deadCount"],
data_json["seriousCount"],
],
index=[
"数据发布时间",
"现存确诊",
"累计确诊",
"境外输入",
"累计治愈",
"累计死亡",
"现存重症",
],
columns=["info"],
)
foreign_statistics = pd.DataFrame.from_dict(
data_json["foreignStatistics"], orient="index"
)
global_statistics = pd.DataFrame.from_dict(
data_json["globalStatistics"], orient="index"
)
# hospital
url = "https://assets.dxycdn.com/gitrepo/tod-assets/output/default/pneumonia/index.js"
payload = {"t": str(int(time.time()))}
r = requests.get(url, params=payload)
hospital_df = pd.read_html(r.text)[0].iloc[:, :-1]
if indicator == "中国疫情分省统计详情":
return domestic_province_df
if indicator == "中国疫情分市统计详情":
return domestic_city_df
elif indicator == "全球疫情分国家统计详情":
return global_df
elif indicator == "中国疫情实时统计":
return china_statistics
elif indicator == "国外疫情实时统计":
return foreign_statistics
elif indicator == "全球疫情实时统计":
return global_statistics
elif indicator == "中国疫情防控医院":
return hospital_df
elif indicator == "国内新闻":
return chinese_news
else:
try:
data_text = str(soup.find("script", attrs={"id": "getAreaStat"}))
data_text_json = json.loads(
data_text[
data_text.find("= [{") + 2 : data_text.rfind("catch") - 1
]
)
data_df = pd.DataFrame(data_text_json)
# indicator = "浙江省"
sub_area = pd.DataFrame(
data_df[data_df["provinceName"] == indicator]["cities"].values[
0
]
)
if sub_area.empty:
return
if sub_area.shape[1] != 10:
sub_area.columns = [
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
"id",
"_",
"_",
]
sub_area = sub_area[
[
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
]
]
else:
sub_area.columns = [
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
"id",
"_",
]
sub_area = sub_area[
[
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
]
]
return sub_area
except IndexError:
print("请输入省/市的全称, 如: 浙江省/上海市 等")
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L305-L499
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12
] | 6.666667 |
[
13,
14,
15,
16,
18,
21,
24,
25,
39,
40,
43,
44,
47,
50,
51,
52,
53,
54,
55,
58,
61,
64,
67,
68,
71,
95,
98,
103,
104,
105,
106,
108,
109,
110,
111,
112,
113,
114,
115,
116,
117,
118,
119,
120,
121,
122,
123,
125,
126,
127,
132,
134,
139,
140,
141,
142,
155,
168,
180,
192,
193,
194
] | 31.794872 | false | 6.904762 | 195 | 13 | 68.205128 | 10 |
def covid_19_dxy(indicator: str = "浙江省") -> pd.DataFrame:
url = "https://ncov.dxy.cn/ncovh5/view/pneumonia"
r = requests.get(url)
r.encoding = "utf-8"
soup = BeautifulSoup(r.text, "lxml")
# news-china
text_data_news = str(
soup.find("script", attrs={"id": "getTimelineService1"})
)
temp_json = text_data_news[
text_data_news.find("= [{") + 2 : text_data_news.rfind("}catch")
]
json_data = pd.DataFrame(json.loads(temp_json))
chinese_news = json_data[
[
"id",
"pubDate",
"pubDateStr",
"title",
"summary",
"infoSource",
"sourceUrl",
"provinceId",
]
]
# data-domestic
data_text = str(soup.find("script", attrs={"id": "getAreaStat"}))
data_text_json = json.loads(
data_text[data_text.find("= [{") + 2 : data_text.rfind("catch") - 1]
)
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(data_text_json, "$..provinceName")
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(data_text_json, "$..cities")[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
domestic_city_df = big_df
data_df = pd.DataFrame(data_text_json).iloc[:, :7]
data_df.columns = ["地区", "地区简称", "现存确诊", "累计确诊", "-", "治愈", "死亡"]
domestic_province_df = data_df[["地区", "地区简称", "现存确诊", "累计确诊", "治愈", "死亡"]]
# data-global
data_text = str(
soup.find("script", attrs={"id": "getListByCountryTypeService2true"})
)
data_text_json = json.loads(
data_text[data_text.find("= [{") + 2 : data_text.rfind("catch") - 1]
)
global_df = pd.DataFrame(data_text_json)
# info
dxy_static = str(soup.find("script", attrs={"id": "getStatisticsService"}))
data_json = json.loads(
dxy_static[dxy_static.find("= {") + 2 : dxy_static.rfind("}c")]
)
china_statistics = pd.DataFrame(
[
time.strftime(
"%Y-%m-%d %H:%M:%S",
time.localtime(data_json["modifyTime"] / 1000),
),
data_json["currentConfirmedCount"],
data_json["confirmedCount"],
data_json["suspectedCount"],
data_json["curedCount"],
data_json["deadCount"],
data_json["seriousCount"],
],
index=[
"数据发布时间",
"现存确诊",
"累计确诊",
"境外输入",
"累计治愈",
"累计死亡",
"现存重症",
],
columns=["info"],
)
foreign_statistics = pd.DataFrame.from_dict(
data_json["foreignStatistics"], orient="index"
)
global_statistics = pd.DataFrame.from_dict(
data_json["globalStatistics"], orient="index"
)
# hospital
url = "https://assets.dxycdn.com/gitrepo/tod-assets/output/default/pneumonia/index.js"
payload = {"t": str(int(time.time()))}
r = requests.get(url, params=payload)
hospital_df = pd.read_html(r.text)[0].iloc[:, :-1]
if indicator == "中国疫情分省统计详情":
return domestic_province_df
if indicator == "中国疫情分市统计详情":
return domestic_city_df
elif indicator == "全球疫情分国家统计详情":
return global_df
elif indicator == "中国疫情实时统计":
return china_statistics
elif indicator == "国外疫情实时统计":
return foreign_statistics
elif indicator == "全球疫情实时统计":
return global_statistics
elif indicator == "中国疫情防控医院":
return hospital_df
elif indicator == "国内新闻":
return chinese_news
else:
try:
data_text = str(soup.find("script", attrs={"id": "getAreaStat"}))
data_text_json = json.loads(
data_text[
data_text.find("= [{") + 2 : data_text.rfind("catch") - 1
]
)
data_df = pd.DataFrame(data_text_json)
# indicator = "浙江省"
sub_area = pd.DataFrame(
data_df[data_df["provinceName"] == indicator]["cities"].values[
0
]
)
if sub_area.empty:
return
if sub_area.shape[1] != 10:
sub_area.columns = [
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
"id",
"_",
"_",
]
sub_area = sub_area[
[
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
]
]
else:
sub_area.columns = [
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
"id",
"_",
]
sub_area = sub_area[
[
"区域",
"现在确诊人数",
"确诊人数",
"疑似人数",
"治愈人数",
"死亡人数",
"高危人数",
"中危人数",
]
]
return sub_area
except IndexError:
print("请输入省/市的全称, 如: 浙江省/上海市 等")
| 18,112 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_baidu
|
(indicator: str = "浙江") ->
|
百度-新型冠状病毒肺炎-疫情实时大数据报告
https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1
百度迁徙
https://qianxi.baidu.com/
:param indicator: 看说明文档
:type indicator: str
:return: 指定 indicator 的数据
:rtype: pandas.DataFrame
|
百度-新型冠状病毒肺炎-疫情实时大数据报告
https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1
百度迁徙
https://qianxi.baidu.com/
:param indicator: 看说明文档
:type indicator: str
:return: 指定 indicator 的数据
:rtype: pandas.DataFrame
| 502 | 709 |
def covid_19_baidu(indicator: str = "浙江") -> pd.DataFrame:
"""
百度-新型冠状病毒肺炎-疫情实时大数据报告
https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1
百度迁徙
https://qianxi.baidu.com/
:param indicator: 看说明文档
:type indicator: str
:return: 指定 indicator 的数据
:rtype: pandas.DataFrame
"""
# domestic-city
url = "https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
temp_soup = str(soup.find(attrs={"id": "captain-config"}))
data_json = demjson.decode(
temp_soup[temp_soup.find("{") : temp_soup.rfind("}") + 1]
)
big_df = pd.DataFrame()
for i, p in enumerate(
[item["area"] for item in data_json["component"][0]["caseList"]]
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["caseList"][i], "$.subList"
)[0]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
domestic_city_df = big_df
domestic_province_df = pd.DataFrame(
data_json["component"][0]["caseList"]
).iloc[:, :-2]
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(
data_json["component"][0]["caseOutsideList"], "$..area"
)
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["caseOutsideList"], "$..subList"
)[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
outside_city_df = big_df
outside_country_df = pd.DataFrame(
data_json["component"][0]["caseOutsideList"]
).iloc[:, :-1]
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(data_json["component"][0]["globalList"], "$..area")
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["globalList"], "$..subList"
)[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
global_country_df = big_df
global_continent_df = pd.DataFrame(
data_json["component"][0]["globalList"]
)[["area", "died", "crued", "confirmed", "confirmedRelative"]]
url = "https://opendata.baidu.com/data/inner"
params = {
"tn": "reserved_all_res_tn",
"dspName": "iphone",
"from_sf": "1",
"dsp": "iphone",
"resource_id": "28565",
"alr": "1",
"query": "国内新型肺炎最新动态",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["Result"][0]["items_v2"][0]["aladdin_res"]["DisplayData"][
"result"
]["items"]
)
temp_df.rename(
{
"bjh_na": "_",
"eventDescription": "新闻",
"eventTime": "时间",
"eventUrl": "链接",
"homepageUrl": "_",
"item_avatar": "_",
"siteName": "来源",
},
axis=1,
inplace=True,
)
temp_df.set_index(
pd.to_datetime(temp_df["时间"], unit="s", utc=True), inplace=True
)
temp_df.index = (
pd.to_datetime(temp_df["时间"], unit="s", utc=True)
.tz_convert("Asia/Shanghai")
.index
)
del temp_df["时间"]
temp_df.reset_index(inplace=True)
temp_df["时间"] = (
pd.to_datetime(temp_df["时间"])
.dt.date.astype(str)
.str.cat(pd.to_datetime(temp_df["时间"]).dt.time.astype(str), sep=" ")
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
domestic_news = temp_df
params = {
"tn": "reserved_all_res_tn",
"dspName": "iphone",
"from_sf": "1",
"dsp": "iphone",
"resource_id": "28565",
"alr": "1",
"query": "国外新型肺炎最新动态",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["Result"][0]["items_v2"][0]["aladdin_res"]["DisplayData"][
"result"
]["items"]
)
temp_df.rename(
{
"bjh_na": "_",
"eventDescription": "新闻",
"eventTime": "时间",
"eventUrl": "链接",
"homepageUrl": "_",
"item_avatar": "_",
"siteName": "来源",
},
axis=1,
inplace=True,
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
temp_df.set_index(
pd.to_datetime(temp_df["时间"], unit="s", utc=True), inplace=True
)
temp_df.index = (
pd.to_datetime(temp_df["时间"], unit="s", utc=True)
.tz_convert("Asia/Shanghai")
.index
)
del temp_df["时间"]
temp_df.reset_index(inplace=True)
temp_df["时间"] = (
pd.to_datetime(temp_df["时间"])
.dt.date.astype(str)
.str.cat(pd.to_datetime(temp_df["时间"]).dt.time.astype(str), sep=" ")
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
foreign_news = temp_df
if indicator == "中国分省份详情":
return domestic_province_df
elif indicator == "中国分城市详情":
return domestic_city_df
elif indicator == "国外分国详情":
return outside_country_df
elif indicator == "国外分城市详情":
return outside_city_df
elif indicator == "全球分洲详情":
return global_continent_df
elif indicator == "全球分洲国家详情":
return global_country_df
elif indicator == "国内新型肺炎最新动态":
return domestic_news
elif indicator == "国外新型肺炎最新动态":
return foreign_news
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L502-L709
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11
] | 5.769231 |
[
12,
13,
14,
15,
16,
19,
20,
23,
29,
30,
31,
33,
37,
38,
43,
48,
49,
51,
53,
57,
58,
61,
66,
68,
69,
71,
75,
76,
85,
86,
87,
92,
105,
108,
113,
114,
115,
120,
128,
130,
139,
140,
141,
146,
159,
167,
170,
175,
176,
177,
182,
190,
192,
193,
194,
195,
196,
197,
198,
199,
200,
201,
202,
203,
204,
205,
206,
207
] | 32.692308 | false | 6.904762 | 208 | 13 | 67.307692 | 8 |
def covid_19_baidu(indicator: str = "浙江") -> pd.DataFrame:
# domestic-city
url = "https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
temp_soup = str(soup.find(attrs={"id": "captain-config"}))
data_json = demjson.decode(
temp_soup[temp_soup.find("{") : temp_soup.rfind("}") + 1]
)
big_df = pd.DataFrame()
for i, p in enumerate(
[item["area"] for item in data_json["component"][0]["caseList"]]
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["caseList"][i], "$.subList"
)[0]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
domestic_city_df = big_df
domestic_province_df = pd.DataFrame(
data_json["component"][0]["caseList"]
).iloc[:, :-2]
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(
data_json["component"][0]["caseOutsideList"], "$..area"
)
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["caseOutsideList"], "$..subList"
)[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
outside_city_df = big_df
outside_country_df = pd.DataFrame(
data_json["component"][0]["caseOutsideList"]
).iloc[:, :-1]
big_df = pd.DataFrame()
for i, p in enumerate(
jsonpath.jsonpath(data_json["component"][0]["globalList"], "$..area")
):
temp_df = pd.DataFrame(
jsonpath.jsonpath(
data_json["component"][0]["globalList"], "$..subList"
)[i]
)
temp_df["province"] = p
big_df = pd.concat([big_df, temp_df], ignore_index=True)
global_country_df = big_df
global_continent_df = pd.DataFrame(
data_json["component"][0]["globalList"]
)[["area", "died", "crued", "confirmed", "confirmedRelative"]]
url = "https://opendata.baidu.com/data/inner"
params = {
"tn": "reserved_all_res_tn",
"dspName": "iphone",
"from_sf": "1",
"dsp": "iphone",
"resource_id": "28565",
"alr": "1",
"query": "国内新型肺炎最新动态",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["Result"][0]["items_v2"][0]["aladdin_res"]["DisplayData"][
"result"
]["items"]
)
temp_df.rename(
{
"bjh_na": "_",
"eventDescription": "新闻",
"eventTime": "时间",
"eventUrl": "链接",
"homepageUrl": "_",
"item_avatar": "_",
"siteName": "来源",
},
axis=1,
inplace=True,
)
temp_df.set_index(
pd.to_datetime(temp_df["时间"], unit="s", utc=True), inplace=True
)
temp_df.index = (
pd.to_datetime(temp_df["时间"], unit="s", utc=True)
.tz_convert("Asia/Shanghai")
.index
)
del temp_df["时间"]
temp_df.reset_index(inplace=True)
temp_df["时间"] = (
pd.to_datetime(temp_df["时间"])
.dt.date.astype(str)
.str.cat(pd.to_datetime(temp_df["时间"]).dt.time.astype(str), sep=" ")
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
domestic_news = temp_df
params = {
"tn": "reserved_all_res_tn",
"dspName": "iphone",
"from_sf": "1",
"dsp": "iphone",
"resource_id": "28565",
"alr": "1",
"query": "国外新型肺炎最新动态",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
data_json["Result"][0]["items_v2"][0]["aladdin_res"]["DisplayData"][
"result"
]["items"]
)
temp_df.rename(
{
"bjh_na": "_",
"eventDescription": "新闻",
"eventTime": "时间",
"eventUrl": "链接",
"homepageUrl": "_",
"item_avatar": "_",
"siteName": "来源",
},
axis=1,
inplace=True,
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
temp_df.set_index(
pd.to_datetime(temp_df["时间"], unit="s", utc=True), inplace=True
)
temp_df.index = (
pd.to_datetime(temp_df["时间"], unit="s", utc=True)
.tz_convert("Asia/Shanghai")
.index
)
del temp_df["时间"]
temp_df.reset_index(inplace=True)
temp_df["时间"] = (
pd.to_datetime(temp_df["时间"])
.dt.date.astype(str)
.str.cat(pd.to_datetime(temp_df["时间"]).dt.time.astype(str), sep=" ")
)
temp_df = temp_df[
[
"新闻",
"时间",
"来源",
"链接",
]
]
foreign_news = temp_df
if indicator == "中国分省份详情":
return domestic_province_df
elif indicator == "中国分城市详情":
return domestic_city_df
elif indicator == "国外分国详情":
return outside_country_df
elif indicator == "国外分城市详情":
return outside_city_df
elif indicator == "全球分洲详情":
return global_continent_df
elif indicator == "全球分洲国家详情":
return global_country_df
elif indicator == "国内新型肺炎最新动态":
return domestic_news
elif indicator == "国外新型肺炎最新动态":
return foreign_news
| 18,113 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
migration_area_baidu
|
(
area: str = "乌鲁木齐市", indicator: str = "move_out", date: str = "20200201"
)
|
return temp_df
|
百度地图慧眼-百度迁徙-XXX迁入地详情
百度地图慧眼-百度迁徙-XXX迁出地详情
以上展示 top100 结果,如不够 100 则展示全部
迁入来源地比例: 从 xx 地迁入到当前区域的人数与当前区域迁入总人口的比值
迁出目的地比例: 从当前区域迁出到 xx 的人口与从当前区域迁出总人口的比值
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param date: 查询的日期 20200101 以后的时间
:type date: str
:return: 迁入地详情/迁出地详情的前 50 个
:rtype: pandas.DataFrame
|
百度地图慧眼-百度迁徙-XXX迁入地详情
百度地图慧眼-百度迁徙-XXX迁出地详情
以上展示 top100 结果,如不够 100 则展示全部
迁入来源地比例: 从 xx 地迁入到当前区域的人数与当前区域迁入总人口的比值
迁出目的地比例: 从当前区域迁出到 xx 的人口与从当前区域迁出总人口的比值
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param date: 查询的日期 20200101 以后的时间
:type date: str
:return: 迁入地详情/迁出地详情的前 50 个
:rtype: pandas.DataFrame
| 712 | 748 |
def migration_area_baidu(
area: str = "乌鲁木齐市", indicator: str = "move_out", date: str = "20200201"
) -> pd.DataFrame:
"""
百度地图慧眼-百度迁徙-XXX迁入地详情
百度地图慧眼-百度迁徙-XXX迁出地详情
以上展示 top100 结果,如不够 100 则展示全部
迁入来源地比例: 从 xx 地迁入到当前区域的人数与当前区域迁入总人口的比值
迁出目的地比例: 从当前区域迁出到 xx 的人口与从当前区域迁出总人口的比值
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param date: 查询的日期 20200101 以后的时间
:type date: str
:return: 迁入地详情/迁出地详情的前 50 个
:rtype: pandas.DataFrame
"""
city_dict.update(province_dict)
inner_dict = dict(zip(city_dict.values(), city_dict.keys()))
if inner_dict[area] in province_dict.keys():
dt_flag = "province"
else:
dt_flag = "city"
url = "https://huiyan.baidu.com/migration/cityrank.jsonp"
params = {
"dt": dt_flag,
"id": inner_dict[area],
"type": indicator,
"date": date,
}
r = requests.get(url, params=params)
data_text = r.text[r.text.find("({") + 1 : r.text.rfind(");")]
data_json = json.loads(data_text)
temp_df = pd.DataFrame(data_json["data"]["list"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L712-L748
| 25 |
[
0
] | 2.702703 |
[
19,
20,
21,
22,
24,
25,
26,
32,
33,
34,
35,
36
] | 32.432432 | false | 6.904762 | 37 | 2 | 67.567568 | 14 |
def migration_area_baidu(
area: str = "乌鲁木齐市", indicator: str = "move_out", date: str = "20200201"
) -> pd.DataFrame:
city_dict.update(province_dict)
inner_dict = dict(zip(city_dict.values(), city_dict.keys()))
if inner_dict[area] in province_dict.keys():
dt_flag = "province"
else:
dt_flag = "city"
url = "https://huiyan.baidu.com/migration/cityrank.jsonp"
params = {
"dt": dt_flag,
"id": inner_dict[area],
"type": indicator,
"date": date,
}
r = requests.get(url, params=params)
data_text = r.text[r.text.find("({") + 1 : r.text.rfind(");")]
data_json = json.loads(data_text)
temp_df = pd.DataFrame(data_json["data"]["list"])
return temp_df
| 18,114 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
migration_scale_baidu
|
(
area: str = "佛山市",
indicator: str = "move_out",
start_date: str = "20200110",
end_date: str = "20200315",
)
|
return temp_df
|
百度地图慧眼-百度迁徙-迁徙规模
迁徙规模指数:反映迁入或迁出人口规模,城市间可横向对比城市迁徙边界采用该城市行政区划,包含该城市管辖的区、县、乡、村
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param start_date: 开始查询的日期 默认就可以
:type start_date: str
:param end_date: 结束查询的日期 20200101 以后的时间
:type end_date: str
:return: 时间序列的迁徙规模指数
:rtype: pandas.DataFrame
|
百度地图慧眼-百度迁徙-迁徙规模
迁徙规模指数:反映迁入或迁出人口规模,城市间可横向对比城市迁徙边界采用该城市行政区划,包含该城市管辖的区、县、乡、村
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param start_date: 开始查询的日期 默认就可以
:type start_date: str
:param end_date: 结束查询的日期 20200101 以后的时间
:type end_date: str
:return: 时间序列的迁徙规模指数
:rtype: pandas.DataFrame
| 751 | 792 |
def migration_scale_baidu(
area: str = "佛山市",
indicator: str = "move_out",
start_date: str = "20200110",
end_date: str = "20200315",
) -> pd.DataFrame:
"""
百度地图慧眼-百度迁徙-迁徙规模
迁徙规模指数:反映迁入或迁出人口规模,城市间可横向对比城市迁徙边界采用该城市行政区划,包含该城市管辖的区、县、乡、村
https://qianxi.baidu.com/?from=shoubai#city=0
:param area: 可以输入 省份 或者 具体城市 但是需要用全称
:type area: str
:param indicator: move_in 迁入 move_out 迁出
:type indicator: str
:param start_date: 开始查询的日期 默认就可以
:type start_date: str
:param end_date: 结束查询的日期 20200101 以后的时间
:type end_date: str
:return: 时间序列的迁徙规模指数
:rtype: pandas.DataFrame
"""
city_dict.update(province_dict)
inner_dict = dict(zip(city_dict.values(), city_dict.keys()))
if inner_dict[area] in province_dict.keys():
dt_flag = "province"
else:
dt_flag = "city"
url = "https://huiyan.baidu.com/migration/historycurve.jsonp"
params = {
"dt": dt_flag,
"id": inner_dict[area],
"type": indicator,
"startDate": start_date,
"endDate": end_date,
}
r = requests.get(url, params=params)
json_data = json.loads(r.text[r.text.find("({") + 1 : r.text.rfind(");")])
temp_df = pd.DataFrame.from_dict(json_data["data"]["list"], orient="index")
temp_df.index = pd.to_datetime(temp_df.index)
temp_df.columns = ["迁徙规模指数"]
temp_df = temp_df[start_date:end_date]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L751-L792
| 25 |
[
0
] | 2.380952 |
[
21,
22,
23,
24,
26,
27,
28,
35,
36,
37,
38,
39,
40,
41
] | 33.333333 | false | 6.904762 | 42 | 2 | 66.666667 | 13 |
def migration_scale_baidu(
area: str = "佛山市",
indicator: str = "move_out",
start_date: str = "20200110",
end_date: str = "20200315",
) -> pd.DataFrame:
city_dict.update(province_dict)
inner_dict = dict(zip(city_dict.values(), city_dict.keys()))
if inner_dict[area] in province_dict.keys():
dt_flag = "province"
else:
dt_flag = "city"
url = "https://huiyan.baidu.com/migration/historycurve.jsonp"
params = {
"dt": dt_flag,
"id": inner_dict[area],
"type": indicator,
"startDate": start_date,
"endDate": end_date,
}
r = requests.get(url, params=params)
json_data = json.loads(r.text[r.text.find("({") + 1 : r.text.rfind(");")])
temp_df = pd.DataFrame.from_dict(json_data["data"]["list"], orient="index")
temp_df.index = pd.to_datetime(temp_df.index)
temp_df.columns = ["迁徙规模指数"]
temp_df = temp_df[start_date:end_date]
return temp_df
| 18,115 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_trip
|
()
|
return temp_df
|
新型肺炎确诊患者-同程查询
https://rl.inews.qq.com/h5/trip?from=newsapp&ADTAG=tgi.wx.share.message
:return: 新型肺炎确诊患者-相同行程查询工具的所有历史数据
:rtype: pandas.DataFrame
|
新型肺炎确诊患者-同程查询
https://rl.inews.qq.com/h5/trip?from=newsapp&ADTAG=tgi.wx.share.message
:return: 新型肺炎确诊患者-相同行程查询工具的所有历史数据
:rtype: pandas.DataFrame
| 795 | 806 |
def covid_19_trip() -> pd.DataFrame:
"""
新型肺炎确诊患者-同程查询
https://rl.inews.qq.com/h5/trip?from=newsapp&ADTAG=tgi.wx.share.message
:return: 新型肺炎确诊患者-相同行程查询工具的所有历史数据
:rtype: pandas.DataFrame
"""
url = "https://r.inews.qq.com/api/travelFront"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L795-L806
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 58.333333 |
[
7,
8,
9,
10,
11
] | 41.666667 | false | 6.904762 | 12 | 1 | 58.333333 | 4 |
def covid_19_trip() -> pd.DataFrame:
url = "https://r.inews.qq.com/api/travelFront"
r = requests.get(url)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
return temp_df
| 18,116 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_trace
|
()
|
return big_df
|
腾讯新闻-疫情-病患轨迹
https://news.qq.com/hdh5/hebeicomeon.htm#/?ADTAG=yqi
:return: 病患轨迹
:rtype: pandas.DataFrame
|
腾讯新闻-疫情-病患轨迹
https://news.qq.com/hdh5/hebeicomeon.htm#/?ADTAG=yqi
:return: 病患轨迹
:rtype: pandas.DataFrame
| 809 | 889 |
def covid_19_trace() -> pd.DataFrame:
"""
腾讯新闻-疫情-病患轨迹
https://news.qq.com/hdh5/hebeicomeon.htm#/?ADTAG=yqi
:return: 病患轨迹
:rtype: pandas.DataFrame
"""
url = "https://r.inews.qq.com/api/trackmap/poilist"
headers = {
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
}
r = requests.get(url, headers=headers)
data_json = r.json()
province_list = [item["fullname"] for item in data_json["result"]["list"]]
big_df = pd.DataFrame()
for province in province_list:
url = "https://apis.map.qq.com/place_cloud/search/region"
params = {
"region": province,
"page_size": "200",
"table_id": "5ff7d526b34a3525c3169a0b",
"key": "NFPBZ-D2N3P-T7FDV-VLBQ6-4DVM7-JQFCR",
"fliter": "",
}
headers = {
"Referer": "https://news.qq.com/",
"Host": "apis.map.qq.com",
"Origin": "https://news.qq.com",
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
risk_level = [
item["x"]["risk_level"] for item in data_json["result"]["data"]
]
count_time = [
item["x"]["datetime"] for item in data_json["result"]["data"]
]
temp_df = pd.DataFrame(data_json["result"]["data"])
del temp_df["location"]
del temp_df["id"]
del temp_df["polygon"]
del temp_df["tel"]
del temp_df["ud_id"]
del temp_df["adcode"]
del temp_df["x"]
temp_df["update_time"] = pd.to_datetime(
temp_df["update_time"], unit="s"
)
temp_df["create_time"] = pd.to_datetime(
temp_df["create_time"], unit="s"
)
temp_df["risk_level"] = risk_level
temp_df["count_time"] = count_time
del temp_df["create_time"]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"地址",
"城市",
"区",
"_",
"省份",
"标题",
"更新时间",
"风险等级",
"统计时间",
]
big_df = big_df[
[
"地址",
"城市",
"区",
"省份",
"标题",
"更新时间",
"风险等级",
"统计时间",
]
]
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L809-L889
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.641975 |
[
7,
8,
11,
12,
13,
14,
15,
16,
17,
24,
30,
31,
32,
35,
38,
39,
40,
41,
42,
43,
44,
45,
46,
49,
52,
53,
54,
55,
57,
68,
80
] | 38.271605 | false | 6.904762 | 81 | 5 | 61.728395 | 4 |
def covid_19_trace() -> pd.DataFrame:
url = "https://r.inews.qq.com/api/trackmap/poilist"
headers = {
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
}
r = requests.get(url, headers=headers)
data_json = r.json()
province_list = [item["fullname"] for item in data_json["result"]["list"]]
big_df = pd.DataFrame()
for province in province_list:
url = "https://apis.map.qq.com/place_cloud/search/region"
params = {
"region": province,
"page_size": "200",
"table_id": "5ff7d526b34a3525c3169a0b",
"key": "NFPBZ-D2N3P-T7FDV-VLBQ6-4DVM7-JQFCR",
"fliter": "",
}
headers = {
"Referer": "https://news.qq.com/",
"Host": "apis.map.qq.com",
"Origin": "https://news.qq.com",
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
risk_level = [
item["x"]["risk_level"] for item in data_json["result"]["data"]
]
count_time = [
item["x"]["datetime"] for item in data_json["result"]["data"]
]
temp_df = pd.DataFrame(data_json["result"]["data"])
del temp_df["location"]
del temp_df["id"]
del temp_df["polygon"]
del temp_df["tel"]
del temp_df["ud_id"]
del temp_df["adcode"]
del temp_df["x"]
temp_df["update_time"] = pd.to_datetime(
temp_df["update_time"], unit="s"
)
temp_df["create_time"] = pd.to_datetime(
temp_df["create_time"], unit="s"
)
temp_df["risk_level"] = risk_level
temp_df["count_time"] = count_time
del temp_df["create_time"]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.columns = [
"地址",
"城市",
"区",
"_",
"省份",
"标题",
"更新时间",
"风险等级",
"统计时间",
]
big_df = big_df[
[
"地址",
"城市",
"区",
"省份",
"标题",
"更新时间",
"风险等级",
"统计时间",
]
]
return big_df
| 18,117 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_hist_city
|
(city: str = "武汉市") -> pd
|
return data_df[data_df["city"] == city]
|
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param city: 具体的城市
:type city: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
|
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param city: 具体的城市
:type city: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
| 892 | 905 |
def covid_19_hist_city(city: str = "武汉市") -> pd.DataFrame:
"""
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param city: 具体的城市
:type city: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/canghailan/Wuhan-2019-nCoV/master/Wuhan-2019-nCoV.json"
r = requests.get(url)
data_json = r.json()
data_df = pd.DataFrame(data_json)
return data_df[data_df["city"] == city]
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L892-L905
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 64.285714 |
[
9,
10,
11,
12,
13
] | 35.714286 | false | 6.904762 | 14 | 1 | 64.285714 | 6 |
def covid_19_hist_city(city: str = "武汉市") -> pd.DataFrame:
url = "https://raw.githubusercontent.com/canghailan/Wuhan-2019-nCoV/master/Wuhan-2019-nCoV.json"
r = requests.get(url)
data_json = r.json()
data_df = pd.DataFrame(data_json)
return data_df[data_df["city"] == city]
| 18,118 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_hist_province
|
(province: str = "湖北省") -> pd
|
return data_df[data_df["province"] == province]
|
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param province: 具体的省份
:type province: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
|
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param province: 具体的省份
:type province: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
| 908 | 921 |
def covid_19_hist_province(province: str = "湖北省") -> pd.DataFrame:
"""
该接口最好用代理速度比较快, 2019-12-01开始
https://github.com/canghailan/Wuhan-2019-nCoV
:param province: 具体的省份
:type province: str
:return: COVID-19 具体城市的数据
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/canghailan/Wuhan-2019-nCoV/master/Wuhan-2019-nCoV.json"
r = requests.get(url)
data_json = r.json()
data_df = pd.DataFrame(data_json)
return data_df[data_df["province"] == province]
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L908-L921
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 64.285714 |
[
9,
10,
11,
12,
13
] | 35.714286 | false | 6.904762 | 14 | 1 | 64.285714 | 6 |
def covid_19_hist_province(province: str = "湖北省") -> pd.DataFrame:
url = "https://raw.githubusercontent.com/canghailan/Wuhan-2019-nCoV/master/Wuhan-2019-nCoV.json"
r = requests.get(url)
data_json = r.json()
data_df = pd.DataFrame(data_json)
return data_df[data_df["province"] == province]
| 18,119 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_daily
|
(date: str = "2020-04-06")
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE, 采集 GitHub csv 文件需要 raw 地址
https://github.com/CSSEGISandData/COVID-19
:param date: from 2020-01-22 to today
:type date: str
:return: CSSE data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE, 采集 GitHub csv 文件需要 raw 地址
https://github.com/CSSEGISandData/COVID-19
:param date: from 2020-01-22 to today
:type date: str
:return: CSSE data
:rtype: pandas.DataFrame
| 924 | 935 |
def covid_19_csse_daily(date: str = "2020-04-06") -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE, 采集 GitHub csv 文件需要 raw 地址
https://github.com/CSSEGISandData/COVID-19
:param date: from 2020-01-22 to today
:type date: str
:return: CSSE data
:rtype: pandas.DataFrame
"""
url = f"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/{date.split('-')[1]}-{date.split('-')[2]}-{date.split('-')[0]}.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L924-L935
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 75 |
[
9,
10,
11
] | 25 | false | 6.904762 | 12 | 1 | 75 | 6 |
def covid_19_csse_daily(date: str = "2020-04-06") -> pd.DataFrame:
url = f"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/{date.split('-')[1]}-{date.split('-')[2]}-{date.split('-')[0]}.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,120 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_us_confirmed
|
()
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us confirmed data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us confirmed data
:rtype: pandas.DataFrame
| 938 | 947 |
def covid_19_csse_us_confirmed() -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us confirmed data
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L938-L947
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 70 |
[
7,
8,
9
] | 30 | false | 6.904762 | 10 | 1 | 70 | 4 |
def covid_19_csse_us_confirmed() -> pd.DataFrame:
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_US.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,121 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_global_confirmed
|
()
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global data
:rtype: pandas.DataFrame
| 950 | 959 |
def covid_19_csse_global_confirmed() -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global data
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L950-L959
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 70 |
[
7,
8,
9
] | 30 | false | 6.904762 | 10 | 1 | 70 | 4 |
def covid_19_csse_global_confirmed() -> pd.DataFrame:
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,122 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_us_death
|
()
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us death data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us death data
:rtype: pandas.DataFrame
| 962 | 971 |
def covid_19_csse_us_death() -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: us death data
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_US.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L962-L971
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 70 |
[
7,
8,
9
] | 30 | false | 6.904762 | 10 | 1 | 70 | 4 |
def covid_19_csse_us_death() -> pd.DataFrame:
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_US.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,123 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_global_death
|
()
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global death data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global death data
:rtype: pandas.DataFrame
| 974 | 983 |
def covid_19_csse_global_death() -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: global death data
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L974-L983
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 70 |
[
7,
8,
9
] | 30 | false | 6.904762 | 10 | 1 | 70 | 4 |
def covid_19_csse_global_death() -> pd.DataFrame:
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,124 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/event/covid.py
|
covid_19_csse_global_recovered
|
()
|
return temp_df
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: recovered data
:rtype: pandas.DataFrame
|
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: recovered data
:rtype: pandas.DataFrame
| 986 | 995 |
def covid_19_csse_global_recovered() -> pd.DataFrame:
"""
2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE
https://github.com/CSSEGISandData/COVID-19
:return: recovered data
:rtype: pandas.DataFrame
"""
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/event/covid.py#L986-L995
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 70 |
[
7,
8,
9
] | 30 | false | 6.904762 | 10 | 1 | 70 | 4 |
def covid_19_csse_global_recovered() -> pd.DataFrame:
url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv"
temp_df = pd.read_table(url, sep=",")
return temp_df
| 18,125 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_international.py
|
get_sector_symbol_name_url
|
()
|
return name_code_map_dict
|
期货所对应板块的 URL
:return: dict
{'能源': '/commodities/energy',
'金属': '/commodities/metals',
'农业': '/commodities/softs',
'商品指数': '/indices/commodities-indices'}
|
期货所对应板块的 URL
:return: dict
{'能源': '/commodities/energy',
'金属': '/commodities/metals',
'农业': '/commodities/softs',
'商品指数': '/indices/commodities-indices'}
| 17 | 34 |
def get_sector_symbol_name_url() -> dict:
"""
期货所对应板块的 URL
:return: dict
{'能源': '/commodities/energy',
'金属': '/commodities/metals',
'农业': '/commodities/softs',
'商品指数': '/indices/commodities-indices'}
"""
url = "https://cn.investing.com/commodities/"
res = requests.get(url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
name_url_option_list = soup.find_all(attrs={"class": "linkTitle"}) # 去掉-所有国家及地区
url_list = [item.find("a")["href"] for item in name_url_option_list]
name_list = [item.get_text() for item in name_url_option_list]
name_code_map_dict = {}
name_code_map_dict.update(zip(name_list, url_list))
return name_code_map_dict
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_international.py#L17-L34
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 50 |
[
9,
10,
11,
12,
13,
14,
15,
16,
17
] | 50 | false | 16.129032 | 18 | 3 | 50 | 6 |
def get_sector_symbol_name_url() -> dict:
url = "https://cn.investing.com/commodities/"
res = requests.get(url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
name_url_option_list = soup.find_all(attrs={"class": "linkTitle"}) # 去掉-所有国家及地区
url_list = [item.find("a")["href"] for item in name_url_option_list]
name_list = [item.get_text() for item in name_url_option_list]
name_code_map_dict = {}
name_code_map_dict.update(zip(name_list, url_list))
return name_code_map_dict
| 18,126 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_international.py
|
futures_global_commodity_name_url_map
|
(sector: str = "能源") ->
|
return name_code_map_dict
|
参考网页: https://cn.investing.com/commodities/
获取选择板块对应的: 具体期货品种的 url 地址
:param sector: 板块, 对应 get_global_country_name_url 品种名称
:type sector: str
:return: dict of name-url
:rtype: dict
{'伦敦布伦特原油': '/commodities/brent-oil',
'WTI原油': '/commodities/crude-oil',
'伦敦汽油': '/commodities/london-gas-oil',
'天然气': '/commodities/natural-gas?cid=49787',
'燃料油': '/commodities/heating-oil',
'碳排放': '/commodities/carbon-emissions',
'RBOB汽油': '/commodities/gasoline-rbob',
'布伦特原油': '/commodities/brent-oil?cid=49769',
'原油': '/commodities/crude-oil?cid=49774'}
|
参考网页: https://cn.investing.com/commodities/
获取选择板块对应的: 具体期货品种的 url 地址
:param sector: 板块, 对应 get_global_country_name_url 品种名称
:type sector: str
:return: dict of name-url
:rtype: dict
{'伦敦布伦特原油': '/commodities/brent-oil',
'WTI原油': '/commodities/crude-oil',
'伦敦汽油': '/commodities/london-gas-oil',
'天然气': '/commodities/natural-gas?cid=49787',
'燃料油': '/commodities/heating-oil',
'碳排放': '/commodities/carbon-emissions',
'RBOB汽油': '/commodities/gasoline-rbob',
'布伦特原油': '/commodities/brent-oil?cid=49769',
'原油': '/commodities/crude-oil?cid=49774'}
| 37 | 69 |
def futures_global_commodity_name_url_map(sector: str = "能源") -> dict:
"""
参考网页: https://cn.investing.com/commodities/
获取选择板块对应的: 具体期货品种的 url 地址
:param sector: 板块, 对应 get_global_country_name_url 品种名称
:type sector: str
:return: dict of name-url
:rtype: dict
{'伦敦布伦特原油': '/commodities/brent-oil',
'WTI原油': '/commodities/crude-oil',
'伦敦汽油': '/commodities/london-gas-oil',
'天然气': '/commodities/natural-gas?cid=49787',
'燃料油': '/commodities/heating-oil',
'碳排放': '/commodities/carbon-emissions',
'RBOB汽油': '/commodities/gasoline-rbob',
'布伦特原油': '/commodities/brent-oil?cid=49769',
'原油': '/commodities/crude-oil?cid=49774'}
"""
name_url_dict = get_sector_symbol_name_url()
url = f"https://cn.investing.com{name_url_dict[sector]}"
res = requests.post(url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
url_list = [
item.find("a")["href"].split("?")[0]
for item in soup.find_all(attrs={"class": "plusIconTd"})
]
name_list = [
item.find("a").get_text()
for item in soup.find_all(attrs={"class": "plusIconTd"})
]
name_code_map_dict = {}
name_code_map_dict.update(zip(name_list, url_list))
return name_code_map_dict
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_international.py#L37-L69
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17
] | 54.545455 |
[
18,
19,
20,
21,
22,
26,
30,
31,
32
] | 27.272727 | false | 16.129032 | 33 | 3 | 72.727273 | 15 |
def futures_global_commodity_name_url_map(sector: str = "能源") -> dict:
name_url_dict = get_sector_symbol_name_url()
url = f"https://cn.investing.com{name_url_dict[sector]}"
res = requests.post(url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
url_list = [
item.find("a")["href"].split("?")[0]
for item in soup.find_all(attrs={"class": "plusIconTd"})
]
name_list = [
item.find("a").get_text()
for item in soup.find_all(attrs={"class": "plusIconTd"})
]
name_code_map_dict = {}
name_code_map_dict.update(zip(name_list, url_list))
return name_code_map_dict
| 18,127 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_international.py
|
futures_global_commodity_hist
|
(
sector: str = "能源",
symbol: str = "伦敦布伦特原油",
start_date: str = "20000101",
end_date: str = "20191017",
)
|
return temp_df
|
国际大宗商品的历史量价数据
https://cn.investing.com/commodities
:param sector: 板块名称; 调用 futures_global_commodity_name_url_map 函数获取
:type sector: str
:param symbol: 品种名称; 通过访问网站查询
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 国际大宗商品的历史量价数据
:rtype: pandas.DataFrame
|
国际大宗商品的历史量价数据
https://cn.investing.com/commodities
:param sector: 板块名称; 调用 futures_global_commodity_name_url_map 函数获取
:type sector: str
:param symbol: 品种名称; 通过访问网站查询
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 国际大宗商品的历史量价数据
:rtype: pandas.DataFrame
| 72 | 150 |
def futures_global_commodity_hist(
sector: str = "能源",
symbol: str = "伦敦布伦特原油",
start_date: str = "20000101",
end_date: str = "20191017",
) -> pd.DataFrame:
"""
国际大宗商品的历史量价数据
https://cn.investing.com/commodities
:param sector: 板块名称; 调用 futures_global_commodity_name_url_map 函数获取
:type sector: str
:param symbol: 品种名称; 通过访问网站查询
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:return: 国际大宗商品的历史量价数据
:rtype: pandas.DataFrame
"""
start_date = "/".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "/".join([end_date[:4], end_date[4:6], end_date[6:]])
name_code_dict = futures_global_commodity_name_url_map(sector)
temp_url = f"https://cn.investing.com/{name_code_dict[symbol]}-historical-data"
res = requests.post(temp_url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
title = soup.find("h2", attrs={"class": "float_lang_base_1"}).get_text()
res = requests.post(temp_url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
data = soup.find_all(text=re.compile("window.histDataExcessInfo"))[0].strip()
para_data = re.findall(r"\d+", data)
payload = {
"curr_id": para_data[0],
"smlID": para_data[1],
"header": title,
"st_date": start_date,
"end_date": end_date,
"interval_sec": "Daily",
"sort_col": "date",
"sort_ord": "DESC",
"action": "historical_data",
}
url = "https://cn.investing.com/instruments/HistoricalDataAjax"
r = requests.post(url, data=payload, headers=long_headers)
temp_df = pd.read_html(r.text)[0]
temp_df["日期"] = pd.to_datetime(temp_df["日期"], format="%Y年%m月%d日")
if any(temp_df["交易量"].astype(str).str.contains("-")):
temp_df["交易量"][temp_df["交易量"].str.contains("-")] = temp_df["交易量"][
temp_df["交易量"].str.contains("-")
].replace("-", 0)
if any(temp_df["交易量"].astype(str).str.contains("B")):
temp_df["交易量"][temp_df["交易量"].str.contains("B").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("B").fillna(False)]
.str.replace("B", "")
.astype(float)
* 1000000000
)
if any(temp_df["交易量"].astype(str).str.contains("M")):
temp_df["交易量"][temp_df["交易量"].str.contains("M").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("M").fillna(False)]
.str.replace("M", "")
.astype(float)
* 1000000
)
if any(temp_df["交易量"].astype(str).str.contains("K")):
temp_df["交易量"][temp_df["交易量"].str.contains("K").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("K").fillna(False)]
.str.replace("K", "")
.astype(float)
* 1000
)
temp_df["交易量"] = temp_df["交易量"].astype(float)
temp_df["涨跌幅"] = pd.DataFrame(
round(temp_df["涨跌幅"].str.replace("%", "").astype(float) / 100, 6)
)
temp_df.name = title
temp_df.columns.name = None
temp_df.sort_values(["日期"], ascending=False, inplace=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_international.py#L72-L150
| 25 |
[
0
] | 1.265823 |
[
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
42,
43,
44,
45,
46,
47,
50,
51,
57,
58,
64,
65,
71,
72,
75,
76,
77,
78
] | 37.974684 | false | 16.129032 | 79 | 5 | 62.025316 | 12 |
def futures_global_commodity_hist(
sector: str = "能源",
symbol: str = "伦敦布伦特原油",
start_date: str = "20000101",
end_date: str = "20191017",
) -> pd.DataFrame:
start_date = "/".join([start_date[:4], start_date[4:6], start_date[6:]])
end_date = "/".join([end_date[:4], end_date[4:6], end_date[6:]])
name_code_dict = futures_global_commodity_name_url_map(sector)
temp_url = f"https://cn.investing.com/{name_code_dict[symbol]}-historical-data"
res = requests.post(temp_url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
title = soup.find("h2", attrs={"class": "float_lang_base_1"}).get_text()
res = requests.post(temp_url, headers=short_headers)
soup = BeautifulSoup(res.text, "lxml")
data = soup.find_all(text=re.compile("window.histDataExcessInfo"))[0].strip()
para_data = re.findall(r"\d+", data)
payload = {
"curr_id": para_data[0],
"smlID": para_data[1],
"header": title,
"st_date": start_date,
"end_date": end_date,
"interval_sec": "Daily",
"sort_col": "date",
"sort_ord": "DESC",
"action": "historical_data",
}
url = "https://cn.investing.com/instruments/HistoricalDataAjax"
r = requests.post(url, data=payload, headers=long_headers)
temp_df = pd.read_html(r.text)[0]
temp_df["日期"] = pd.to_datetime(temp_df["日期"], format="%Y年%m月%d日")
if any(temp_df["交易量"].astype(str).str.contains("-")):
temp_df["交易量"][temp_df["交易量"].str.contains("-")] = temp_df["交易量"][
temp_df["交易量"].str.contains("-")
].replace("-", 0)
if any(temp_df["交易量"].astype(str).str.contains("B")):
temp_df["交易量"][temp_df["交易量"].str.contains("B").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("B").fillna(False)]
.str.replace("B", "")
.astype(float)
* 1000000000
)
if any(temp_df["交易量"].astype(str).str.contains("M")):
temp_df["交易量"][temp_df["交易量"].str.contains("M").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("M").fillna(False)]
.str.replace("M", "")
.astype(float)
* 1000000
)
if any(temp_df["交易量"].astype(str).str.contains("K")):
temp_df["交易量"][temp_df["交易量"].str.contains("K").fillna(False)] = (
temp_df["交易量"][temp_df["交易量"].str.contains("K").fillna(False)]
.str.replace("K", "")
.astype(float)
* 1000
)
temp_df["交易量"] = temp_df["交易量"].astype(float)
temp_df["涨跌幅"] = pd.DataFrame(
round(temp_df["涨跌幅"].str.replace("%", "").astype(float) / 100, 6)
)
temp_df.name = title
temp_df.columns.name = None
temp_df.sort_values(["日期"], ascending=False, inplace=True)
return temp_df
| 18,128 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_sgx_daily.py
|
futures_sgx_daily
|
(
trade_date: str = "20200306", recent_day: str = "3"
)
|
return big_df
|
Futures daily data from sgx
P.S. it will be slowly if you do not use VPN
:param trade_date: it means the specific trade day you want to fetch
:type trade_date: str e.g., "2020/03/06"
:param recent_day: the data range near the specific trade day
:type recent_day: str e.g. "3" means 3 day before specific trade day
:return: data contains from (trade_date - recent_day) to trade_day
:rtype: pandas.DataFrame
|
Futures daily data from sgx
P.S. it will be slowly if you do not use VPN
:param trade_date: it means the specific trade day you want to fetch
:type trade_date: str e.g., "2020/03/06"
:param recent_day: the data range near the specific trade day
:type recent_day: str e.g. "3" means 3 day before specific trade day
:return: data contains from (trade_date - recent_day) to trade_day
:rtype: pandas.DataFrame
| 20 | 60 |
def futures_sgx_daily(
trade_date: str = "20200306", recent_day: str = "3"
) -> pd.DataFrame:
"""
Futures daily data from sgx
P.S. it will be slowly if you do not use VPN
:param trade_date: it means the specific trade day you want to fetch
:type trade_date: str e.g., "2020/03/06"
:param recent_day: the data range near the specific trade day
:type recent_day: str e.g. "3" means 3 day before specific trade day
:return: data contains from (trade_date - recent_day) to trade_day
:rtype: pandas.DataFrame
"""
big_df = pd.DataFrame()
index_df = index_investing_global(
area="新加坡",
symbol="FTSE Singapore",
start_date="20200101",
end_date=trade_date,
)
index_df.sort_index(inplace=True)
index_df.reset_index(inplace=True)
index_df.reset_index(inplace=True)
index_df.index = index_df["index"] + 5840
date_start = index_df.index[-1] + 1 - int(recent_day)
date_end = index_df.index[-1] + 1
for page in tqdm(range(date_start, date_end)):
# page = 5883
url = (
f"https://links.sgx.com/1.0.0/derivatives-daily/{page}/FUTURE.zip"
)
r = requests.get(url)
with zipfile.ZipFile(BytesIO(r.content)) as file:
with file.open(file.namelist()[0]) as my_file:
data = my_file.read().decode()
if file.namelist()[0].endswith("txt"):
data_df = pd.read_table(StringIO(data))
else:
data_df = pd.read_csv(StringIO(data))
big_df = pd.concat([big_df, data_df], ignore_index=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_sgx_daily.py#L20-L60
| 25 |
[
0
] | 2.439024 |
[
13,
14,
20,
21,
22,
23,
24,
25,
26,
28,
31,
32,
33,
34,
35,
36,
38,
39,
40
] | 46.341463 | false | 32.258065 | 41 | 5 | 53.658537 | 8 |
def futures_sgx_daily(
trade_date: str = "20200306", recent_day: str = "3"
) -> pd.DataFrame:
big_df = pd.DataFrame()
index_df = index_investing_global(
area="新加坡",
symbol="FTSE Singapore",
start_date="20200101",
end_date=trade_date,
)
index_df.sort_index(inplace=True)
index_df.reset_index(inplace=True)
index_df.reset_index(inplace=True)
index_df.index = index_df["index"] + 5840
date_start = index_df.index[-1] + 1 - int(recent_day)
date_end = index_df.index[-1] + 1
for page in tqdm(range(date_start, date_end)):
# page = 5883
url = (
f"https://links.sgx.com/1.0.0/derivatives-daily/{page}/FUTURE.zip"
)
r = requests.get(url)
with zipfile.ZipFile(BytesIO(r.content)) as file:
with file.open(file.namelist()[0]) as my_file:
data = my_file.read().decode()
if file.namelist()[0].endswith("txt"):
data_df = pd.read_table(StringIO(data))
else:
data_df = pd.read_csv(StringIO(data))
big_df = pd.concat([big_df, data_df], ignore_index=True)
return big_df
| 18,129 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_roll_yield.py
|
get_roll_yield
|
(date=None, var="BB", symbol1=None, symbol2=None, df=None)
|
指定交易日指定品种(主力和次主力)或任意两个合约的展期收益率
Parameters
------
date: string 某一天日期 format: YYYYMMDD
var: string 合约品种如 RB、AL 等
symbol1: string 合约 1 如 rb1810
symbol2: string 合约 2 如 rb1812
df: DataFrame或None 从dailyBar得到合约价格,如果为空就在函数内部抓dailyBar,直接喂给数据可以让计算加快
|
指定交易日指定品种(主力和次主力)或任意两个合约的展期收益率
Parameters
------
date: string 某一天日期 format: YYYYMMDD
var: string 合约品种如 RB、AL 等
symbol1: string 合约 1 如 rb1810
symbol2: string 合约 2 如 rb1812
df: DataFrame或None 从dailyBar得到合约价格,如果为空就在函数内部抓dailyBar,直接喂给数据可以让计算加快
| 22 | 74 |
def get_roll_yield(date=None, var="BB", symbol1=None, symbol2=None, df=None):
"""
指定交易日指定品种(主力和次主力)或任意两个合约的展期收益率
Parameters
------
date: string 某一天日期 format: YYYYMMDD
var: string 合约品种如 RB、AL 等
symbol1: string 合约 1 如 rb1810
symbol2: string 合约 2 如 rb1812
df: DataFrame或None 从dailyBar得到合约价格,如果为空就在函数内部抓dailyBar,直接喂给数据可以让计算加快
"""
# date = "20100104"
date = (
cons.convert_date(date) if date is not None else datetime.date.today()
)
if date.strftime("%Y%m%d") not in calendar:
warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
return None
if symbol1:
var = symbol_varieties(symbol1)
if not isinstance(df, pd.DataFrame):
market = symbol_market(var)
df = get_futures_daily(start_date=date, end_date=date, market=market)
if var:
df = df[
~df["symbol"].str.contains("efp")
] # 20200304 由于交易所获取的数据中会有比如 "CUefp",所以在这里过滤
df = df[df["variety"] == var].sort_values(
"open_interest", ascending=False
)
# df["close"] = df["close"].astype("float")
df["close"] = pd.to_numeric(df["close"])
if len(df["close"]) < 2:
return None
symbol1 = df["symbol"].tolist()[0]
symbol2 = df["symbol"].tolist()[1]
close1 = df["close"][df["symbol"] == symbol1].tolist()[0]
close2 = df["close"][df["symbol"] == symbol2].tolist()[0]
a = re.sub(r"\D", "", symbol1)
a_1 = int(a[:-2])
a_2 = int(a[-2:])
b = re.sub(r"\D", "", symbol2)
b_1 = int(b[:-2])
b_2 = int(b[-2:])
c = (a_1 - b_1) * 12 + (a_2 - b_2)
if close1 == 0 or close2 == 0:
return False
if c > 0:
return math.log(close2 / close1) / c * 12, symbol2, symbol1
else:
return math.log(close2 / close1) / c * 12, symbol1, symbol2
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_roll_yield.py#L22-L74
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11
] | 22.641509 |
[
12,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
27,
31,
32,
33,
34,
35,
37,
38,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
52
] | 58.490566 | false | 15.662651 | 53 | 9 | 41.509434 | 8 |
def get_roll_yield(date=None, var="BB", symbol1=None, symbol2=None, df=None):
# date = "20100104"
date = (
cons.convert_date(date) if date is not None else datetime.date.today()
)
if date.strftime("%Y%m%d") not in calendar:
warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
return None
if symbol1:
var = symbol_varieties(symbol1)
if not isinstance(df, pd.DataFrame):
market = symbol_market(var)
df = get_futures_daily(start_date=date, end_date=date, market=market)
if var:
df = df[
~df["symbol"].str.contains("efp")
] # 20200304 由于交易所获取的数据中会有比如 "CUefp",所以在这里过滤
df = df[df["variety"] == var].sort_values(
"open_interest", ascending=False
)
# df["close"] = df["close"].astype("float")
df["close"] = pd.to_numeric(df["close"])
if len(df["close"]) < 2:
return None
symbol1 = df["symbol"].tolist()[0]
symbol2 = df["symbol"].tolist()[1]
close1 = df["close"][df["symbol"] == symbol1].tolist()[0]
close2 = df["close"][df["symbol"] == symbol2].tolist()[0]
a = re.sub(r"\D", "", symbol1)
a_1 = int(a[:-2])
a_2 = int(a[-2:])
b = re.sub(r"\D", "", symbol2)
b_1 = int(b[:-2])
b_2 = int(b[-2:])
c = (a_1 - b_1) * 12 + (a_2 - b_2)
if close1 == 0 or close2 == 0:
return False
if c > 0:
return math.log(close2 / close1) / c * 12, symbol2, symbol1
else:
return math.log(close2 / close1) / c * 12, symbol1, symbol2
| 18,130 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_roll_yield.py
|
get_roll_yield_bar
|
(
type_method: str = "var",
var: str = "RB",
date: str = "20201030",
start_day: str = None,
end_day: str = None,
)
|
展期收益率
:param type_method: 'symbol': 获取指定交易日指定品种所有交割月合约的收盘价; 'var': 获取指定交易日所有品种两个主力合约的展期收益率(展期收益率横截面); 'date': 获取指定品种每天的两个主力合约的展期收益率(展期收益率时间序列)
:param var: 合约品种如 "RB", "AL" 等
:param date: 指定交易日 format: YYYYMMDD
:param start_day: 开始日期 format:YYYYMMDD
:param end_day: 结束日期 format:YYYYMMDD
:return: pandas.DataFrame
展期收益率数据(DataFrame)
ry 展期收益率
index 日期或品种
|
展期收益率
:param type_method: 'symbol': 获取指定交易日指定品种所有交割月合约的收盘价; 'var': 获取指定交易日所有品种两个主力合约的展期收益率(展期收益率横截面); 'date': 获取指定品种每天的两个主力合约的展期收益率(展期收益率时间序列)
:param var: 合约品种如 "RB", "AL" 等
:param date: 指定交易日 format: YYYYMMDD
:param start_day: 开始日期 format:YYYYMMDD
:param end_day: 结束日期 format:YYYYMMDD
:return: pandas.DataFrame
展期收益率数据(DataFrame)
ry 展期收益率
index 日期或品种
| 77 | 170 |
def get_roll_yield_bar(
type_method: str = "var",
var: str = "RB",
date: str = "20201030",
start_day: str = None,
end_day: str = None,
):
"""
展期收益率
:param type_method: 'symbol': 获取指定交易日指定品种所有交割月合约的收盘价; 'var': 获取指定交易日所有品种两个主力合约的展期收益率(展期收益率横截面); 'date': 获取指定品种每天的两个主力合约的展期收益率(展期收益率时间序列)
:param var: 合约品种如 "RB", "AL" 等
:param date: 指定交易日 format: YYYYMMDD
:param start_day: 开始日期 format:YYYYMMDD
:param end_day: 结束日期 format:YYYYMMDD
:return: pandas.DataFrame
展期收益率数据(DataFrame)
ry 展期收益率
index 日期或品种
"""
date = (
cons.convert_date(date) if date is not None else datetime.date.today()
)
start_day = (
cons.convert_date(start_day)
if start_day is not None
else datetime.date.today()
)
end_day = (
cons.convert_date(end_day)
if end_day is not None
else cons.convert_date(
cons.get_latest_data_date(datetime.datetime.now())
)
)
if type_method == "symbol":
df = get_futures_daily(
start_date=date, end_date=date, market=symbol_market(var)
)
df = df[df["variety"] == var]
return df
if type_method == "var":
df = pd.DataFrame()
for market in ["dce", "cffex", "shfe", "czce", "gfex"]:
df = pd.concat(
[
df,
get_futures_daily(
start_date=date, end_date=date, market=market
),
]
)
var_list = list(set(df["variety"]))
if "IO" in var_list:
var_list.remove("IO") # IO 为期权
df_l = pd.DataFrame()
for var in var_list:
ry = get_roll_yield(date, var, df=df)
if ry:
df_l = pd.concat(
[
df_l,
pd.DataFrame(
[ry],
index=[var],
columns=["roll_yield", "near_by", "deferred"],
),
]
)
df_l["date"] = date
df_l = df_l.sort_values("roll_yield")
return df_l
if type_method == "date":
df_l = pd.DataFrame()
while start_day <= end_day:
try:
ry = get_roll_yield(start_day, var)
if ry:
df_l = pd.concat(
[
df_l,
pd.DataFrame(
[ry],
index=[start_day],
columns=["roll_yield", "near_by", "deferred"],
),
]
)
except:
pass
start_day += datetime.timedelta(days=1)
return df_l
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_roll_yield.py#L77-L170
| 25 |
[
0
] | 1.06383 |
[
19,
22,
27,
35,
36,
39,
40,
42,
43,
44,
45,
53,
54,
55,
56,
57,
58,
59,
60,
70,
71,
72,
74,
75,
76,
77,
78,
79,
80,
90,
91,
92,
93
] | 35.106383 | false | 15.662651 | 94 | 11 | 64.893617 | 10 |
def get_roll_yield_bar(
type_method: str = "var",
var: str = "RB",
date: str = "20201030",
start_day: str = None,
end_day: str = None,
):
date = (
cons.convert_date(date) if date is not None else datetime.date.today()
)
start_day = (
cons.convert_date(start_day)
if start_day is not None
else datetime.date.today()
)
end_day = (
cons.convert_date(end_day)
if end_day is not None
else cons.convert_date(
cons.get_latest_data_date(datetime.datetime.now())
)
)
if type_method == "symbol":
df = get_futures_daily(
start_date=date, end_date=date, market=symbol_market(var)
)
df = df[df["variety"] == var]
return df
if type_method == "var":
df = pd.DataFrame()
for market in ["dce", "cffex", "shfe", "czce", "gfex"]:
df = pd.concat(
[
df,
get_futures_daily(
start_date=date, end_date=date, market=market
),
]
)
var_list = list(set(df["variety"]))
if "IO" in var_list:
var_list.remove("IO") # IO 为期权
df_l = pd.DataFrame()
for var in var_list:
ry = get_roll_yield(date, var, df=df)
if ry:
df_l = pd.concat(
[
df_l,
pd.DataFrame(
[ry],
index=[var],
columns=["roll_yield", "near_by", "deferred"],
),
]
)
df_l["date"] = date
df_l = df_l.sort_values("roll_yield")
return df_l
if type_method == "date":
df_l = pd.DataFrame()
while start_day <= end_day:
try:
ry = get_roll_yield(start_day, var)
if ry:
df_l = pd.concat(
[
df_l,
pd.DataFrame(
[ry],
index=[start_day],
columns=["roll_yield", "near_by", "deferred"],
),
]
)
except:
pass
start_day += datetime.timedelta(days=1)
return df_l
| 18,131 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/futures_news_baidu.py
|
futures_news_baidu
|
(symbol: str = "AL")
|
return temp_df
|
百度股市通-期货-新闻
https://gushitong.baidu.com/futures/ab-CJ888
:param symbol: 期货品种代码;大写
:type symbol: str
:return: 新闻
:rtype: pandas.DataFrame
|
百度股市通-期货-新闻
https://gushitong.baidu.com/futures/ab-CJ888
:param symbol: 期货品种代码;大写
:type symbol: str
:return: 新闻
:rtype: pandas.DataFrame
| 12 | 49 |
def futures_news_baidu(symbol: str = "AL") -> pd.DataFrame:
"""
百度股市通-期货-新闻
https://gushitong.baidu.com/futures/ab-CJ888
:param symbol: 期货品种代码;大写
:type symbol: str
:return: 新闻
:rtype: pandas.DataFrame
"""
url = "https://finance.pae.baidu.com/vapi/getfuturesnews"
params = {"code": f"{symbol}888", "pn": "0", "rn": "2000", "finClientType": "pc"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Result"])
temp_df.rename(
columns={
"loc": "-",
"provider": "-",
"source": "-",
"publish_time": "发布时间",
"third_url": "新闻链接",
"title": "标题",
"is_self_build": "-",
"news_id": "-",
"locate_url": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"标题",
"发布时间",
"新闻链接",
]
]
temp_df["发布时间"] = pd.to_datetime(temp_df["发布时间"], unit="s").dt.date
temp_df.sort_values(["发布时间"], inplace=True, ignore_index=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/futures_news_baidu.py#L12-L49
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 23.684211 |
[
9,
10,
11,
12,
13,
14,
28,
35,
36,
37
] | 26.315789 | false | 29.411765 | 38 | 1 | 73.684211 | 6 |
def futures_news_baidu(symbol: str = "AL") -> pd.DataFrame:
url = "https://finance.pae.baidu.com/vapi/getfuturesnews"
params = {"code": f"{symbol}888", "pn": "0", "rn": "2000", "finClientType": "pc"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Result"])
temp_df.rename(
columns={
"loc": "-",
"provider": "-",
"source": "-",
"publish_time": "发布时间",
"third_url": "新闻链接",
"title": "标题",
"is_self_build": "-",
"news_id": "-",
"locate_url": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"标题",
"发布时间",
"新闻链接",
]
]
temp_df["发布时间"] = pd.to_datetime(temp_df["发布时间"], unit="s").dt.date
temp_df.sort_values(["发布时间"], inplace=True, ignore_index=True)
return temp_df
| 18,132 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/futures/symbol_var.py
|
symbol_varieties
|
(contract_code: str)
|
return symbol_detail
|
查找到具体合约代码, 返回大写字母的品种名称
:param contract_code: ru1801
:return: RU
|
查找到具体合约代码, 返回大写字母的品种名称
:param contract_code: ru1801
:return: RU
| 12 | 21 |
def symbol_varieties(contract_code: str):
"""
查找到具体合约代码, 返回大写字母的品种名称
:param contract_code: ru1801
:return: RU
"""
symbol_detail = "".join(re.findall(r"\D", contract_code)).upper().strip()
if symbol_detail == "PTA":
symbol_detail = "TA"
return symbol_detail
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/futures/symbol_var.py#L12-L21
| 25 |
[
0,
1,
2,
3,
4,
5
] | 60 |
[
6,
7,
8,
9
] | 40 | false | 25.806452 | 10 | 2 | 60 | 3 |
def symbol_varieties(contract_code: str):
symbol_detail = "".join(re.findall(r"\D", contract_code)).upper().strip()
if symbol_detail == "PTA":
symbol_detail = "TA"
return symbol_detail
| 18,133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.