nwo
stringlengths 10
28
| sha
stringlengths 40
40
| path
stringlengths 11
97
| identifier
stringlengths 1
64
| parameters
stringlengths 2
2.24k
| return_statement
stringlengths 0
2.17k
| docstring
stringlengths 0
5.45k
| docstring_summary
stringlengths 0
3.83k
| func_begin
int64 1
13.4k
| func_end
int64 2
13.4k
| function
stringlengths 28
56.4k
| url
stringlengths 106
209
| project
int64 1
48
| executed_lines
list | executed_lines_pc
float64 0
153
| missing_lines
list | missing_lines_pc
float64 0
100
| covered
bool 2
classes | filecoverage
float64 2.53
100
| function_lines
int64 2
1.46k
| mccabe
int64 1
253
| coverage
float64 0
100
| docstring_lines
int64 0
112
| function_nodoc
stringlengths 9
56.4k
| id
int64 0
29.8k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_history_dividend
|
()
|
return temp_df
|
新浪财经-发行与分配-历史分红
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lsfh/index.phtml?p=1&num=5000
:return: 所有股票的历史分红数据
:rtype: pandas.DataFrame
|
新浪财经-发行与分配-历史分红
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lsfh/index.phtml?p=1&num=5000
:return: 所有股票的历史分红数据
:rtype: pandas.DataFrame
| 127 | 147 |
def stock_history_dividend() -> pd.DataFrame:
"""
新浪财经-发行与分配-历史分红
http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lsfh/index.phtml?p=1&num=5000
:return: 所有股票的历史分红数据
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lsfh/index.phtml"
params = {"p": "1", "num": "5000"}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df["代码"] = temp_df["代码"].astype(str).str.zfill(6)
temp_df.columns = ["代码", "名称", "上市日期", "累计股息", "年均股息", "分红次数", "融资总额", "融资次数", "详细"]
temp_df["上市日期"] = pd.to_datetime(temp_df["上市日期"]).dt.date
temp_df["累计股息"] = pd.to_numeric(temp_df["累计股息"])
temp_df["年均股息"] = pd.to_numeric(temp_df["年均股息"])
temp_df["分红次数"] = pd.to_numeric(temp_df["分红次数"])
temp_df["融资总额"] = pd.to_numeric(temp_df["融资总额"])
temp_df["融资次数"] = pd.to_numeric(temp_df["融资次数"])
del temp_df["详细"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L127-L147
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 33.333333 |
[
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
] | 66.666667 | false | 6.896552 | 21 | 1 | 33.333333 | 4 |
def stock_history_dividend() -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/lsfh/index.phtml"
params = {"p": "1", "num": "5000"}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df["代码"] = temp_df["代码"].astype(str).str.zfill(6)
temp_df.columns = ["代码", "名称", "上市日期", "累计股息", "年均股息", "分红次数", "融资总额", "融资次数", "详细"]
temp_df["上市日期"] = pd.to_datetime(temp_df["上市日期"]).dt.date
temp_df["累计股息"] = pd.to_numeric(temp_df["累计股息"])
temp_df["年均股息"] = pd.to_numeric(temp_df["年均股息"])
temp_df["分红次数"] = pd.to_numeric(temp_df["分红次数"])
temp_df["融资总额"] = pd.to_numeric(temp_df["融资总额"])
temp_df["融资次数"] = pd.to_numeric(temp_df["融资次数"])
del temp_df["详细"]
return temp_df
| 18,640 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_history_dividend_detail
|
(
symbol: str = "000002", indicator: str = "分红", date: str = ""
)
|
新浪财经-发行与分配-分红配股详情
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/300670.phtml
:param indicator: choice of {"分红", "配股"}
:type indicator: str
:param symbol: 股票代码
:type symbol: str
:param date: 分红配股的具体日期, e.g., "1994-12-24"
:type date: str
:return: 指定 indicator, stock, date 的数据
:rtype: pandas.DataFrame
|
新浪财经-发行与分配-分红配股详情
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/300670.phtml
:param indicator: choice of {"分红", "配股"}
:type indicator: str
:param symbol: 股票代码
:type symbol: str
:param date: 分红配股的具体日期, e.g., "1994-12-24"
:type date: str
:return: 指定 indicator, stock, date 的数据
:rtype: pandas.DataFrame
| 150 | 247 |
def stock_history_dividend_detail(
symbol: str = "000002", indicator: str = "分红", date: str = ""
) -> pd.DataFrame:
"""
新浪财经-发行与分配-分红配股详情
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/300670.phtml
:param indicator: choice of {"分红", "配股"}
:type indicator: str
:param symbol: 股票代码
:type symbol: str
:param date: 分红配股的具体日期, e.g., "1994-12-24"
:type date: str
:return: 指定 indicator, stock, date 的数据
:rtype: pandas.DataFrame
"""
if indicator == "分红":
url = f"http://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = [item[2] for item in temp_df.columns.tolist()]
temp_df.columns = [
"公告日期",
"送股",
"转增",
"派息",
"进度",
"除权除息日",
"股权登记日",
"红股上市日",
"查看详细",
]
del temp_df["查看详细"]
if temp_df.iloc[0, 0] == '暂时没有数据!':
return pd.DataFrame()
temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"]).dt.date
temp_df["送股"] = pd.to_numeric(temp_df["送股"])
temp_df["转增"] = pd.to_numeric(temp_df["转增"])
temp_df["派息"] = pd.to_numeric(temp_df["派息"])
temp_df["除权除息日"] = pd.to_datetime(temp_df["除权除息日"], errors="coerce").dt.date
temp_df["股权登记日"] = pd.to_datetime(temp_df["股权登记日"], errors="coerce").dt.date
temp_df["红股上市日"] = pd.to_datetime(temp_df["红股上市日"], errors="coerce").dt.date
if date:
url = "https://vip.stock.finance.sina.com.cn/corp/view/vISSUE_ShareBonusDetail.php"
params = {
"stockid": symbol,
"type": "1",
"end_date": date,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
else:
return temp_df
else:
url = f"http://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13]
temp_df.columns = [item[1] for item in temp_df.columns.tolist()]
temp_df.columns = [
"公告日期",
"配股方案",
"配股价格",
"基准股本",
"除权日",
"股权登记日",
"缴款起始日",
"缴款终止日",
"配股上市日",
"募集资金合计",
"查看详细",
]
del temp_df["查看详细"]
if temp_df.iloc[0, 0] == '暂时没有数据!':
return pd.DataFrame()
temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"]).dt.date
temp_df["配股方案"] = pd.to_numeric(temp_df["配股方案"])
temp_df["配股价格"] = pd.to_numeric(temp_df["配股价格"])
temp_df["基准股本"] = pd.to_numeric(temp_df["基准股本"])
temp_df["除权日"] = pd.to_datetime(temp_df["除权日"]).dt.date
temp_df["股权登记日"] = pd.to_datetime(temp_df["股权登记日"]).dt.date
temp_df["缴款起始日"] = pd.to_datetime(temp_df["缴款起始日"]).dt.date
temp_df["缴款终止日"] = pd.to_datetime(temp_df["缴款终止日"]).dt.date
temp_df["配股上市日"] = pd.to_datetime(temp_df["配股上市日"]).dt.date
temp_df["募集资金合计"] = pd.to_numeric(temp_df["募集资金合计"])
if date:
url = "https://vip.stock.finance.sina.com.cn/corp/view/vISSUE_ShareBonusDetail.php"
params = {
"stockid": symbol,
"type": "1",
"end_date": date,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
else:
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L150-L247
| 25 |
[
0
] | 1.020408 |
[
15,
16,
17,
18,
19,
20,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
48,
49,
50,
51,
53,
55,
56,
57,
58,
59,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
92,
93,
94,
95,
97
] | 51.020408 | false | 6.896552 | 98 | 8 | 48.979592 | 10 |
def stock_history_dividend_detail(
symbol: str = "000002", indicator: str = "分红", date: str = ""
) -> pd.DataFrame:
if indicator == "分红":
url = f"http://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = [item[2] for item in temp_df.columns.tolist()]
temp_df.columns = [
"公告日期",
"送股",
"转增",
"派息",
"进度",
"除权除息日",
"股权登记日",
"红股上市日",
"查看详细",
]
del temp_df["查看详细"]
if temp_df.iloc[0, 0] == '暂时没有数据!':
return pd.DataFrame()
temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"]).dt.date
temp_df["送股"] = pd.to_numeric(temp_df["送股"])
temp_df["转增"] = pd.to_numeric(temp_df["转增"])
temp_df["派息"] = pd.to_numeric(temp_df["派息"])
temp_df["除权除息日"] = pd.to_datetime(temp_df["除权除息日"], errors="coerce").dt.date
temp_df["股权登记日"] = pd.to_datetime(temp_df["股权登记日"], errors="coerce").dt.date
temp_df["红股上市日"] = pd.to_datetime(temp_df["红股上市日"], errors="coerce").dt.date
if date:
url = "https://vip.stock.finance.sina.com.cn/corp/view/vISSUE_ShareBonusDetail.php"
params = {
"stockid": symbol,
"type": "1",
"end_date": date,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
else:
return temp_df
else:
url = f"http://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_ShareBonus/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13]
temp_df.columns = [item[1] for item in temp_df.columns.tolist()]
temp_df.columns = [
"公告日期",
"配股方案",
"配股价格",
"基准股本",
"除权日",
"股权登记日",
"缴款起始日",
"缴款终止日",
"配股上市日",
"募集资金合计",
"查看详细",
]
del temp_df["查看详细"]
if temp_df.iloc[0, 0] == '暂时没有数据!':
return pd.DataFrame()
temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"]).dt.date
temp_df["配股方案"] = pd.to_numeric(temp_df["配股方案"])
temp_df["配股价格"] = pd.to_numeric(temp_df["配股价格"])
temp_df["基准股本"] = pd.to_numeric(temp_df["基准股本"])
temp_df["除权日"] = pd.to_datetime(temp_df["除权日"]).dt.date
temp_df["股权登记日"] = pd.to_datetime(temp_df["股权登记日"]).dt.date
temp_df["缴款起始日"] = pd.to_datetime(temp_df["缴款起始日"]).dt.date
temp_df["缴款终止日"] = pd.to_datetime(temp_df["缴款终止日"]).dt.date
temp_df["配股上市日"] = pd.to_datetime(temp_df["配股上市日"]).dt.date
temp_df["募集资金合计"] = pd.to_numeric(temp_df["募集资金合计"])
if date:
url = "https://vip.stock.finance.sina.com.cn/corp/view/vISSUE_ShareBonusDetail.php"
params = {
"stockid": symbol,
"type": "1",
"end_date": date,
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
else:
return temp_df
| 18,641 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_ipo_info
|
(stock: str = "600004")
|
return temp_df
|
新浪财经-发行与分配-新股发行
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_NewStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回新股发行详情
:rtype: pandas.DataFrame
|
新浪财经-发行与分配-新股发行
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_NewStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回新股发行详情
:rtype: pandas.DataFrame
| 250 | 263 |
def stock_ipo_info(stock: str = "600004") -> pd.DataFrame:
"""
新浪财经-发行与分配-新股发行
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_NewStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回新股发行详情
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_NewStock/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L250-L263
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 64.285714 |
[
9,
10,
11,
12,
13
] | 35.714286 | false | 6.896552 | 14 | 1 | 64.285714 | 6 |
def stock_ipo_info(stock: str = "600004") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_NewStock/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
temp_df.columns = ["item", "value"]
return temp_df
| 18,642 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_add_stock
|
(stock: str = "688166")
|
return big_df
|
新浪财经-发行与分配-增发
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_AddStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回增发详情
:rtype: pandas.DataFrame
|
新浪财经-发行与分配-增发
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_AddStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回增发详情
:rtype: pandas.DataFrame
| 266 | 286 |
def stock_add_stock(stock: str = "688166") -> pd.DataFrame:
"""
新浪财经-发行与分配-增发
https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_AddStock/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 返回增发详情
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_AddStock/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
if temp_df.at[0, 0] == "对不起,暂时没有相关增发记录":
return f"股票 {stock} 无增发记录"
big_df = pd.DataFrame()
for i in range(int(len(temp_df.at[0, 1]) / 10)):
temp_df = pd.read_html(r.text)[13 + i].iloc[:, 1]
big_df[temp_df.name.split(" ")[1].split(":")[1][:10]] = temp_df
big_df = big_df.T
big_df.columns = ["发行方式", "发行价格", "实际公司募集资金总额", "发行费用总额", "实际发行数量"]
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L266-L286
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 42.857143 |
[
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
] | 57.142857 | false | 6.896552 | 21 | 3 | 42.857143 | 6 |
def stock_add_stock(stock: str = "688166") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vISSUE_AddStock/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[12]
if temp_df.at[0, 0] == "对不起,暂时没有相关增发记录":
return f"股票 {stock} 无增发记录"
big_df = pd.DataFrame()
for i in range(int(len(temp_df.at[0, 1]) / 10)):
temp_df = pd.read_html(r.text)[13 + i].iloc[:, 1]
big_df[temp_df.name.split(" ")[1].split(":")[1][:10]] = temp_df
big_df = big_df.T
big_df.columns = ["发行方式", "发行价格", "实际公司募集资金总额", "发行费用总额", "实际发行数量"]
return big_df
| 18,643 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_restricted_release_queue_sina
|
(symbol: str = "600000")
|
return temp_df
|
新浪财经-发行分配-限售解禁
https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/xsjj/index.phtml?symbol=sh600000
:param symbol: 股票代码
:type symbol: str
:return: 返回限售解禁数据
:rtype: pandas.DataFrame
|
新浪财经-发行分配-限售解禁
https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/xsjj/index.phtml?symbol=sh600000
:param symbol: 股票代码
:type symbol: str
:return: 返回限售解禁数据
:rtype: pandas.DataFrame
| 289 | 308 |
def stock_restricted_release_queue_sina(symbol: str = "600000") -> pd.DataFrame:
"""
新浪财经-发行分配-限售解禁
https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/xsjj/index.phtml?symbol=sh600000
:param symbol: 股票代码
:type symbol: str
:return: 返回限售解禁数据
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/xsjj/index.phtml?symbol={symbol}"
r = requests.get(url)
temp_df = pd.read_html(r.text)[0]
temp_df.columns = ['代码', '名称', '解禁日期', '解禁数量', '解禁股流通市值', '上市批次', '公告日期']
temp_df['解禁日期'] = pd.to_datetime(temp_df['解禁日期']).dt.date
temp_df['公告日期'] = pd.to_datetime(temp_df['公告日期']).dt.date
temp_df['解禁数量'] = pd.to_numeric(temp_df['解禁数量'], errors="coerce")
temp_df['解禁股流通市值'] = pd.to_numeric(temp_df['解禁股流通市值'], errors="coerce")
temp_df['上市批次'] = pd.to_numeric(temp_df['上市批次'], errors="coerce")
temp_df['上市批次'] = pd.to_numeric(temp_df['上市批次'], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L289-L308
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 45 |
[
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
] | 55 | false | 6.896552 | 20 | 1 | 45 | 6 |
def stock_restricted_release_queue_sina(symbol: str = "600000") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/q/go.php/vInvestConsult/kind/xsjj/index.phtml?symbol={symbol}"
r = requests.get(url)
temp_df = pd.read_html(r.text)[0]
temp_df.columns = ['代码', '名称', '解禁日期', '解禁数量', '解禁股流通市值', '上市批次', '公告日期']
temp_df['解禁日期'] = pd.to_datetime(temp_df['解禁日期']).dt.date
temp_df['公告日期'] = pd.to_datetime(temp_df['公告日期']).dt.date
temp_df['解禁数量'] = pd.to_numeric(temp_df['解禁数量'], 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,644 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_circulate_stock_holder
|
(symbol: str = "600000")
|
return big_df
|
新浪财经-股东股本-流通股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/600000.phtml
:param symbol: 股票代码
:type symbol: str
:return: 新浪财经-股东股本-流通股东
:rtype: pandas.DataFrame
|
新浪财经-股东股本-流通股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/600000.phtml
:param symbol: 股票代码
:type symbol: str
:return: 新浪财经-股东股本-流通股东
:rtype: pandas.DataFrame
| 311 | 352 |
def stock_circulate_stock_holder(symbol: str = "600000") -> pd.DataFrame:
"""
新浪财经-股东股本-流通股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/600000.phtml
:param symbol: 股票代码
:type symbol: str
:return: 新浪财经-股东股本-流通股东
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截止日期") == 0].index.tolist() + [
len(temp_df)
]
for i in tqdm(range(len(need_range) - 1), leave=False):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[2:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat(
[temp_truncated, truncated_df.iloc[0, :], truncated_df.iloc[1, :]], axis=1
)
concat_df.columns = concat_df.iloc[0, :]
concat_df = concat_df.iloc[1:, :]
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="ffill")
concat_df["公告日期"] = concat_df["公告日期"].fillna(method="ffill")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df = big_df[["截止日期", "公告日期", "编号", "股东名称", "持股数量(股)", "占流通股比例(%)", "股本性质"]]
big_df.columns = ["截止日期", "公告日期", "编号", "股东名称", "持股数量", "占流通股比例", "股本性质"]
big_df['截止日期'] = pd.to_datetime(big_df['截止日期']).dt.date
big_df['公告日期'] = pd.to_datetime(big_df['公告日期']).dt.date
big_df['编号'] = pd.to_numeric(big_df['编号'], errors="coerce")
big_df['持股数量'] = pd.to_numeric(big_df['持股数量'], errors="coerce")
big_df['占流通股比例'] = pd.to_numeric(big_df['占流通股比例'], errors="coerce")
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L311-L352
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 23.809524 |
[
10,
11,
12,
13,
14,
15,
18,
19,
20,
21,
22,
23,
26,
27,
28,
29,
30,
32,
33,
35,
36,
37,
38,
39,
40,
41
] | 61.904762 | false | 6.896552 | 42 | 2 | 38.095238 | 7 |
def stock_circulate_stock_holder(symbol: str = "600000") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/{symbol}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截止日期") == 0].index.tolist() + [
len(temp_df)
]
for i in tqdm(range(len(need_range) - 1), leave=False):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[2:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat(
[temp_truncated, truncated_df.iloc[0, :], truncated_df.iloc[1, :]], axis=1
)
concat_df.columns = concat_df.iloc[0, :]
concat_df = concat_df.iloc[1:, :]
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="ffill")
concat_df["公告日期"] = concat_df["公告日期"].fillna(method="ffill")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df = big_df[["截止日期", "公告日期", "编号", "股东名称", "持股数量(股)", "占流通股比例(%)", "股本性质"]]
big_df.columns = ["截止日期", "公告日期", "编号", "股东名称", "持股数量", "占流通股比例", "股本性质"]
big_df['截止日期'] = pd.to_datetime(big_df['截止日期']).dt.date
big_df['公告日期'] = pd.to_datetime(big_df['公告日期']).dt.date
big_df['编号'] = pd.to_numeric(big_df['编号'], errors="coerce")
big_df['持股数量'] = pd.to_numeric(big_df['持股数量'], errors="coerce")
big_df['占流通股比例'] = pd.to_numeric(big_df['占流通股比例'], errors="coerce")
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,645 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_fund_stock_holder
|
(stock: str = "600004")
|
return big_df
|
新浪财经-股本股东-基金持股
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_FundStockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-基金持股
:rtype: pandas.DataFrame
|
新浪财经-股本股东-基金持股
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_FundStockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-基金持股
:rtype: pandas.DataFrame
| 355 | 384 |
def stock_fund_stock_holder(stock: str = "600004") -> pd.DataFrame:
"""
新浪财经-股本股东-基金持股
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_FundStockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-基金持股
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_FundStockHolder/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截止日期") == 0].index.tolist() + [
len(temp_df)
]
for i in range(len(need_range) - 1):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[2:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat([temp_truncated, truncated_df.iloc[0, 1:]], axis=1)
concat_df.columns = truncated_df.iloc[1, :].tolist() + ["截止日期"]
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="ffill")
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="bfill")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df.dropna(inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L355-L384
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 30 |
[
9,
10,
11,
12,
13,
14,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
] | 63.333333 | false | 6.896552 | 30 | 2 | 36.666667 | 6 |
def stock_fund_stock_holder(stock: str = "600004") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_FundStockHolder/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截止日期") == 0].index.tolist() + [
len(temp_df)
]
for i in range(len(need_range) - 1):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[2:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat([temp_truncated, truncated_df.iloc[0, 1:]], axis=1)
concat_df.columns = truncated_df.iloc[1, :].tolist() + ["截止日期"]
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="ffill")
concat_df["截止日期"] = concat_df["截止日期"].fillna(method="bfill")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df.dropna(inplace=True)
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,646 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_finance.py
|
stock_main_stock_holder
|
(stock: str = "600004")
|
return big_df
|
新浪财经-股本股东-主要股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-主要股东
:rtype: pandas.DataFrame
|
新浪财经-股本股东-主要股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-主要股东
:rtype: pandas.DataFrame
| 387 | 432 |
def stock_main_stock_holder(stock: str = "600004") -> pd.DataFrame:
"""
新浪财经-股本股东-主要股东
P.S. 特定股票特定时间只有前 5 个; e.g., 000002
https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockHolder/stockid/600004.phtml
:param stock: 股票代码
:type stock: str
:return: 新浪财经-股本股东-主要股东
:rtype: pandas.DataFrame
"""
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockHolder/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截至日期") == 0].index.tolist() + [
len(temp_df)
]
for i in range(len(need_range) - 1):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[5:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat(
[
temp_truncated,
truncated_df.iloc[0, :],
truncated_df.iloc[1, :],
truncated_df.iloc[2, :],
truncated_df.iloc[3, :],
truncated_df.iloc[4, :],
],
axis=1,
)
concat_df.columns = concat_df.iloc[0, :]
concat_df = concat_df.iloc[1:, :]
concat_df["截至日期"] = concat_df["截至日期"].fillna(method="ffill")
concat_df["公告日期"] = concat_df["公告日期"].fillna(method="ffill")
concat_df["股东总数"] = concat_df["股东总数"].fillna(method="ffill")
concat_df["平均持股数"] = concat_df["平均持股数"].fillna(method="ffill")
concat_df["股东总数"] = concat_df["股东总数"].str.strip("查看变化趋势")
concat_df["平均持股数"] = concat_df["平均持股数"].str.strip("(按总股本计算) 查看变化趋势")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df.dropna(inplace=True, how="all")
big_df.reset_index(inplace=True, drop=True)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_finance.py#L387-L432
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 21.73913 |
[
10,
11,
12,
13,
14,
15,
18,
19,
20,
21,
22,
23,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
] | 52.173913 | false | 6.896552 | 46 | 2 | 47.826087 | 7 |
def stock_main_stock_holder(stock: str = "600004") -> pd.DataFrame:
url = f"https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockHolder/stockid/{stock}.phtml"
r = requests.get(url)
temp_df = pd.read_html(r.text)[13].iloc[:, :5]
temp_df.columns = [*range(5)]
big_df = pd.DataFrame()
need_range = temp_df[temp_df.iloc[:, 0].str.find("截至日期") == 0].index.tolist() + [
len(temp_df)
]
for i in range(len(need_range) - 1):
truncated_df = temp_df.iloc[need_range[i] : need_range[i + 1], :]
truncated_df = truncated_df.dropna(how="all")
temp_truncated = truncated_df.iloc[5:, :]
temp_truncated.reset_index(inplace=True, drop=True)
concat_df = pd.concat(
[
temp_truncated,
truncated_df.iloc[0, :],
truncated_df.iloc[1, :],
truncated_df.iloc[2, :],
truncated_df.iloc[3, :],
truncated_df.iloc[4, :],
],
axis=1,
)
concat_df.columns = concat_df.iloc[0, :]
concat_df = concat_df.iloc[1:, :]
concat_df["截至日期"] = concat_df["截至日期"].fillna(method="ffill")
concat_df["公告日期"] = concat_df["公告日期"].fillna(method="ffill")
concat_df["股东总数"] = concat_df["股东总数"].fillna(method="ffill")
concat_df["平均持股数"] = concat_df["平均持股数"].fillna(method="ffill")
concat_df["股东总数"] = concat_df["股东总数"].str.strip("查看变化趋势")
concat_df["平均持股数"] = concat_df["平均持股数"].str.strip("(按总股本计算) 查看变化趋势")
big_df = pd.concat([big_df, concat_df], axis=0, ignore_index=True)
big_df.dropna(inplace=True, how="all")
big_df.reset_index(inplace=True, drop=True)
return big_df
| 18,647 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_hold.py
|
stock_institute_hold
|
(quarter: str = "20051")
|
return temp_df
|
新浪财经-股票-机构持股一览表
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 机构持股一览表
:rtype: pandas.DataFrame
|
新浪财经-股票-机构持股一览表
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 机构持股一览表
:rtype: pandas.DataFrame
| 13 | 34 |
def stock_institute_hold(quarter: str = "20051") -> pd.DataFrame:
"""
新浪财经-股票-机构持股一览表
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 机构持股一览表
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml?symbol=%D6%A4%C8%AF%BC%F2%B3%C6%BB%F2%B4%FA%C2%EB"
params = {
"p": "1",
"num": "5000",
"reportdate": quarter[:-1],
"quarter": quarter[-1],
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df["证券代码"] = temp_df["证券代码"].astype(str).str.zfill(6)
del temp_df["明细"]
temp_df.columns = ['证券代码', '证券简称', '机构数', '机构数变化', '持股比例', '持股比例增幅', '占流通股比例', '占流通股比例增幅']
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_hold.py#L13-L34
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 40.909091 |
[
9,
10,
16,
17,
18,
19,
20,
21
] | 36.363636 | false | 17.948718 | 22 | 1 | 63.636364 | 6 |
def stock_institute_hold(quarter: str = "20051") -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml?symbol=%D6%A4%C8%AF%BC%F2%B3%C6%BB%F2%B4%FA%C2%EB"
params = {
"p": "1",
"num": "5000",
"reportdate": quarter[:-1],
"quarter": quarter[-1],
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df["证券代码"] = temp_df["证券代码"].astype(str).str.zfill(6)
del temp_df["明细"]
temp_df.columns = ['证券代码', '证券简称', '机构数', '机构数变化', '持股比例', '持股比例增幅', '占流通股比例', '占流通股比例增幅']
return temp_df
| 18,649 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_hold.py
|
stock_institute_hold_detail
|
(stock: str = "600433", quarter: str = "20201")
|
新浪财经-股票-机构持股详情
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param stock: 股票代码
:type stock: str
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 指定股票和财报时间的机构持股数据
:rtype: pandas.DataFrame
|
新浪财经-股票-机构持股详情
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param stock: 股票代码
:type stock: str
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 指定股票和财报时间的机构持股数据
:rtype: pandas.DataFrame
| 37 | 83 |
def stock_institute_hold_detail(stock: str = "600433", quarter: str = "20201") -> pd.DataFrame:
"""
新浪财经-股票-机构持股详情
http://vip.stock.finance.sina.com.cn/q/go.php/vComStockHold/kind/jgcg/index.phtml
:param stock: 股票代码
:type stock: str
:param quarter: 从 2005 年开始, {"一季报":1, "中报":2 "三季报":3 "年报":4}, e.g., "20191", 其中的 1 表示一季报; "20193", 其中的 3 表示三季报;
:type quarter: str
:return: 指定股票和财报时间的机构持股数据
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/q/api/jsonp.php/var%20details=/ComStockHoldService.getJGCGDetail"
params = {
"symbol": stock,
"quarter": quarter,
}
r = requests.get(url, params=params)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{"):-2])
big_df = pd.DataFrame()
for item in json_data["data"].keys():
inner_temp_df = pd.DataFrame(json_data["data"][item]).T.iloc[:-1, :]
inner_temp_df.reset_index(inplace=True)
big_df = big_df.append(inner_temp_df, ignore_index=True)
if not big_df.empty:
big_df["index"] = big_df["index"].str.split("_", expand=True)[0]
big_df.rename(columns={"index": "institute"}, inplace=True)
big_df = big_df.iloc[:, :12]
big_df.columns = ["持股机构类型",
"持股机构代码",
"持股机构简称",
"持股机构全称",
"持股数",
"最新持股数",
"持股比例",
"最新持股比例",
"占流通股比例",
"最新占流通股比例",
"持股比例增幅",
"占流通股比例增幅",
]
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("fund", "基金")
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("socialSecurity", "全国社保")
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("qfii", "QFII")
return big_df
else:
return None
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_hold.py#L37-L83
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
] | 23.404255 |
[
11,
12,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
41,
42,
43,
44,
46
] | 42.553191 | false | 17.948718 | 47 | 3 | 57.446809 | 8 |
def stock_institute_hold_detail(stock: str = "600433", quarter: str = "20201") -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/q/api/jsonp.php/var%20details=/ComStockHoldService.getJGCGDetail"
params = {
"symbol": stock,
"quarter": quarter,
}
r = requests.get(url, params=params)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{"):-2])
big_df = pd.DataFrame()
for item in json_data["data"].keys():
inner_temp_df = pd.DataFrame(json_data["data"][item]).T.iloc[:-1, :]
inner_temp_df.reset_index(inplace=True)
big_df = big_df.append(inner_temp_df, ignore_index=True)
if not big_df.empty:
big_df["index"] = big_df["index"].str.split("_", expand=True)[0]
big_df.rename(columns={"index": "institute"}, inplace=True)
big_df = big_df.iloc[:, :12]
big_df.columns = ["持股机构类型",
"持股机构代码",
"持股机构简称",
"持股机构全称",
"持股数",
"最新持股数",
"持股比例",
"最新持股比例",
"占流通股比例",
"最新占流通股比例",
"持股比例增幅",
"占流通股比例增幅",
]
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("fund", "基金")
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("socialSecurity", "全国社保")
big_df["持股机构类型"] = big_df["持股机构类型"].str.replace("qfii", "QFII")
return big_df
else:
return None
| 18,650 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/stock_fundamental/stock_notice.py
|
stock_notice_report
|
(symbol: str = "全部", date: str = "20220511") ->
|
return big_df
|
东方财富网-数据中心-公告大全-沪深京 A 股公告
http://data.eastmoney.com/notices/hsa/5.html
:param symbol: 报告类型; choice of {"全部", "重大事项", "财务报告", "融资公告", "风险提示", "资产重组", "信息变更", "持股变动"}
:type symbol: str
:param date: 制定日期
:type date: str
:return: 沪深京 A 股公告
:rtype: pandas.DataFrame
|
东方财富网-数据中心-公告大全-沪深京 A 股公告
http://data.eastmoney.com/notices/hsa/5.html
:param symbol: 报告类型; choice of {"全部", "重大事项", "财务报告", "融资公告", "风险提示", "资产重组", "信息变更", "持股变动"}
:type symbol: str
:param date: 制定日期
:type date: str
:return: 沪深京 A 股公告
:rtype: pandas.DataFrame
| 13 | 103 |
def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.DataFrame:
"""
东方财富网-数据中心-公告大全-沪深京 A 股公告
http://data.eastmoney.com/notices/hsa/5.html
:param symbol: 报告类型; choice of {"全部", "重大事项", "财务报告", "融资公告", "风险提示", "资产重组", "信息变更", "持股变动"}
:type symbol: str
:param date: 制定日期
:type date: str
:return: 沪深京 A 股公告
:rtype: pandas.DataFrame
"""
url = "http://np-anotice-stock.eastmoney.com/api/security/ann"
report_map = {
"全部": "0",
"财务报告": "1",
"融资公告": "2",
"风险提示": "3",
"信息变更": "4",
"重大事项": "5",
"资产重组": "6",
"持股变动": "7",
}
params = {
"sr": "-1",
"page_size": "100",
"page_index": "1",
"ann_type": "SHA,CYB,SZA,BJA",
"client_source": "web",
"f_node": report_map[symbol],
"s_node": "0",
"begin_time": "-".join([date[:4], date[4:6], date[6:]]),
"end_time": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.get(url, params=params)
data_json = r.json()
import math
total_page = math.ceil(data_json["data"]["total_hits"] / 100)
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
params.update(
{
"page_index": page,
}
)
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
temp_codes_df = pd.DataFrame(
[item["codes"][0] for item in data_json["data"]["list"]]
)
try:
temp_columns_df = pd.DataFrame(
[item["columns"][0] for item in data_json["data"]["list"]]
)
except:
continue
del temp_df["codes"]
del temp_df["columns"]
temp_df = pd.concat([temp_df, temp_columns_df, temp_codes_df], axis=1)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.rename(
columns={
"art_code": "_",
"display_time": "-",
"eiTime": "-",
"notice_date": "公告日期",
"title": "公告标题",
"column_code": "-",
"column_name": "公告类型",
"ann_type": "-",
"inner_code": "-",
"market_code": "-",
"short_name": "名称",
"stock_code": "代码",
},
inplace=True,
)
big_df = big_df[
[
"代码",
"名称",
"公告标题",
"公告类型",
"公告日期",
]
]
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"]).dt.date
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/stock_fundamental/stock_notice.py#L13-L103
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
] | 12.087912 |
[
11,
12,
22,
33,
34,
35,
37,
39,
40,
41,
46,
47,
48,
49,
52,
53,
56,
57,
58,
59,
60,
61,
63,
80,
89,
90
] | 28.571429 | false | 15.789474 | 91 | 5 | 71.428571 | 8 |
def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.DataFrame:
url = "http://np-anotice-stock.eastmoney.com/api/security/ann"
report_map = {
"全部": "0",
"财务报告": "1",
"融资公告": "2",
"风险提示": "3",
"信息变更": "4",
"重大事项": "5",
"资产重组": "6",
"持股变动": "7",
}
params = {
"sr": "-1",
"page_size": "100",
"page_index": "1",
"ann_type": "SHA,CYB,SZA,BJA",
"client_source": "web",
"f_node": report_map[symbol],
"s_node": "0",
"begin_time": "-".join([date[:4], date[4:6], date[6:]]),
"end_time": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.get(url, params=params)
data_json = r.json()
import math
total_page = math.ceil(data_json["data"]["total_hits"] / 100)
big_df = pd.DataFrame()
for page in tqdm(range(1, int(total_page) + 1), leave=False):
params.update(
{
"page_index": page,
}
)
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["list"])
temp_codes_df = pd.DataFrame(
[item["codes"][0] for item in data_json["data"]["list"]]
)
try:
temp_columns_df = pd.DataFrame(
[item["columns"][0] for item in data_json["data"]["list"]]
)
except:
continue
del temp_df["codes"]
del temp_df["columns"]
temp_df = pd.concat([temp_df, temp_columns_df, temp_codes_df], axis=1)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.rename(
columns={
"art_code": "_",
"display_time": "-",
"eiTime": "-",
"notice_date": "公告日期",
"title": "公告标题",
"column_code": "-",
"column_name": "公告类型",
"ann_type": "-",
"inner_code": "-",
"market_code": "-",
"short_name": "名称",
"stock_code": "代码",
},
inplace=True,
)
big_df = big_df[
[
"代码",
"名称",
"公告标题",
"公告类型",
"公告日期",
]
]
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"]).dt.date
return big_df
| 18,651 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_index.py
|
get_qhkc_index
|
(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_URL):
|
return df_temp
|
奇货可查-指数-指数详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name 中文名称
:return: pd.DataFrame
date price volume ... margin profit long_short_ratio
2013-01-04 1000 260820 ... 1130485758 1816940 52.78
2013-01-07 998.244 245112 ... 1132228518 2514410 52.15
2013-01-08 1000.8 318866 ... 1160374489 2981010 51.99
2013-01-09 998.661 247352 ... 1166611242 3904220 52.44
2013-01-10 999.802 161292 ... 1153164771 1448190 52.81
... ... ... ... ... ... ...
2019-09-24 845.391 881138 ... 1895149977 128379050 48.5
2019-09-25 845.674 715180 ... 1797235248 128788230 48.29
2019-09-26 840.154 1347570 ... 1730488227 137104890 48.44
2019-09-27 834.831 920160 ... 1605342767 143128540 48.77
2019-09-30 831.959 1031558 ... 1521875378 147810580 48.82
|
奇货可查-指数-指数详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name 中文名称
:return: pd.DataFrame
date price volume ... margin profit long_short_ratio
2013-01-04 1000 260820 ... 1130485758 1816940 52.78
2013-01-07 998.244 245112 ... 1132228518 2514410 52.15
2013-01-08 1000.8 318866 ... 1160374489 2981010 51.99
2013-01-09 998.661 247352 ... 1166611242 3904220 52.44
2013-01-10 999.802 161292 ... 1153164771 1448190 52.81
... ... ... ... ... ... ...
2019-09-24 845.391 881138 ... 1895149977 128379050 48.5
2019-09-25 845.674 715180 ... 1797235248 128788230 48.29
2019-09-26 840.154 1347570 ... 1730488227 137104890 48.44
2019-09-27 834.831 920160 ... 1605342767 143128540 48.77
2019-09-30 831.959 1031558 ... 1521875378 147810580 48.82
| 20 | 70 |
def get_qhkc_index(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_URL):
"""
奇货可查-指数-指数详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name 中文名称
:return: pd.DataFrame
date price volume ... margin profit long_short_ratio
2013-01-04 1000 260820 ... 1130485758 1816940 52.78
2013-01-07 998.244 245112 ... 1132228518 2514410 52.15
2013-01-08 1000.8 318866 ... 1160374489 2981010 51.99
2013-01-09 998.661 247352 ... 1166611242 3904220 52.44
2013-01-10 999.802 161292 ... 1153164771 1448190 52.81
... ... ... ... ... ... ...
2019-09-24 845.391 881138 ... 1895149977 128379050 48.5
2019-09-25 845.674 715180 ... 1797235248 128788230 48.29
2019-09-26 840.154 1347570 ... 1730488227 137104890 48.44
2019-09-27 834.831 920160 ... 1605342767 143128540 48.77
2019-09-30 831.959 1031558 ... 1521875378 147810580 48.82
"""
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"id": name_id_dict[name]}
r = requests.post(url, data=payload_id)
print(name, "数据获取成功")
json_data = r.json()
date = json_data["data"]["date"]
price = json_data["data"]["price"]
volume = json_data["data"]["volume"]
open_interest = json_data["data"]["openint"]
total_value = json_data["data"]["total_value"]
profit = json_data["data"]["profit"]
long_short_ratio = json_data["data"]["line"]
df_temp = pd.DataFrame(
[date, price, volume, open_interest, total_value, profit, long_short_ratio]
).T
df_temp.columns = [
"date",
"price",
"volume",
"open_interest",
"margin",
"profit",
"long_short_ratio",
]
return df_temp
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_index.py#L20-L70
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
] | 39.215686 |
[
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
41,
50
] | 41.176471 | false | 12 | 51 | 4 | 58.823529 | 17 |
def get_qhkc_index(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_URL):
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"id": name_id_dict[name]}
r = requests.post(url, data=payload_id)
print(name, "数据获取成功")
json_data = r.json()
date = json_data["data"]["date"]
price = json_data["data"]["price"]
volume = json_data["data"]["volume"]
open_interest = json_data["data"]["openint"]
total_value = json_data["data"]["total_value"]
profit = json_data["data"]["profit"]
long_short_ratio = json_data["data"]["line"]
df_temp = pd.DataFrame(
[date, price, volume, open_interest, total_value, profit, long_short_ratio]
).T
df_temp.columns = [
"date",
"price",
"volume",
"open_interest",
"margin",
"profit",
"long_short_ratio",
]
return df_temp
| 18,652 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_index.py
|
get_qhkc_index_trend
|
(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_TREND_URL):
|
return df_temp
|
奇货可查-指数-大资金动向
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:return: pd.DataFrame
broker grade money open_order variety
中金期货 B -3.68209e+07 3.68209e+07 沪金
浙商期货 D -25845534 25845534 沪银
永安期货 A -25614000 25614000 沪银
招商期货 D -23517351 23517351 沪银
海通期货 A 21440845 21440845 沪金
美尔雅 D 21370975 21370975 沪金
中原期货 C -21204612 21204612 沪银
国投安信 A -1.52374e+07 1.52374e+07 沪银
中信期货 C 1.50941e+07 1.50941e+07 沪银
海通期货 A -1.47184e+07 1.47184e+07 沪银
方正中期 E -1.31432e+07 1.31432e+07 沪银
东证期货 D -1.283e+07 1.283e+07 沪银
一德期货 A 1.24973e+07 1.24973e+07 沪银
国投安信 A -11602860 11602860 沪金
国泰君安 B -1.09363e+07 1.09363e+07 沪金
华安期货 D -9.99499e+06 9.99499e+06 沪金
南华期货 B -9.23675e+06 9.23675e+06 沪银
国贸期货 B 8.55245e+06 8.55245e+06 沪银
道通期货 C 8527675 8527675 沪金
招商期货 D -7.85457e+06 7.85457e+06 沪金
东方财富 E -7.58235e+06 7.58235e+06 沪银
五矿经易 A 6.95354e+06 6.95354e+06 沪银
银河期货 B 6.84522e+06 6.84522e+06 沪银
国贸期货 B 6731025 6731025 沪金
平安期货 D -6710418 6710418 沪银
上海中期 C 6628800 6628800 沪金
中信期货 C -6345830 6345830 沪金
银河期货 B -6126295 6126295 沪金
华泰期货 A -5.96254e+06 5.96254e+06 沪金
招金期货 E -5.53029e+06 5.53029e+06 沪银
东证期货 D -5.47486e+06 5.47486e+06 沪金
光大期货 C -5334730 5334730 沪金
广发期货 D 5.31904e+06 5.31904e+06 沪金
国信期货 D -5.05211e+06 5.05211e+06 沪金
|
奇货可查-指数-大资金动向
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:return: pd.DataFrame
broker grade money open_order variety
中金期货 B -3.68209e+07 3.68209e+07 沪金
浙商期货 D -25845534 25845534 沪银
永安期货 A -25614000 25614000 沪银
招商期货 D -23517351 23517351 沪银
海通期货 A 21440845 21440845 沪金
美尔雅 D 21370975 21370975 沪金
中原期货 C -21204612 21204612 沪银
国投安信 A -1.52374e+07 1.52374e+07 沪银
中信期货 C 1.50941e+07 1.50941e+07 沪银
海通期货 A -1.47184e+07 1.47184e+07 沪银
方正中期 E -1.31432e+07 1.31432e+07 沪银
东证期货 D -1.283e+07 1.283e+07 沪银
一德期货 A 1.24973e+07 1.24973e+07 沪银
国投安信 A -11602860 11602860 沪金
国泰君安 B -1.09363e+07 1.09363e+07 沪金
华安期货 D -9.99499e+06 9.99499e+06 沪金
南华期货 B -9.23675e+06 9.23675e+06 沪银
国贸期货 B 8.55245e+06 8.55245e+06 沪银
道通期货 C 8527675 8527675 沪金
招商期货 D -7.85457e+06 7.85457e+06 沪金
东方财富 E -7.58235e+06 7.58235e+06 沪银
五矿经易 A 6.95354e+06 6.95354e+06 沪银
银河期货 B 6.84522e+06 6.84522e+06 沪银
国贸期货 B 6731025 6731025 沪金
平安期货 D -6710418 6710418 沪银
上海中期 C 6628800 6628800 沪金
中信期货 C -6345830 6345830 沪金
银河期货 B -6126295 6126295 沪金
华泰期货 A -5.96254e+06 5.96254e+06 沪金
招金期货 E -5.53029e+06 5.53029e+06 沪银
东证期货 D -5.47486e+06 5.47486e+06 沪金
光大期货 C -5334730 5334730 沪金
广发期货 D 5.31904e+06 5.31904e+06 沪金
国信期货 D -5.05211e+06 5.05211e+06 沪金
| 73 | 139 |
def get_qhkc_index_trend(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_TREND_URL):
"""
奇货可查-指数-大资金动向
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:return: pd.DataFrame
broker grade money open_order variety
中金期货 B -3.68209e+07 3.68209e+07 沪金
浙商期货 D -25845534 25845534 沪银
永安期货 A -25614000 25614000 沪银
招商期货 D -23517351 23517351 沪银
海通期货 A 21440845 21440845 沪金
美尔雅 D 21370975 21370975 沪金
中原期货 C -21204612 21204612 沪银
国投安信 A -1.52374e+07 1.52374e+07 沪银
中信期货 C 1.50941e+07 1.50941e+07 沪银
海通期货 A -1.47184e+07 1.47184e+07 沪银
方正中期 E -1.31432e+07 1.31432e+07 沪银
东证期货 D -1.283e+07 1.283e+07 沪银
一德期货 A 1.24973e+07 1.24973e+07 沪银
国投安信 A -11602860 11602860 沪金
国泰君安 B -1.09363e+07 1.09363e+07 沪金
华安期货 D -9.99499e+06 9.99499e+06 沪金
南华期货 B -9.23675e+06 9.23675e+06 沪银
国贸期货 B 8.55245e+06 8.55245e+06 沪银
道通期货 C 8527675 8527675 沪金
招商期货 D -7.85457e+06 7.85457e+06 沪金
东方财富 E -7.58235e+06 7.58235e+06 沪银
五矿经易 A 6.95354e+06 6.95354e+06 沪银
银河期货 B 6.84522e+06 6.84522e+06 沪银
国贸期货 B 6731025 6731025 沪金
平安期货 D -6710418 6710418 沪银
上海中期 C 6628800 6628800 沪金
中信期货 C -6345830 6345830 沪金
银河期货 B -6126295 6126295 沪金
华泰期货 A -5.96254e+06 5.96254e+06 沪金
招金期货 E -5.53029e+06 5.53029e+06 沪银
东证期货 D -5.47486e+06 5.47486e+06 沪金
光大期货 C -5334730 5334730 沪金
广发期货 D 5.31904e+06 5.31904e+06 沪金
国信期货 D -5.05211e+06 5.05211e+06 沪金
"""
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"page": 1, "limit": 10, "index": name_id_dict[name], "date": ""}
r = requests.post(url, data=payload_id)
print(f"{name}期货指数-大资金动向数据获取成功")
json_data = r.json()
df_temp = pd.DataFrame()
for item in json_data["data"]:
broker = item["broker"]
grade = item["grade"]
money = item["money"]
order_money = item["order_money"]
variety = item["variety"]
df_temp = df_temp.append(
pd.DataFrame([broker, grade, money, order_money, variety]).T
)
df_temp.columns = ["broker", "grade", "money", "open_order", "variety"]
df_temp.reset_index(drop=True, inplace=True)
return df_temp
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_index.py#L73-L139
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42
] | 64.179104 |
[
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
64,
65,
66
] | 32.835821 | false | 12 | 67 | 5 | 67.164179 | 40 |
def get_qhkc_index_trend(name: AnyStr = "奇货商品", url: AnyStr = QHKC_INDEX_TREND_URL):
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"page": 1, "limit": 10, "index": name_id_dict[name], "date": ""}
r = requests.post(url, data=payload_id)
print(f"{name}期货指数-大资金动向数据获取成功")
json_data = r.json()
df_temp = pd.DataFrame()
for item in json_data["data"]:
broker = item["broker"]
grade = item["grade"]
money = item["money"]
order_money = item["order_money"]
variety = item["variety"]
df_temp = df_temp.append(
pd.DataFrame([broker, grade, money, order_money, variety]).T
)
df_temp.columns = ["broker", "grade", "money", "open_order", "variety"]
df_temp.reset_index(drop=True, inplace=True)
return df_temp
| 18,653 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_index.py
|
get_qhkc_index_profit_loss
|
(
name: AnyStr = "奇货商品",
url: AnyStr = QHKC_INDEX_PROFIT_LOSS_URL,
start_date="",
end_date="",
)
|
return df_temp
|
奇货可查-指数-盈亏详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:param start_date: ""
:param end_date: "20190716" 指定 end_date 就可以了
:return: pd.DataFrame
indexes value trans_date
招金期货-沪金 -307489200 2019-09-30
平安期货-沪银 -195016650 2019-09-30
建信期货-沪银 -160327350 2019-09-30
国贸期货-沪银 -159820965 2019-09-30
东证期货-沪银 -123508635 2019-09-30
... ... ...
永安期货-沪银 187411350 2019-09-30
中信期货-沪金 242699750 2019-09-30
华泰期货-沪银 255766185 2019-09-30
永安期货-沪金 293008700 2019-09-30
国泰君安-沪金 302774950 2019-09-30
|
奇货可查-指数-盈亏详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:param start_date: ""
:param end_date: "20190716" 指定 end_date 就可以了
:return: pd.DataFrame
indexes value trans_date
招金期货-沪金 -307489200 2019-09-30
平安期货-沪银 -195016650 2019-09-30
建信期货-沪银 -160327350 2019-09-30
国贸期货-沪银 -159820965 2019-09-30
东证期货-沪银 -123508635 2019-09-30
... ... ...
永安期货-沪银 187411350 2019-09-30
中信期货-沪金 242699750 2019-09-30
华泰期货-沪银 255766185 2019-09-30
永安期货-沪金 293008700 2019-09-30
国泰君安-沪金 302774950 2019-09-30
| 142 | 185 |
def get_qhkc_index_profit_loss(
name: AnyStr = "奇货商品",
url: AnyStr = QHKC_INDEX_PROFIT_LOSS_URL,
start_date="",
end_date="",
):
"""
奇货可查-指数-盈亏详情
获得奇货可查的指数数据: '奇货黑链', '奇货商品', '奇货谷物', '奇货贵金属', '奇货饲料', '奇货软商品', '奇货化工', '奇货有色', '奇货股指', '奇货铁合金', '奇货油脂'
:param url: 网址
:param name None
:param start_date: ""
:param end_date: "20190716" 指定 end_date 就可以了
:return: pd.DataFrame
indexes value trans_date
招金期货-沪金 -307489200 2019-09-30
平安期货-沪银 -195016650 2019-09-30
建信期货-沪银 -160327350 2019-09-30
国贸期货-沪银 -159820965 2019-09-30
东证期货-沪银 -123508635 2019-09-30
... ... ...
永安期货-沪银 187411350 2019-09-30
中信期货-沪金 242699750 2019-09-30
华泰期货-沪银 255766185 2019-09-30
永安期货-沪金 293008700 2019-09-30
国泰君安-沪金 302774950 2019-09-30
"""
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"index": name_id_dict[name], "date1": start_date, "date2": end_date}
r = requests.post(url, data=payload_id)
print(f"{name}期货指数-盈亏分布数据获取成功")
json_data = r.json()
indexes = json_data["data"]["indexes"]
value = json_data["data"]["value"]
trans_date = [json_data["data"]["trans_date"]] * len(value)
df_temp = pd.DataFrame([indexes, value, trans_date]).T
df_temp.columns = ["indexes", "value", "trans_date"]
return df_temp
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_index.py#L142-L185
| 25 |
[
0
] | 2.272727 |
[
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43
] | 38.636364 | false | 12 | 44 | 4 | 61.363636 | 19 |
def get_qhkc_index_profit_loss(
name: AnyStr = "奇货商品",
url: AnyStr = QHKC_INDEX_PROFIT_LOSS_URL,
start_date="",
end_date="",
):
name_id_dict = {}
qhkc_index_url = "https://qhkch.com/ajax/official_indexes.php"
r = requests.post(qhkc_index_url)
display_name = [item["name"] for item in r.json()["data"]]
index_id = [item["id"] for item in r.json()["data"]]
for item in range(len(display_name)):
name_id_dict[display_name[item]] = index_id[item]
payload_id = {"index": name_id_dict[name], "date1": start_date, "date2": end_date}
r = requests.post(url, data=payload_id)
print(f"{name}期货指数-盈亏分布数据获取成功")
json_data = r.json()
indexes = json_data["data"]["indexes"]
value = json_data["data"]["value"]
trans_date = [json_data["data"]["trans_date"]] * len(value)
df_temp = pd.DataFrame([indexes, value, trans_date]).T
df_temp.columns = ["indexes", "value", "trans_date"]
return df_temp
| 18,654 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_tool.py
|
qhkc_tool_foreign
|
(url: AnyStr = QHKC_TOOL_FOREIGN_URL)
|
return temp_df
|
奇货可查-工具-外盘比价
实时更新数据, 暂不能查询历史数据
:param url: str 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
|
奇货可查-工具-外盘比价
实时更新数据, 暂不能查询历史数据
:param url: str 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
| 16 | 60 |
def qhkc_tool_foreign(url: AnyStr = QHKC_TOOL_FOREIGN_URL):
"""
奇货可查-工具-外盘比价
实时更新数据, 暂不能查询历史数据
:param url: str 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
"""
payload_id = {"page": 1, "limit": 10}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
name = []
base_time = []
base_price = []
latest_price = []
rate = []
for item in json_data["data"]:
name.append(item["name"])
base_time.append(item["base_time"])
base_price.append(item["base_price"])
latest_price.append(item["latest_price"])
rate.append(item["rate"])
temp_df = pd.DataFrame([name, base_time, base_price, latest_price, rate]).T
temp_df.columns = ["name", "base_time", "base_price", "latest_price", "rate"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_tool.py#L16-L60
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
] | 60 |
[
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44
] | 40 | false | 16.666667 | 45 | 2 | 60 | 24 |
def qhkc_tool_foreign(url: AnyStr = QHKC_TOOL_FOREIGN_URL):
payload_id = {"page": 1, "limit": 10}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
name = []
base_time = []
base_price = []
latest_price = []
rate = []
for item in json_data["data"]:
name.append(item["name"])
base_time.append(item["base_time"])
base_price.append(item["base_price"])
latest_price.append(item["latest_price"])
rate.append(item["rate"])
temp_df = pd.DataFrame([name, base_time, base_price, latest_price, rate]).T
temp_df.columns = ["name", "base_time", "base_price", "latest_price", "rate"]
return temp_df
| 18,655 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_tool.py
|
qhkc_tool_nebula
|
(url: AnyStr = QHKC_TOOL_FOREIGN_URL)
|
return temp_df
|
奇货可查-工具-龙虎星云图
:param url: 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
|
奇货可查-工具-龙虎星云图
:param url: 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
| 63 | 106 |
def qhkc_tool_nebula(url: AnyStr = QHKC_TOOL_FOREIGN_URL):
"""
奇货可查-工具-龙虎星云图
:param url: 网址
:return: pd.DataFrame
name base_time base_price latest_price rate
伦敦铜 10/08 01:00 5704 5746.5 0.745
伦敦锌 10/08 01:00 2291.25 2305.75 0.633
伦敦镍 10/08 01:00 17720 17372.5 -1.961
伦敦铝 10/08 01:00 1743.5 1742.75 -0.043
伦敦锡 10/07 15:00 16550 16290 -1.571
伦敦铅 10/08 01:00 2181.25 2177.5 -0.172
美原油1 10/08 02:30 52.81 53.05 0.454
美原油2 10/07 23:00 53.94 53.05 -1.65
布原油1 10/08 02:30 58.41 58.67 0.445
布原油2 10/07 23:00 59.54 58.67 -1.461
美燃油 10/07 23:00 1.9287 1.9102 -0.959
CMX金 10/08 02:30 1495.9 1496.5 0.04
CMX银 10/08 02:30 17.457 17.457 0
美豆 10/07 23:00 916.12 915.88 -0.026
美豆粕 10/07 23:00 302.75 302.65 -0.033
美豆油 10/07 23:00 30.02 29.91 -0.366
美玉米 10/07 23:00 386.38 387.88 0.388
美糖 10/07 23:30 12.37 12.53 1.293
美棉花 10/07 23:30 61.69 61.05 -1.037
"""
payload_id = {"page": 1, "limit": 10}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
name = []
base_time = []
base_price = []
latest_price = []
rate = []
for item in json_data["data"]:
name.append(item["name"])
base_time.append(item["base_time"])
base_price.append(item["base_price"])
latest_price.append(item["latest_price"])
rate.append(item["rate"])
temp_df = pd.DataFrame([name, base_time, base_price, latest_price, rate]).T
temp_df.columns = ["name", "base_time", "base_price", "latest_price", "rate"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_tool.py#L63-L106
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
] | 59.090909 |
[
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43
] | 40.909091 | false | 16.666667 | 44 | 2 | 59.090909 | 23 |
def qhkc_tool_nebula(url: AnyStr = QHKC_TOOL_FOREIGN_URL):
payload_id = {"page": 1, "limit": 10}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
name = []
base_time = []
base_price = []
latest_price = []
rate = []
for item in json_data["data"]:
name.append(item["name"])
base_time.append(item["base_time"])
base_price.append(item["base_price"])
latest_price.append(item["latest_price"])
rate.append(item["rate"])
temp_df = pd.DataFrame([name, base_time, base_price, latest_price, rate]).T
temp_df.columns = ["name", "base_time", "base_price", "latest_price", "rate"]
return temp_df
| 18,656 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_tool.py
|
qhkc_tool_gdp
|
(url: AnyStr = QHKC_TOOL_GDP_URL)
|
return data[0]
|
奇货可查-工具-各地区经济数据
实时更新数据, 暂不能查询历史数据
:param url:
:return: pandas.DataFrame
国家 国内生产总值 国内生产总值YoY 国内生产总值QoQ ... 预算 债务 经常账户 人口
美国 20494 2.30% 2.00% ... -3.80% 106.10% -2.40 327.17
欧元区 13670 1.20% 0.20% ... -0.50% 85.10% 2.90 341.15
中国 13608 6.20% 1.60% ... -4.20% 50.50% 0.40 1395.38
日本 4971 1.00% 0.30% ... -3.80% 238.20% 3.50 126.25
德国 3997 0.40% -0.10% ... 1.70% 60.90% 7.30 82.85
英国 2825 1.30% -0.20% ... -2.00% 84.70% -3.90 66.19
法国 2778 1.40% 0.30% ... -2.50% 98.40% -0.30 67.19
印度 2726 5.00% 1.00% ... -3.42% 68.30% -2.30 1298.04
意大利 2074 -0.10% 0.00% ... -2.10% 134.80% 2.50 60.48
巴西 1869 1.00% 0.40% ... -7.10% 77.22% -0.77 208.49
加拿大 1709 1.60% 0.90% ... -0.70% 90.60% -2.60 37.31
俄罗斯 1658 0.90% 0.20% ... 2.70% 13.50% 7.00 146.90
韩国 1619 2.00% 1.00% ... -1.60% 36.60% 4.70 51.61
澳大利亚 1432 1.40% 0.50% ... -0.60% 40.70% -1.50 25.18
西班牙 1426 2.00% 0.40% ... -2.50% 97.10% 0.90 46.66
墨西哥 1224 -0.80% 0.00% ... -2.00% 46.00% -1.80 125.33
印尼 1042 5.05% 4.20% ... -1.76% 29.80% -3.00 264.20
荷兰 913 1.80% 0.40% ... 1.50% 52.40% 10.80 17.12
沙特阿拉伯 782 0.50% 0.00% ... -9.20% 19.10% 9.20 33.41
土耳其 767 -1.50% 1.20% ... -2.00% 30.40% -3.50 82.00
瑞士 706 0.20% 0.30% ... 1.30% 27.70% 10.20 8.48
台湾 589 2.40% 0.67% ... -1.90% 30.90% 11.60 23.58
波兰 586 4.50% 0.80% ... -0.40% 48.90% -0.70 37.98
瑞典 551 1.00% 0.10% ... 0.90% 38.80% 2.00 10.12
比利时 532 1.20% 0.20% ... -0.70% 102.00% -1.30 11.41
阿根廷 519 0.60% -0.30% ... -5.50% 86.20% -5.40 44.50
泰国 505 2.30% 0.60% ... -2.50% 41.80% 7.50 66.41
委内瑞拉 482 -22.50% -5.40% ... -20.00% 23.00% 6.00 31.83
奥地利 456 1.50% 0.30% ... 0.10% 73.80% 2.30 8.82
伊朗 454 1.80% NaN ... -3.90% 44.20% 1.30 82.10
挪威 435 -0.70% 0.30% ... 7.30% 36.30% 8.10 5.30
阿联酋 414 2.20% 1.70% ... -1.80% 18.60% 9.10 9.60
尼日利亚 397 1.94% 2.85% ... -2.80% 18.20% 2.30 195.87
爱尔兰 376 5.80% 0.70% ... 0.00% 64.80% 9.10 4.84
以色列 370 3.20% 0.30% ... -1.90% 61.00% 1.90 8.97
南非 366 0.90% 3.10% ... -4.40% 55.80% -3.60 58.78
新加坡 364 0.10% -3.30% ... 0.40% 112.20% 17.70 5.64
香港 363 0.50% -0.40% ... 2.10% 38.40% 4.30 7.48
马来西亚 354 4.90% 1.00% ... -3.70% 51.80% 2.30 32.40
丹麦 351 2.60% 0.90% ... 0.50% 34.10% 6.10 5.78
菲律宾 331 5.50% 1.40% ... -3.20% 41.90% -2.40 107.00
哥伦比亚 330 3.00% 1.40% ... -3.10% 50.50% -3.80 49.83
巴基斯坦 313 5.20% 5.79% ... -6.60% 72.50% -4.80 212.22
智利 298 1.90% 0.80% ... -1.70% 25.60% -3.10 18.75
芬兰 276 1.20% 0.50% ... -0.70% 58.90% -1.90 5.51
孟加拉国 274 7.90% 7.90% ... -4.80% 27.90% -3.60 163.70
埃及 251 5.70% 5.40% ... -8.20% 90.50% -2.40 98.00
越南 245 7.31% 6.88% ... -3.50% 57.50% 3.00 94.67
捷克共和国 244 2.70% 0.70% ... 0.90% 32.70% 0.30 10.61
|
奇货可查-工具-各地区经济数据
实时更新数据, 暂不能查询历史数据
:param url:
:return: pandas.DataFrame
国家 国内生产总值 国内生产总值YoY 国内生产总值QoQ ... 预算 债务 经常账户 人口
美国 20494 2.30% 2.00% ... -3.80% 106.10% -2.40 327.17
欧元区 13670 1.20% 0.20% ... -0.50% 85.10% 2.90 341.15
中国 13608 6.20% 1.60% ... -4.20% 50.50% 0.40 1395.38
日本 4971 1.00% 0.30% ... -3.80% 238.20% 3.50 126.25
德国 3997 0.40% -0.10% ... 1.70% 60.90% 7.30 82.85
英国 2825 1.30% -0.20% ... -2.00% 84.70% -3.90 66.19
法国 2778 1.40% 0.30% ... -2.50% 98.40% -0.30 67.19
印度 2726 5.00% 1.00% ... -3.42% 68.30% -2.30 1298.04
意大利 2074 -0.10% 0.00% ... -2.10% 134.80% 2.50 60.48
巴西 1869 1.00% 0.40% ... -7.10% 77.22% -0.77 208.49
加拿大 1709 1.60% 0.90% ... -0.70% 90.60% -2.60 37.31
俄罗斯 1658 0.90% 0.20% ... 2.70% 13.50% 7.00 146.90
韩国 1619 2.00% 1.00% ... -1.60% 36.60% 4.70 51.61
澳大利亚 1432 1.40% 0.50% ... -0.60% 40.70% -1.50 25.18
西班牙 1426 2.00% 0.40% ... -2.50% 97.10% 0.90 46.66
墨西哥 1224 -0.80% 0.00% ... -2.00% 46.00% -1.80 125.33
印尼 1042 5.05% 4.20% ... -1.76% 29.80% -3.00 264.20
荷兰 913 1.80% 0.40% ... 1.50% 52.40% 10.80 17.12
沙特阿拉伯 782 0.50% 0.00% ... -9.20% 19.10% 9.20 33.41
土耳其 767 -1.50% 1.20% ... -2.00% 30.40% -3.50 82.00
瑞士 706 0.20% 0.30% ... 1.30% 27.70% 10.20 8.48
台湾 589 2.40% 0.67% ... -1.90% 30.90% 11.60 23.58
波兰 586 4.50% 0.80% ... -0.40% 48.90% -0.70 37.98
瑞典 551 1.00% 0.10% ... 0.90% 38.80% 2.00 10.12
比利时 532 1.20% 0.20% ... -0.70% 102.00% -1.30 11.41
阿根廷 519 0.60% -0.30% ... -5.50% 86.20% -5.40 44.50
泰国 505 2.30% 0.60% ... -2.50% 41.80% 7.50 66.41
委内瑞拉 482 -22.50% -5.40% ... -20.00% 23.00% 6.00 31.83
奥地利 456 1.50% 0.30% ... 0.10% 73.80% 2.30 8.82
伊朗 454 1.80% NaN ... -3.90% 44.20% 1.30 82.10
挪威 435 -0.70% 0.30% ... 7.30% 36.30% 8.10 5.30
阿联酋 414 2.20% 1.70% ... -1.80% 18.60% 9.10 9.60
尼日利亚 397 1.94% 2.85% ... -2.80% 18.20% 2.30 195.87
爱尔兰 376 5.80% 0.70% ... 0.00% 64.80% 9.10 4.84
以色列 370 3.20% 0.30% ... -1.90% 61.00% 1.90 8.97
南非 366 0.90% 3.10% ... -4.40% 55.80% -3.60 58.78
新加坡 364 0.10% -3.30% ... 0.40% 112.20% 17.70 5.64
香港 363 0.50% -0.40% ... 2.10% 38.40% 4.30 7.48
马来西亚 354 4.90% 1.00% ... -3.70% 51.80% 2.30 32.40
丹麦 351 2.60% 0.90% ... 0.50% 34.10% 6.10 5.78
菲律宾 331 5.50% 1.40% ... -3.20% 41.90% -2.40 107.00
哥伦比亚 330 3.00% 1.40% ... -3.10% 50.50% -3.80 49.83
巴基斯坦 313 5.20% 5.79% ... -6.60% 72.50% -4.80 212.22
智利 298 1.90% 0.80% ... -1.70% 25.60% -3.10 18.75
芬兰 276 1.20% 0.50% ... -0.70% 58.90% -1.90 5.51
孟加拉国 274 7.90% 7.90% ... -4.80% 27.90% -3.60 163.70
埃及 251 5.70% 5.40% ... -8.20% 90.50% -2.40 98.00
越南 245 7.31% 6.88% ... -3.50% 57.50% 3.00 94.67
捷克共和国 244 2.70% 0.70% ... 0.90% 32.70% 0.30 10.61
| 109 | 170 |
def qhkc_tool_gdp(url: AnyStr = QHKC_TOOL_GDP_URL):
"""
奇货可查-工具-各地区经济数据
实时更新数据, 暂不能查询历史数据
:param url:
:return: pandas.DataFrame
国家 国内生产总值 国内生产总值YoY 国内生产总值QoQ ... 预算 债务 经常账户 人口
美国 20494 2.30% 2.00% ... -3.80% 106.10% -2.40 327.17
欧元区 13670 1.20% 0.20% ... -0.50% 85.10% 2.90 341.15
中国 13608 6.20% 1.60% ... -4.20% 50.50% 0.40 1395.38
日本 4971 1.00% 0.30% ... -3.80% 238.20% 3.50 126.25
德国 3997 0.40% -0.10% ... 1.70% 60.90% 7.30 82.85
英国 2825 1.30% -0.20% ... -2.00% 84.70% -3.90 66.19
法国 2778 1.40% 0.30% ... -2.50% 98.40% -0.30 67.19
印度 2726 5.00% 1.00% ... -3.42% 68.30% -2.30 1298.04
意大利 2074 -0.10% 0.00% ... -2.10% 134.80% 2.50 60.48
巴西 1869 1.00% 0.40% ... -7.10% 77.22% -0.77 208.49
加拿大 1709 1.60% 0.90% ... -0.70% 90.60% -2.60 37.31
俄罗斯 1658 0.90% 0.20% ... 2.70% 13.50% 7.00 146.90
韩国 1619 2.00% 1.00% ... -1.60% 36.60% 4.70 51.61
澳大利亚 1432 1.40% 0.50% ... -0.60% 40.70% -1.50 25.18
西班牙 1426 2.00% 0.40% ... -2.50% 97.10% 0.90 46.66
墨西哥 1224 -0.80% 0.00% ... -2.00% 46.00% -1.80 125.33
印尼 1042 5.05% 4.20% ... -1.76% 29.80% -3.00 264.20
荷兰 913 1.80% 0.40% ... 1.50% 52.40% 10.80 17.12
沙特阿拉伯 782 0.50% 0.00% ... -9.20% 19.10% 9.20 33.41
土耳其 767 -1.50% 1.20% ... -2.00% 30.40% -3.50 82.00
瑞士 706 0.20% 0.30% ... 1.30% 27.70% 10.20 8.48
台湾 589 2.40% 0.67% ... -1.90% 30.90% 11.60 23.58
波兰 586 4.50% 0.80% ... -0.40% 48.90% -0.70 37.98
瑞典 551 1.00% 0.10% ... 0.90% 38.80% 2.00 10.12
比利时 532 1.20% 0.20% ... -0.70% 102.00% -1.30 11.41
阿根廷 519 0.60% -0.30% ... -5.50% 86.20% -5.40 44.50
泰国 505 2.30% 0.60% ... -2.50% 41.80% 7.50 66.41
委内瑞拉 482 -22.50% -5.40% ... -20.00% 23.00% 6.00 31.83
奥地利 456 1.50% 0.30% ... 0.10% 73.80% 2.30 8.82
伊朗 454 1.80% NaN ... -3.90% 44.20% 1.30 82.10
挪威 435 -0.70% 0.30% ... 7.30% 36.30% 8.10 5.30
阿联酋 414 2.20% 1.70% ... -1.80% 18.60% 9.10 9.60
尼日利亚 397 1.94% 2.85% ... -2.80% 18.20% 2.30 195.87
爱尔兰 376 5.80% 0.70% ... 0.00% 64.80% 9.10 4.84
以色列 370 3.20% 0.30% ... -1.90% 61.00% 1.90 8.97
南非 366 0.90% 3.10% ... -4.40% 55.80% -3.60 58.78
新加坡 364 0.10% -3.30% ... 0.40% 112.20% 17.70 5.64
香港 363 0.50% -0.40% ... 2.10% 38.40% 4.30 7.48
马来西亚 354 4.90% 1.00% ... -3.70% 51.80% 2.30 32.40
丹麦 351 2.60% 0.90% ... 0.50% 34.10% 6.10 5.78
菲律宾 331 5.50% 1.40% ... -3.20% 41.90% -2.40 107.00
哥伦比亚 330 3.00% 1.40% ... -3.10% 50.50% -3.80 49.83
巴基斯坦 313 5.20% 5.79% ... -6.60% 72.50% -4.80 212.22
智利 298 1.90% 0.80% ... -1.70% 25.60% -3.10 18.75
芬兰 276 1.20% 0.50% ... -0.70% 58.90% -1.90 5.51
孟加拉国 274 7.90% 7.90% ... -4.80% 27.90% -3.60 163.70
埃及 251 5.70% 5.40% ... -8.20% 90.50% -2.40 98.00
越南 245 7.31% 6.88% ... -3.50% 57.50% 3.00 94.67
捷克共和国 244 2.70% 0.70% ... 0.90% 32.70% 0.30 10.61
"""
data = pd.read_html(url, encoding="utf-8")
columns_list = data[0].columns.tolist()
columns_list[0] = "国家"
data[0].columns = columns_list
return data[0]
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_tool.py#L109-L170
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56
] | 91.935484 |
[
57,
58,
59,
60,
61
] | 8.064516 | false | 16.666667 | 62 | 1 | 91.935484 | 54 |
def qhkc_tool_gdp(url: AnyStr = QHKC_TOOL_GDP_URL):
data = pd.read_html(url, encoding="utf-8")
columns_list = data[0].columns.tolist()
columns_list[0] = "国家"
data[0].columns = columns_list
return data[0]
| 18,657 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_fund.py
|
get_qhkc_fund_bs
|
(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_BS_URL
)
|
return symbol_df, long_short_df
|
奇货可查-资金-净持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
|
奇货可查-资金-净持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
| 22 | 116 |
def get_qhkc_fund_bs(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_BS_URL
):
"""
奇货可查-资金-净持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
"""
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_fund.py#L22-L116
| 25 |
[
0
] | 1.052632 |
[
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94
] | 29.473684 | false | 9.322034 | 95 | 5 | 70.526316 | 62 |
def get_qhkc_fund_bs(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_BS_URL
):
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
| 18,658 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_fund.py
|
get_qhkc_fund_position
|
(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_POSITION_URL
)
|
return symbol_df, long_short_df
|
奇货可查-资金-总持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
|
奇货可查-资金-总持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
| 119 | 214 |
def get_qhkc_fund_position(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_POSITION_URL
):
"""
奇货可查-资金-总持仓分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
"""
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_fund.py#L119-L214
| 25 |
[
0
] | 1.041667 |
[
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95
] | 30.208333 | false | 9.322034 | 96 | 5 | 69.791667 | 62 |
def get_qhkc_fund_position(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_POSITION_URL
):
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
| 18,659 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_fund.py
|
get_qhkc_fund_position_change
|
(
date: datetime.datetime.date = "20190924",
url: AnyStr = QHKC_FUND_POSITION_CHANGE_URL,
)
|
return symbol_df, long_short_df
|
奇货可查-资金-净持仓变化分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
|
奇货可查-资金-净持仓变化分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
| 217 | 313 |
def get_qhkc_fund_position_change(
date: datetime.datetime.date = "20190924",
url: AnyStr = QHKC_FUND_POSITION_CHANGE_URL,
):
"""
奇货可查-资金-净持仓变化分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
symbol_df
name value ratio date
IC 1552535406 0.195622 20190924
IF 536644080 0.0676182 20190924
橡胶 536439921 0.0675924 20190924
沪铜 460851099 0.0580681 20190924
豆粕 401005794 0.0505275 20190924
螺纹钢 329159263 0.0414747 20190924
焦炭 325646968 0.0410321 20190924
燃料油 313246789 0.0394697 20190924
IH 245556750 0.0309406 20190924
棉花 214538541 0.0270323 20190924
PTA 206340552 0.0259993 20190924
白糖 139901255 0.0176278 20190924
豆油 133664010 0.0168419 20190924
沪铝 109789864 0.0138337 20190924
沪锌 107440906 0.0135378 20190924
纸浆 95517374 0.0120354 20190924
苹果 81058733 0.0102136 20190924
塑料 63665245 0.00802194 20190924
菜油 61544593 0.00775474 20190924
铁矿石 60751108 0.00765475 20190924
焦煤 58327920 0.00734943 20190924
甲醇 52148752 0.00657084 20190924
沥青 49207374 0.00620022 20190924
菜粕 48266258 0.00608164 20190924
棕榈油 31615548 0.00398362 20190924
PP 29374826 0.00370128 20190924
豆一 22368376 0.00281846 20190924
玉米 13861567 0.00174658 20190924
沪锡 7485903 0.000943238 20190924
淀粉 4811234 0.000606225 20190924
棉纱 3627240 0.000457039 20190924
尿素 2290674 0.000288629 20190924
鸡蛋 2035406 0.000256465 20190924
粳米 1999282 0.000251913 20190924
油菜籽 533482 6.72197e-05 20190924
晚籼稻 0 0 20190924
强麦 0 0 20190924
沪铅 89914 1.13293e-05 20190924
豆二 379200 4.77799e-05 20190924
硅铁 5025872 0.000633269 20190924
红枣 8521668 0.00107375 20190924
锰硅 9472832 0.00119359 20190924
郑煤 9888272 0.00124594 20190924
乙二醇 18324242 0.00230889 20190924
PVC 19454830 0.00245135 20190924
玻璃 27076226 0.00341166 20190924
热卷 28832929 0.003633 20190924
沪银 375076371 0.0472603 20190924
沪镍 411622624 0.0518652 20190924
沪金 719371823 0.0906422 20190924
long_short_df
name value ratio date
空 6303252093 0.794222 20190924
多 1633136803 0.205778 20190924
"""
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_fund.py#L217-L313
| 25 |
[
0
] | 1.030928 |
[
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95,
96
] | 29.896907 | false | 9.322034 | 97 | 5 | 70.103093 | 62 |
def get_qhkc_fund_position_change(
date: datetime.datetime.date = "20190924",
url: AnyStr = QHKC_FUND_POSITION_CHANGE_URL,
):
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas1"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas1"]:
symbol_value.append(item["value"])
long_short_name = []
for item in json_data["data"]["datas2"]:
long_short_name.append(item["name"])
long_short_value = []
for item in json_data["data"]["datas2"]:
long_short_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
long_short_df = pd.DataFrame([long_short_name, long_short_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
long_short_df.columns = ["name", "value"]
long_short_df["ratio"] = long_short_df["value"] / long_short_df["value"].sum()
long_short_df["date"] = date
return symbol_df, long_short_df
| 18,660 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/qhkc_web/qhkc_fund.py
|
get_qhkc_fund_money_change
|
(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_DEAL_URL
)
|
return symbol_df
|
奇货可查-资金-成交额分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
name value ratio date
沪镍 2.292e+10 0.145963 2019-09-25
沪银 1.22788e+10 0.0781956 2019-09-25
沪金 11196166005 0.0713011 2019-09-25
IC 1.10958e+10 0.0706619 2019-09-25
螺纹钢 1.02918e+10 0.0655416 2019-09-25
IF 9134893794 0.0581742 2019-09-25
铁矿石 7991427128 0.0508922 2019-09-25
原油 7695016910 0.0490045 2019-09-25
焦炭 5936589656 0.0378063 2019-09-25
甲醇 4.00966e+09 0.0255349 2019-09-25
沪铜 3806033147 0.0242381 2019-09-25
乙二醇 3.64376e+09 0.0232047 2019-09-25
橡胶 3286445958 0.0209292 2019-09-25
燃料油 3227355810 0.0205529 2019-09-25
豆粕 3124163112 0.0198958 2019-09-25
苹果 3.08134e+09 0.0196231 2019-09-25
沪锌 3076039116 0.0195893 2019-09-25
PTA 2.93901e+09 0.0187167 2019-09-25
IH 2578970688 0.0164238 2019-09-25
豆油 2371404714 0.0151019 2019-09-25
沥青 2.17662e+09 0.0138615 2019-09-25
白糖 1814626125 0.0115562 2019-09-25
棕榈油 1687834936 0.0107487 2019-09-25
菜粕 1.58244e+09 0.0100775 2019-09-25
焦煤 1.52553e+09 0.00971509 2019-09-25
PP 1.51981e+09 0.0096787 2019-09-25
塑料 1468988065 0.00935503 2019-09-25
沪铝 1.35968e+09 0.00865893 2019-09-25
不锈钢 1213656556 0.00772899 2019-09-25
棉花 1186243285 0.00755441 2019-09-25
鸡蛋 1175239681 0.00748433 2019-09-25
热卷 1.12293e+09 0.00715118 2019-09-25
纸浆 9.23876e+08 0.00588356 2019-09-25
沪铅 659297524 0.00419864 2019-09-25
菜油 587372274 0.00374059 2019-09-25
郑煤 5.82494e+08 0.00370953 2019-09-25
红枣 499089640 0.00317838 2019-09-25
玉米 458548474 0.0029202 2019-09-25
PVC 334434410 0.00212979 2019-09-25
玻璃 333819628 0.00212588 2019-09-25
沪锡 2.02186e+08 0.00128759 2019-09-25
豆二 185554169 0.00118167 2019-09-25
豆一 184729205 0.00117642 2019-09-25
硅铁 1.54719e+08 0.000985305 2019-09-25
淀粉 112331976 0.000715369 2019-09-25
锰硅 1.10791e+08 0.000705557 2019-09-25
尿素 78648750 0.000500862 2019-09-25
棉纱 5.17932e+07 0.000329837 2019-09-25
NR 34806750 0.000221661 2019-09-25
粳米 7375683 4.69709e-05 2019-09-25
油菜籽 2680922 1.7073e-05 2019-09-25
纤维板 2286460 1.4561e-05 2019-09-25
胶合板 831250 5.29369e-06 2019-09-25
强麦 472400 3.00841e-06 2019-09-25
晚籼稻 159318 1.01459e-06 2019-09-25
线材 90608 5.77023e-07 2019-09-25
粳稻 0 0 2019-09-25
普麦 0 0 2019-09-25
稻谷 0 0 2019-09-25
|
奇货可查-资金-成交额分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
name value ratio date
沪镍 2.292e+10 0.145963 2019-09-25
沪银 1.22788e+10 0.0781956 2019-09-25
沪金 11196166005 0.0713011 2019-09-25
IC 1.10958e+10 0.0706619 2019-09-25
螺纹钢 1.02918e+10 0.0655416 2019-09-25
IF 9134893794 0.0581742 2019-09-25
铁矿石 7991427128 0.0508922 2019-09-25
原油 7695016910 0.0490045 2019-09-25
焦炭 5936589656 0.0378063 2019-09-25
甲醇 4.00966e+09 0.0255349 2019-09-25
沪铜 3806033147 0.0242381 2019-09-25
乙二醇 3.64376e+09 0.0232047 2019-09-25
橡胶 3286445958 0.0209292 2019-09-25
燃料油 3227355810 0.0205529 2019-09-25
豆粕 3124163112 0.0198958 2019-09-25
苹果 3.08134e+09 0.0196231 2019-09-25
沪锌 3076039116 0.0195893 2019-09-25
PTA 2.93901e+09 0.0187167 2019-09-25
IH 2578970688 0.0164238 2019-09-25
豆油 2371404714 0.0151019 2019-09-25
沥青 2.17662e+09 0.0138615 2019-09-25
白糖 1814626125 0.0115562 2019-09-25
棕榈油 1687834936 0.0107487 2019-09-25
菜粕 1.58244e+09 0.0100775 2019-09-25
焦煤 1.52553e+09 0.00971509 2019-09-25
PP 1.51981e+09 0.0096787 2019-09-25
塑料 1468988065 0.00935503 2019-09-25
沪铝 1.35968e+09 0.00865893 2019-09-25
不锈钢 1213656556 0.00772899 2019-09-25
棉花 1186243285 0.00755441 2019-09-25
鸡蛋 1175239681 0.00748433 2019-09-25
热卷 1.12293e+09 0.00715118 2019-09-25
纸浆 9.23876e+08 0.00588356 2019-09-25
沪铅 659297524 0.00419864 2019-09-25
菜油 587372274 0.00374059 2019-09-25
郑煤 5.82494e+08 0.00370953 2019-09-25
红枣 499089640 0.00317838 2019-09-25
玉米 458548474 0.0029202 2019-09-25
PVC 334434410 0.00212979 2019-09-25
玻璃 333819628 0.00212588 2019-09-25
沪锡 2.02186e+08 0.00128759 2019-09-25
豆二 185554169 0.00118167 2019-09-25
豆一 184729205 0.00117642 2019-09-25
硅铁 1.54719e+08 0.000985305 2019-09-25
淀粉 112331976 0.000715369 2019-09-25
锰硅 1.10791e+08 0.000705557 2019-09-25
尿素 78648750 0.000500862 2019-09-25
棉纱 5.17932e+07 0.000329837 2019-09-25
NR 34806750 0.000221661 2019-09-25
粳米 7375683 4.69709e-05 2019-09-25
油菜籽 2680922 1.7073e-05 2019-09-25
纤维板 2286460 1.4561e-05 2019-09-25
胶合板 831250 5.29369e-06 2019-09-25
强麦 472400 3.00841e-06 2019-09-25
晚籼稻 159318 1.01459e-06 2019-09-25
线材 90608 5.77023e-07 2019-09-25
粳稻 0 0 2019-09-25
普麦 0 0 2019-09-25
稻谷 0 0 2019-09-25
| 316 | 404 |
def get_qhkc_fund_money_change(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_DEAL_URL
):
"""
奇货可查-资金-成交额分布
可获取数据的时间段为:"2016-10-10:2019-09-30"
:param url: 网址
:param date: 中文名称
:return: pd.DataFrame
name value ratio date
沪镍 2.292e+10 0.145963 2019-09-25
沪银 1.22788e+10 0.0781956 2019-09-25
沪金 11196166005 0.0713011 2019-09-25
IC 1.10958e+10 0.0706619 2019-09-25
螺纹钢 1.02918e+10 0.0655416 2019-09-25
IF 9134893794 0.0581742 2019-09-25
铁矿石 7991427128 0.0508922 2019-09-25
原油 7695016910 0.0490045 2019-09-25
焦炭 5936589656 0.0378063 2019-09-25
甲醇 4.00966e+09 0.0255349 2019-09-25
沪铜 3806033147 0.0242381 2019-09-25
乙二醇 3.64376e+09 0.0232047 2019-09-25
橡胶 3286445958 0.0209292 2019-09-25
燃料油 3227355810 0.0205529 2019-09-25
豆粕 3124163112 0.0198958 2019-09-25
苹果 3.08134e+09 0.0196231 2019-09-25
沪锌 3076039116 0.0195893 2019-09-25
PTA 2.93901e+09 0.0187167 2019-09-25
IH 2578970688 0.0164238 2019-09-25
豆油 2371404714 0.0151019 2019-09-25
沥青 2.17662e+09 0.0138615 2019-09-25
白糖 1814626125 0.0115562 2019-09-25
棕榈油 1687834936 0.0107487 2019-09-25
菜粕 1.58244e+09 0.0100775 2019-09-25
焦煤 1.52553e+09 0.00971509 2019-09-25
PP 1.51981e+09 0.0096787 2019-09-25
塑料 1468988065 0.00935503 2019-09-25
沪铝 1.35968e+09 0.00865893 2019-09-25
不锈钢 1213656556 0.00772899 2019-09-25
棉花 1186243285 0.00755441 2019-09-25
鸡蛋 1175239681 0.00748433 2019-09-25
热卷 1.12293e+09 0.00715118 2019-09-25
纸浆 9.23876e+08 0.00588356 2019-09-25
沪铅 659297524 0.00419864 2019-09-25
菜油 587372274 0.00374059 2019-09-25
郑煤 5.82494e+08 0.00370953 2019-09-25
红枣 499089640 0.00317838 2019-09-25
玉米 458548474 0.0029202 2019-09-25
PVC 334434410 0.00212979 2019-09-25
玻璃 333819628 0.00212588 2019-09-25
沪锡 2.02186e+08 0.00128759 2019-09-25
豆二 185554169 0.00118167 2019-09-25
豆一 184729205 0.00117642 2019-09-25
硅铁 1.54719e+08 0.000985305 2019-09-25
淀粉 112331976 0.000715369 2019-09-25
锰硅 1.10791e+08 0.000705557 2019-09-25
尿素 78648750 0.000500862 2019-09-25
棉纱 5.17932e+07 0.000329837 2019-09-25
NR 34806750 0.000221661 2019-09-25
粳米 7375683 4.69709e-05 2019-09-25
油菜籽 2680922 1.7073e-05 2019-09-25
纤维板 2286460 1.4561e-05 2019-09-25
胶合板 831250 5.29369e-06 2019-09-25
强麦 472400 3.00841e-06 2019-09-25
晚籼稻 159318 1.01459e-06 2019-09-25
线材 90608 5.77023e-07 2019-09-25
粳稻 0 0 2019-09-25
普麦 0 0 2019-09-25
稻谷 0 0 2019-09-25
"""
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas"]:
symbol_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
return symbol_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/qhkc_web/qhkc_fund.py#L316-L404
| 25 |
[
0
] | 1.123596 |
[
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88
] | 21.348315 | false | 9.322034 | 89 | 3 | 78.651685 | 65 |
def get_qhkc_fund_money_change(
date: datetime.datetime.date = "20190924", url: AnyStr = QHKC_FUND_DEAL_URL
):
date = str(date)
date = date[:4] + "-" + date[4:6] + "-" + date[6:]
print(date)
payload_id = {"date": date}
r = requests.post(url, data=payload_id)
print(url)
print("数据获取成功")
json_data = r.json()
symbol_name = []
for item in json_data["data"]["datas"]:
symbol_name.append(item["name"])
symbol_value = []
for item in json_data["data"]["datas"]:
symbol_value.append(item["value"])
symbol_df = pd.DataFrame([symbol_name, symbol_value]).T
symbol_df.columns = ["name", "value"]
symbol_df["ratio"] = symbol_df["value"] / symbol_df["value"].sum()
symbol_df["date"] = date
return symbol_df
| 18,661 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_aum_em.py
|
fund_aum_em
|
()
|
return temp_df
|
东方财富-基金-基金公司排名列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司排名列表
:rtype: pandas.DataFrame
|
东方财富-基金-基金公司排名列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司排名列表
:rtype: pandas.DataFrame
| 11 | 33 |
def fund_aum_em() -> pd.DataFrame:
"""
东方财富-基金-基金公司排名列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司排名列表
:rtype: pandas.DataFrame
"""
url = 'http://fund.eastmoney.com/Company/home/gspmlist'
params = {
'fundType': '0'
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
del temp_df['相关链接']
del temp_df['天相评级']
temp_df.columns = ['序号', '基金公司', '成立时间', '全部管理规模', '全部基金数', '全部经理数']
expanded_df = temp_df['全部管理规模'].str.split(' ', expand=True)
temp_df['全部管理规模'] = expanded_df.iloc[:, 0].str.replace(",", "")
temp_df['更新日期'] = expanded_df.iloc[:, 1]
temp_df['全部管理规模'] = pd.to_numeric(temp_df['全部管理规模'], errors="coerce")
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/fund/fund_aum_em.py#L11-L33
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 30.434783 |
[
7,
8,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22
] | 60.869565 | false | 14.583333 | 23 | 1 | 39.130435 | 4 |
def fund_aum_em() -> pd.DataFrame:
url = 'http://fund.eastmoney.com/Company/home/gspmlist'
params = {
'fundType': '0'
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
del temp_df['相关链接']
del temp_df['天相评级']
temp_df.columns = ['序号', '基金公司', '成立时间', '全部管理规模', '全部基金数', '全部经理数']
expanded_df = temp_df['全部管理规模'].str.split(' ', expand=True)
temp_df['全部管理规模'] = expanded_df.iloc[:, 0].str.replace(",", "")
temp_df['更新日期'] = expanded_df.iloc[:, 1]
temp_df['全部管理规模'] = pd.to_numeric(temp_df['全部管理规模'], errors="coerce")
temp_df['全部基金数'] = pd.to_numeric(temp_df['全部基金数'])
temp_df['全部经理数'] = pd.to_numeric(temp_df['全部经理数'])
return temp_df
| 18,662 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_aum_em.py
|
fund_aum_trend_em
|
()
|
return temp_df
|
东方财富-基金-基金市场管理规模走势图
http://fund.eastmoney.com/Company/default.html
:return: 基金市场管理规模走势图
:rtype: pandas.DataFrame
|
东方财富-基金-基金市场管理规模走势图
http://fund.eastmoney.com/Company/default.html
:return: 基金市场管理规模走势图
:rtype: pandas.DataFrame
| 36 | 52 |
def fund_aum_trend_em() -> pd.DataFrame:
"""
东方财富-基金-基金市场管理规模走势图
http://fund.eastmoney.com/Company/default.html
:return: 基金市场管理规模走势图
:rtype: pandas.DataFrame
"""
url = 'http://fund.eastmoney.com/Company/home/GetFundTotalScaleForChart'
payload = {
'fundType': '0'
}
r = requests.get(url, data=payload)
data_json = r.json()
temp_df = pd.DataFrame()
temp_df['date'] = data_json['x']
temp_df['value'] = data_json['y']
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_aum_em.py#L36-L52
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 41.176471 |
[
7,
8,
11,
12,
13,
14,
15,
16
] | 47.058824 | false | 14.583333 | 17 | 1 | 52.941176 | 4 |
def fund_aum_trend_em() -> pd.DataFrame:
url = 'http://fund.eastmoney.com/Company/home/GetFundTotalScaleForChart'
payload = {
'fundType': '0'
}
r = requests.get(url, data=payload)
data_json = r.json()
temp_df = pd.DataFrame()
temp_df['date'] = data_json['x']
temp_df['value'] = data_json['y']
return temp_df
| 18,663 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_aum_em.py
|
fund_aum_hist_em
|
(year: str = "2019")
|
return temp_df
|
东方财富-基金-基金公司历年管理规模排行列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司历年管理规模排行列表
:rtype: pandas.DataFrame
|
东方财富-基金-基金公司历年管理规模排行列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司历年管理规模排行列表
:rtype: pandas.DataFrame
| 55 | 76 |
def fund_aum_hist_em(year: str = "2019") -> pd.DataFrame:
"""
东方财富-基金-基金公司历年管理规模排行列表
http://fund.eastmoney.com/Company/lsgm.html
:return: 基金公司历年管理规模排行列表
:rtype: pandas.DataFrame
"""
url = 'http://fund.eastmoney.com/Company/home/HistoryScaleTable'
params = {
'year': year
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df.columns = ['序号', '基金公司', '总规模', '股票型', '混合型', '债券型', '指数型', 'QDII', '货币型']
temp_df['总规模'] = pd.to_numeric(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['QDII'] = pd.to_numeric(temp_df['QDII'], errors="coerce")
temp_df['货币型'] = pd.to_numeric(temp_df['货币型'], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_aum_em.py#L55-L76
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 31.818182 |
[
7,
8,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
] | 59.090909 | false | 14.583333 | 22 | 1 | 40.909091 | 4 |
def fund_aum_hist_em(year: str = "2019") -> pd.DataFrame:
url = 'http://fund.eastmoney.com/Company/home/HistoryScaleTable'
params = {
'year': year
}
r = requests.get(url, params=params)
temp_df = pd.read_html(r.text)[0]
temp_df.columns = ['序号', '基金公司', '总规模', '股票型', '混合型', '债券型', '指数型', 'QDII', '货币型']
temp_df['总规模'] = pd.to_numeric(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['QDII'] = pd.to_numeric(temp_df['QDII'], errors="coerce")
temp_df['货币型'] = pd.to_numeric(temp_df['货币型'], errors="coerce")
return temp_df
| 18,664 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_manager.py
|
fund_manager
|
(adjust: str = '0')
|
return big_df
|
天天基金网-基金数据-基金经理大全
http://fund.eastmoney.com/manager/default.html
:param adjust: 默认 adjust='0', 返回目标地址相同格式; adjust='1', 返回根据 `现任基金` 打散后的数据
:type adjust: str
:return: 基金经理大全
:rtype: pandas.DataFrame
|
天天基金网-基金数据-基金经理大全
http://fund.eastmoney.com/manager/default.html
:param adjust: 默认 adjust='0', 返回目标地址相同格式; adjust='1', 返回根据 `现任基金` 打散后的数据
:type adjust: str
:return: 基金经理大全
:rtype: pandas.DataFrame
| 15 | 94 |
def fund_manager(adjust: str = '0') -> pd.DataFrame:
"""
天天基金网-基金数据-基金经理大全
http://fund.eastmoney.com/manager/default.html
:param adjust: 默认 adjust='0', 返回目标地址相同格式; adjust='1', 返回根据 `现任基金` 打散后的数据
:type adjust: str
:return: 基金经理大全
:rtype: pandas.DataFrame
"""
big_df = pd.DataFrame()
url = "http://fund.eastmoney.com/Data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "14",
"mc": "returnjson",
"ft": "all",
"pn": "50",
"pi": "1",
"sc": "abbname",
"st": "asc",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var returnjson= "))
total_page = data_json["pages"]
for page in tqdm(range(1, total_page + 1), leave=False):
url = "http://fund.eastmoney.com/Data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "14",
"mc": "returnjson",
"ft": "all",
"pn": "50",
"pi": str(page),
"sc": "abbname",
"st": "asc",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var returnjson= "))
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
big_df.columns = [
"序号",
"_",
"姓名",
"_",
"所属公司",
"_",
"现任基金",
"累计从业时间",
"现任基金最佳回报",
"_",
"_",
"现任基金资产总规模",
"_",
]
big_df = big_df[
[
"序号",
"姓名",
"所属公司",
"现任基金",
"累计从业时间",
"现任基金资产总规模",
"现任基金最佳回报",
]
]
big_df["现任基金最佳回报"] = big_df["现任基金最佳回报"].str.split("%", expand=True).iloc[:, 0]
big_df["现任基金资产总规模"] = big_df["现任基金资产总规模"].str.split("亿元", expand=True).iloc[:, 0]
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")
if adjust == '1':
big_df['现任基金'] = big_df['现任基金'].apply(lambda x: x.split(','))
big_df = big_df.explode(column='现任基金')
big_df.reset_index(drop=True, inplace=True)
return big_df
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_manager.py#L15-L94
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 11.25 |
[
9,
10,
11,
20,
21,
22,
23,
24,
25,
26,
35,
36,
37,
38,
40,
41,
42,
43,
58,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79
] | 37.5 | false | 17.073171 | 80 | 3 | 62.5 | 6 |
def fund_manager(adjust: str = '0') -> pd.DataFrame:
big_df = pd.DataFrame()
url = "http://fund.eastmoney.com/Data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "14",
"mc": "returnjson",
"ft": "all",
"pn": "50",
"pi": "1",
"sc": "abbname",
"st": "asc",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var returnjson= "))
total_page = data_json["pages"]
for page in tqdm(range(1, total_page + 1), leave=False):
url = "http://fund.eastmoney.com/Data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "14",
"mc": "returnjson",
"ft": "all",
"pn": "50",
"pi": str(page),
"sc": "abbname",
"st": "asc",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var returnjson= "))
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
big_df.columns = [
"序号",
"_",
"姓名",
"_",
"所属公司",
"_",
"现任基金",
"累计从业时间",
"现任基金最佳回报",
"_",
"_",
"现任基金资产总规模",
"_",
]
big_df = big_df[
[
"序号",
"姓名",
"所属公司",
"现任基金",
"累计从业时间",
"现任基金资产总规模",
"现任基金最佳回报",
]
]
big_df["现任基金最佳回报"] = big_df["现任基金最佳回报"].str.split("%", expand=True).iloc[:, 0]
big_df["现任基金资产总规模"] = big_df["现任基金资产总规模"].str.split("亿元", expand=True).iloc[:, 0]
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")
if adjust == '1':
big_df['现任基金'] = big_df['现任基金'].apply(lambda x: x.split(','))
big_df = big_df.explode(column='现任基金')
big_df.reset_index(drop=True, inplace=True)
return big_df
return big_df
| 18,665 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_sina.py
|
fund_etf_category_sina
|
(symbol: str = "LOF基金") ->
|
return temp_df
|
新浪财经-基金列表
https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"封闭式基金", "ETF基金", "LOF基金"}
:type symbol: str
:return: 指定 symbol 的基金列表
:rtype: pandas.DataFrame
|
新浪财经-基金列表
https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"封闭式基金", "ETF基金", "LOF基金"}
:type symbol: str
:return: 指定 symbol 的基金列表
:rtype: pandas.DataFrame
| 16 | 109 |
def fund_etf_category_sina(symbol: str = "LOF基金") -> pd.DataFrame:
"""
新浪财经-基金列表
https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"封闭式基金", "ETF基金", "LOF基金"}
:type symbol: str
:return: 指定 symbol 的基金列表
:rtype: pandas.DataFrame
"""
fund_map = {
"封闭式基金": "close_fund",
"ETF基金": "etf_hq_fund",
"LOF基金": "lof_hq_fund",
}
url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/jsonp.php/IO.XSRV2.CallbackList['da_yPT46_Ll7K6WD']/Market_Center.getHQNodeDataSimple"
params = {
"page": "1",
"num": "1000",
"sort": "symbol",
"asc": "0",
"node": fund_map[symbol],
"[object HTMLDivElement]": "qvvne",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("([") + 1 : -2])
temp_df = pd.DataFrame(data_json)
if symbol == "封闭式基金":
temp_df.columns = [
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
"_",
"_",
]
else:
temp_df.columns = [
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["买入"] = pd.to_numeric(temp_df["买入"])
temp_df["卖出"] = pd.to_numeric(temp_df["卖出"])
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"])
temp_df["今开"] = pd.to_numeric(temp_df["今开"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_etf_sina.py#L16-L109
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 9.574468 |
[
9,
14,
15,
23,
24,
25,
26,
27,
28,
46,
65,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93
] | 24.468085 | false | 15.789474 | 94 | 2 | 75.531915 | 6 |
def fund_etf_category_sina(symbol: str = "LOF基金") -> pd.DataFrame:
fund_map = {
"封闭式基金": "close_fund",
"ETF基金": "etf_hq_fund",
"LOF基金": "lof_hq_fund",
}
url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/jsonp.php/IO.XSRV2.CallbackList['da_yPT46_Ll7K6WD']/Market_Center.getHQNodeDataSimple"
params = {
"page": "1",
"num": "1000",
"sort": "symbol",
"asc": "0",
"node": fund_map[symbol],
"[object HTMLDivElement]": "qvvne",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("([") + 1 : -2])
temp_df = pd.DataFrame(data_json)
if symbol == "封闭式基金":
temp_df.columns = [
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
"_",
"_",
]
else:
temp_df.columns = [
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"名称",
"最新价",
"涨跌额",
"涨跌幅",
"买入",
"卖出",
"昨收",
"今开",
"最高",
"最低",
"成交量",
"成交额",
]
]
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["买入"] = pd.to_numeric(temp_df["买入"])
temp_df["卖出"] = pd.to_numeric(temp_df["卖出"])
temp_df["昨收"] = pd.to_numeric(temp_df["昨收"])
temp_df["今开"] = pd.to_numeric(temp_df["今开"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
return temp_df
| 18,666 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_sina.py
|
fund_etf_hist_sina
|
(symbol: str = "sz159996")
|
return temp_df
|
新浪财经-基金-ETF 基金-日行情数据
https://finance.sina.com.cn/fund/quotes/159996/bc.shtml
:param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取
:type symbol: str
:return: 日行情数据
:rtype: pandas.DataFrame
|
新浪财经-基金-ETF 基金-日行情数据
https://finance.sina.com.cn/fund/quotes/159996/bc.shtml
:param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取
:type symbol: str
:return: 日行情数据
:rtype: pandas.DataFrame
| 112 | 137 |
def fund_etf_hist_sina(symbol: str = "sz159996") -> pd.DataFrame:
"""
新浪财经-基金-ETF 基金-日行情数据
https://finance.sina.com.cn/fund/quotes/159996/bc.shtml
:param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取
:type symbol: str
:return: 日行情数据
:rtype: pandas.DataFrame
"""
url = f"https://finance.sina.com.cn/realstock/company/{symbol}/hisdata/klc_kl.js"
r = requests.get(url)
js_code = py_mini_racer.MiniRacer()
js_code.eval(hk_js_decode)
dict_list = js_code.call(
"d", r.text.split("=")[1].split(";")[0].replace('"', "")
) # 执行js解密代码
temp_df = pd.DataFrame(dict_list)
if temp_df.empty: # 处理获取数据为空的问题
return pd.DataFrame()
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["open"] = pd.to_numeric(temp_df["open"])
temp_df["high"] = pd.to_numeric(temp_df["high"])
temp_df["low"] = pd.to_numeric(temp_df["low"])
temp_df["close"] = pd.to_numeric(temp_df["close"])
temp_df["volume"] = pd.to_numeric(temp_df["volume"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_etf_sina.py#L112-L137
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 34.615385 |
[
9,
10,
11,
12,
13,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
] | 57.692308 | false | 15.789474 | 26 | 2 | 42.307692 | 6 |
def fund_etf_hist_sina(symbol: str = "sz159996") -> pd.DataFrame:
url = f"https://finance.sina.com.cn/realstock/company/{symbol}/hisdata/klc_kl.js"
r = requests.get(url)
js_code = py_mini_racer.MiniRacer()
js_code.eval(hk_js_decode)
dict_list = js_code.call(
"d", r.text.split("=")[1].split(";")[0].replace('"', "")
) # 执行js解密代码
temp_df = pd.DataFrame(dict_list)
if temp_df.empty: # 处理获取数据为空的问题
return pd.DataFrame()
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["open"] = pd.to_numeric(temp_df["open"])
temp_df["high"] = pd.to_numeric(temp_df["high"])
temp_df["low"] = pd.to_numeric(temp_df["low"])
temp_df["close"] = pd.to_numeric(temp_df["close"])
temp_df["volume"] = pd.to_numeric(temp_df["volume"])
return temp_df
| 18,667 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_position_lg.py
|
fund_stock_position_lg
|
()
|
return temp_df
|
乐咕乐股-基金仓位-股票型基金仓位
https://legulegu.com/stockdata/fund-position/pos-stock
:return: 股票型基金仓位
:rtype: pandas.DataFrame
|
乐咕乐股-基金仓位-股票型基金仓位
https://legulegu.com/stockdata/fund-position/pos-stock
:return: 股票型基金仓位
:rtype: pandas.DataFrame
| 14 | 37 |
def fund_stock_position_lg() -> pd.DataFrame:
"""
乐咕乐股-基金仓位-股票型基金仓位
https://legulegu.com/stockdata/fund-position/pos-stock
:return: 股票型基金仓位
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_stock", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_position_lg.py#L14-L37
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 29.166667 |
[
7,
8,
9,
10,
11,
12,
13,
14,
21,
22,
23
] | 45.833333 | false | 17.021277 | 24 | 1 | 54.166667 | 4 |
def fund_stock_position_lg() -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_stock", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
| 18,668 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_position_lg.py
|
fund_balance_position_lg
|
()
|
return temp_df
|
乐咕乐股-基金仓位-平衡混合型基金仓位
https://legulegu.com/stockdata/fund-position/pos-pingheng
:return: 平衡混合型基金仓位
:rtype: pandas.DataFrame
|
乐咕乐股-基金仓位-平衡混合型基金仓位
https://legulegu.com/stockdata/fund-position/pos-pingheng
:return: 平衡混合型基金仓位
:rtype: pandas.DataFrame
| 40 | 63 |
def fund_balance_position_lg() -> pd.DataFrame:
"""
乐咕乐股-基金仓位-平衡混合型基金仓位
https://legulegu.com/stockdata/fund-position/pos-pingheng
:return: 平衡混合型基金仓位
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_pingheng", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_position_lg.py#L40-L63
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 29.166667 |
[
7,
8,
9,
10,
11,
12,
13,
14,
21,
22,
23
] | 45.833333 | false | 17.021277 | 24 | 1 | 54.166667 | 4 |
def fund_balance_position_lg() -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_pingheng", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
| 18,669 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_position_lg.py
|
fund_linghuo_position_lg
|
()
|
return temp_df
|
乐咕乐股-基金仓位-灵活配置型基金仓位
https://legulegu.com/stockdata/fund-position/pos-linghuo
:return: 灵活配置型基金仓位
:rtype: pandas.DataFrame
|
乐咕乐股-基金仓位-灵活配置型基金仓位
https://legulegu.com/stockdata/fund-position/pos-linghuo
:return: 灵活配置型基金仓位
:rtype: pandas.DataFrame
| 66 | 89 |
def fund_linghuo_position_lg() -> pd.DataFrame:
"""
乐咕乐股-基金仓位-灵活配置型基金仓位
https://legulegu.com/stockdata/fund-position/pos-linghuo
:return: 灵活配置型基金仓位
:rtype: pandas.DataFrame
"""
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_linghuo", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_position_lg.py#L66-L89
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 29.166667 |
[
7,
8,
9,
10,
11,
12,
13,
14,
21,
22,
23
] | 45.833333 | false | 17.021277 | 24 | 1 | 54.166667 | 4 |
def fund_linghuo_position_lg() -> pd.DataFrame:
url = "https://legulegu.com/api/stockdata/fund-position"
token = get_token_lg()
params = {"token": token, "type": "pos_linghuo", "category": "总仓位", "marketId": "5"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df = temp_df[
[
"date",
"close",
"position",
]
]
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
return temp_df
| 18,670 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rating.py
|
fund_rating_all
|
()
|
return temp_df
|
天天基金网-基金评级-基金评级总汇
http://fund.eastmoney.com/data/fundrating.html
:return: 基金评级总汇
:rtype: pandas.DataFrame
|
天天基金网-基金评级-基金评级总汇
http://fund.eastmoney.com/data/fundrating.html
:return: 基金评级总汇
:rtype: pandas.DataFrame
| 13 | 84 |
def fund_rating_all() -> pd.DataFrame:
"""
天天基金网-基金评级-基金评级总汇
http://fund.eastmoney.com/data/fundrating.html
:return: 基金评级总汇
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/fundrating.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[6]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"-",
"基金公司",
"-",
"5星评级家数",
"-",
"-",
"招商证券",
"-",
"上海证券",
"-",
"-",
"-",
"济安金信",
"-",
"手续费",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"5星评级家数",
"上海证券",
"招商证券",
"济安金信",
"手续费",
"类型",
]
]
temp_df["5星评级家数"] = pd.to_numeric(temp_df["5星评级家数"])
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["手续费"].str.strip("%")) / 100
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rating.py#L13-L84
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.722222 |
[
7,
8,
9,
10,
13,
23,
24,
52,
66,
67,
68,
69,
70,
71
] | 19.444444 | false | 11.392405 | 72 | 2 | 80.555556 | 4 |
def fund_rating_all() -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/fundrating.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[6]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"-",
"基金公司",
"-",
"5星评级家数",
"-",
"-",
"招商证券",
"-",
"上海证券",
"-",
"-",
"-",
"济安金信",
"-",
"手续费",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"5星评级家数",
"上海证券",
"招商证券",
"济安金信",
"手续费",
"类型",
]
]
temp_df["5星评级家数"] = pd.to_numeric(temp_df["5星评级家数"])
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["手续费"].str.strip("%")) / 100
return temp_df
| 18,671 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rating.py
|
fund_rating_sh
|
(date: str = "20200930")
|
return temp_df
|
天天基金网-基金评级-上海证券评级
http://fund.eastmoney.com/data/fundrating_3.html
:return: 上海证券评级
:rtype: pandas.DataFrame
|
天天基金网-基金评级-上海证券评级
http://fund.eastmoney.com/data/fundrating_3.html
:return: 上海证券评级
:rtype: pandas.DataFrame
| 87 | 165 |
def fund_rating_sh(date: str = "20200930") -> pd.DataFrame:
"""
天天基金网-基金评级-上海证券评级
http://fund.eastmoney.com/data/fundrating_3.html
:return: 上海证券评级
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/fundrating_3.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_3.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_3_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"5年期评级-5年评级",
"5年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"5年期评级-5年评级",
"5年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"类型",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rating.py#L87-L165
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.860759 |
[
7,
8,
9,
10,
14,
15,
16,
17,
18,
19,
20,
23,
33,
34,
58,
78
] | 20.253165 | false | 11.392405 | 79 | 4 | 79.746835 | 4 |
def fund_rating_sh(date: str = "20200930") -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/fundrating_3.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_3.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_3_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"5年期评级-5年评级",
"5年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"5年期评级-5年评级",
"5年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"类型",
]
]
return temp_df
| 18,672 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rating.py
|
fund_rating_zs
|
(date: str = "20201030")
|
return temp_df
|
天天基金网-基金评级-招商证券评级
http://fund.eastmoney.com/data/fundrating_2.html
:return: 招商证券评级-混合型
:rtype: pandas.DataFrame
|
天天基金网-基金评级-招商证券评级
http://fund.eastmoney.com/data/fundrating_2.html
:return: 招商证券评级-混合型
:rtype: pandas.DataFrame
| 168 | 241 |
def fund_rating_zs(date: str = "20201030") -> pd.DataFrame:
"""
天天基金网-基金评级-招商证券评级
http://fund.eastmoney.com/data/fundrating_2.html
:return: 招商证券评级-混合型
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/fundrating_2.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_2.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_2_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"_",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rating.py#L168-L241
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.459459 |
[
7,
8,
9,
10,
14,
15,
16,
17,
18,
19,
20,
23,
33,
34,
56,
73
] | 21.621622 | false | 11.392405 | 74 | 4 | 78.378378 | 4 |
def fund_rating_zs(date: str = "20201030") -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/fundrating_2.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_2.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_2_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"_",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
]
]
return temp_df
| 18,673 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rating.py
|
fund_rating_ja
|
(date: str = "20200930")
|
return temp_df
|
天天基金网-基金评级-济安金信评级
http://fund.eastmoney.com/data/fundrating_4.html
:return: 济安金信评级
:rtype: pandas.DataFrame
|
天天基金网-基金评级-济安金信评级
http://fund.eastmoney.com/data/fundrating_4.html
:return: 济安金信评级
:rtype: pandas.DataFrame
| 244 | 318 |
def fund_rating_ja(date: str = "20200930") -> pd.DataFrame:
"""
天天基金网-基金评级-济安金信评级
http://fund.eastmoney.com/data/fundrating_4.html
:return: 济安金信评级
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/fundrating_4.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_4.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_4_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"类型",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rating.py#L244-L318
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.333333 |
[
7,
8,
9,
10,
14,
15,
16,
17,
18,
19,
20,
23,
33,
34,
56,
74
] | 21.333333 | false | 11.392405 | 75 | 4 | 78.666667 | 4 |
def fund_rating_ja(date: str = "20200930") -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/fundrating_4.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
date_list = [
item["value"]
for item in soup.find("select", attrs={"id": "rqoptions"})
]
date_format = "-".join([date[:4], date[4:6], date[6:]])
if date_format not in date_list:
return "请访问 http://fund.eastmoney.com/data/fundrating_4.html 获取查询日期"
url = f"http://fund.eastmoney.com/data/fundrating_4_{'-'.join([date[:4], date[4:6], date[6:]])}.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
data_text = (
soup.find("div", attrs={"id": "fundinfo"}).find("script").string
)
data_content = [
item.split("|")
for item in data_text.split("var")[1]
.split("=")[1]
.strip()
.strip(";")
.strip('"')
.strip("|")
.split("|_")
]
temp_df = pd.DataFrame(data_content)
temp_df.columns = [
"代码",
"简称",
"类型",
"基金经理",
"_",
"基金公司",
"_",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"代码",
"简称",
"基金经理",
"基金公司",
"3年期评级-3年评级",
"3年期评级-较上期",
"单位净值",
"日期",
"日增长率",
"近1年涨幅",
"近3年涨幅",
"近5年涨幅",
"手续费",
"类型",
]
]
return temp_df
| 18,674 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
_get_pages
|
(url: str = "", payload: str = "")
|
return json_df["totalPages"]
|
中国证券投资基金业协会-信息公示-私募基金管理人公示 页数
暂时不使用本函数, 直接可以获取所有数据
|
中国证券投资基金业协会-信息公示-私募基金管理人公示 页数
暂时不使用本函数, 直接可以获取所有数据
| 17 | 28 |
def _get_pages(url: str = "", payload: str = "") -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-私募基金管理人公示 页数
暂时不使用本函数, 直接可以获取所有数据
"""
headers = {
"Content-Type": "application/json",
}
res = requests.post(url=url, json=payload, headers=headers, verify=False)
res.encoding = "utf-8"
json_df = res.json()
return json_df["totalPages"]
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L17-L28
| 25 |
[
0,
1,
2,
3,
4
] | 41.666667 |
[
5,
8,
9,
10,
11
] | 41.666667 | false | 6.811146 | 12 | 1 | 58.333333 | 2 |
def _get_pages(url: str = "", payload: str = "") -> pd.DataFrame:
headers = {
"Content-Type": "application/json",
}
res = requests.post(url=url, json=payload, headers=headers, verify=False)
res.encoding = "utf-8"
json_df = res.json()
return json_df["totalPages"]
| 18,675 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
get_data
|
(url: str = "", payload: str = "")
|
return json_df
|
中国证券投资基金业协会-信息公示-私募基金管理人公示
|
中国证券投资基金业协会-信息公示-私募基金管理人公示
| 31 | 41 |
def get_data(url: str = "", payload: str = "") -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-私募基金管理人公示
"""
headers = {
"Content-Type": "application/json",
}
res = requests.post(url=url, json=payload, headers=headers, verify=False)
res.encoding = "utf-8"
json_df = res.json()
return json_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L31-L41
| 25 |
[
0,
1,
2,
3
] | 36.363636 |
[
4,
7,
8,
9,
10
] | 45.454545 | false | 6.811146 | 11 | 1 | 54.545455 | 1 |
def get_data(url: str = "", payload: str = "") -> pd.DataFrame:
headers = {
"Content-Type": "application/json",
}
res = requests.post(url=url, json=payload, headers=headers, verify=False)
res.encoding = "utf-8"
json_df = res.json()
return json_df
| 18,676 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_member_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html
:return: 会员机构综合查询
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html
:return: 会员机构综合查询
:rtype: pandas.DataFrame
| 46 | 92 |
def amac_member_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html
:return: 会员机构综合查询
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"memberBehalf",
"memberType",
"memberCode",
"memberDate",
"primaryInvestType",
"markStar",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"机构(会员)名称",
"会员代表",
"会员类型",
"会员编号",
"入会时间",
"机构类型",
"是否星标",
]
manager_data_out["入会时间"] = pd.to_datetime(
manager_data_out["入会时间"], unit="ms"
).dt.date
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L46-L92
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.893617 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
32,
33,
34,
43,
46
] | 38.297872 | false | 6.811146 | 47 | 2 | 61.702128 | 4 |
def amac_member_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"memberBehalf",
"memberType",
"memberCode",
"memberDate",
"primaryInvestType",
"markStar",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"机构(会员)名称",
"会员代表",
"会员类型",
"会员编号",
"入会时间",
"机构类型",
"是否星标",
]
manager_data_out["入会时间"] = pd.to_datetime(
manager_data_out["入会时间"], unit="ms"
).dt.date
return manager_data_out
| 18,677 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_person_fund_org_list
|
(symbol: str = "公募基金管理公司") -> pd.DataFrame
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息
https://gs.amac.org.cn/amac-infodisc/res/pof/person/personOrgList.html
:param symbol: choice of {"公募基金管理公司", "公募基金管理公司资管子公司", "商业银行", "证券公司", "证券公司子公司", "私募基金管理人", "保险公司子公司", "保险公司", "外包服务机构", "期货公司", "期货公司资管子公司", "媒体机构", "证券投资咨询机构", "评价机构", "外资私募证券基金管理人", "支付结算", "独立服务机构", "地方自律组织", "境外机构", "律师事务所", "会计师事务所", "交易所", "独立第三方销售机构", "证券公司资管子公司", "证券公司私募基金子公司", "其他"}
:type symbol: str
:return: 基金从业人员资格注册信息
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息
https://gs.amac.org.cn/amac-infodisc/res/pof/person/personOrgList.html
:param symbol: choice of {"公募基金管理公司", "公募基金管理公司资管子公司", "商业银行", "证券公司", "证券公司子公司", "私募基金管理人", "保险公司子公司", "保险公司", "外包服务机构", "期货公司", "期货公司资管子公司", "媒体机构", "证券投资咨询机构", "评价机构", "外资私募证券基金管理人", "支付结算", "独立服务机构", "地方自律组织", "境外机构", "律师事务所", "会计师事务所", "交易所", "独立第三方销售机构", "证券公司资管子公司", "证券公司私募基金子公司", "其他"}
:type symbol: str
:return: 基金从业人员资格注册信息
:rtype: pandas.DataFrame
| 97 | 157 |
def amac_person_fund_org_list(symbol: str = "公募基金管理公司") -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息
https://gs.amac.org.cn/amac-infodisc/res/pof/person/personOrgList.html
:param symbol: choice of {"公募基金管理公司", "公募基金管理公司资管子公司", "商业银行", "证券公司", "证券公司子公司", "私募基金管理人", "保险公司子公司", "保险公司", "外包服务机构", "期货公司", "期货公司资管子公司", "媒体机构", "证券投资咨询机构", "评价机构", "外资私募证券基金管理人", "支付结算", "独立服务机构", "地方自律组织", "境外机构", "律师事务所", "会计师事务所", "交易所", "独立第三方销售机构", "证券公司资管子公司", "证券公司私募基金子公司", "其他"}
:type symbol: str
:return: 基金从业人员资格注册信息
:rtype: pandas.DataFrame
"""
from pypinyin import lazy_pinyin
pinyin_raw_list = lazy_pinyin(symbol)
symbol_trans = ''.join([item[0] for item in pinyin_raw_list])
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/personOrg"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(
url, params=params, json={"orgType": symbol_trans, "page": "1"}, verify=False
)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(
url, params=params, json={"orgType": symbol_trans, "page": "1"}, verify=False
)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"orgName",
"orgType",
"workerTotalNum",
"operNum",
"salesmanNum",
"investmentManagerNum",
"fundManagerNum",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.reset_index(inplace=True)
manager_data_out['index'] = manager_data_out.index + 1
manager_data_out.columns = [
"序号",
"机构名称",
"机构类型",
"员工人数",
"基金从业资格",
"基金销售业务资格",
"基金经理",
"投资经理",
]
manager_data_out['员工人数'] = pd.to_numeric(manager_data_out['员工人数'])
manager_data_out['基金从业资格'] = pd.to_numeric(manager_data_out['基金从业资格'])
manager_data_out['基金销售业务资格'] = pd.to_numeric(manager_data_out['基金销售业务资格'])
manager_data_out['基金经理'] = pd.to_numeric(manager_data_out['基金经理'])
manager_data_out['投资经理'] = pd.to_numeric(manager_data_out['投资经理'])
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L97-L157
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.754098 |
[
9,
10,
11,
12,
13,
18,
21,
22,
23,
24,
25,
26,
29,
30,
31,
32,
41,
42,
43,
44,
45,
55,
56,
57,
58,
59,
60
] | 44.262295 | false | 6.811146 | 61 | 3 | 55.737705 | 6 |
def amac_person_fund_org_list(symbol: str = "公募基金管理公司") -> pd.DataFrame:
from pypinyin import lazy_pinyin
pinyin_raw_list = lazy_pinyin(symbol)
symbol_trans = ''.join([item[0] for item in pinyin_raw_list])
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/personOrg"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(
url, params=params, json={"orgType": symbol_trans, "page": "1"}, verify=False
)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(
url, params=params, json={"orgType": symbol_trans, "page": "1"}, verify=False
)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"orgName",
"orgType",
"workerTotalNum",
"operNum",
"salesmanNum",
"investmentManagerNum",
"fundManagerNum",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.reset_index(inplace=True)
manager_data_out['index'] = manager_data_out.index + 1
manager_data_out.columns = [
"序号",
"机构名称",
"机构类型",
"员工人数",
"基金从业资格",
"基金销售业务资格",
"基金经理",
"投资经理",
]
manager_data_out['员工人数'] = pd.to_numeric(manager_data_out['员工人数'])
manager_data_out['基金从业资格'] = pd.to_numeric(manager_data_out['基金从业资格'])
manager_data_out['基金销售业务资格'] = pd.to_numeric(manager_data_out['基金销售业务资格'])
manager_data_out['基金经理'] = pd.to_numeric(manager_data_out['基金经理'])
manager_data_out['投资经理'] = pd.to_numeric(manager_data_out['投资经理'])
return manager_data_out
| 18,678 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_person_bond_org_list
|
()
|
return temp_df
|
中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示
https://human.amac.org.cn/web/org/personPublicity.html
:return: 债券投资交易相关人员公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示
https://human.amac.org.cn/web/org/personPublicity.html
:return: 债券投资交易相关人员公示
:rtype: pandas.DataFrame
| 161 | 191 |
def amac_person_bond_org_list() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示
https://human.amac.org.cn/web/org/personPublicity.html
:return: 债券投资交易相关人员公示
:rtype: pandas.DataFrame
"""
url = "https://human.amac.org.cn/web/api/publicityAddress"
params = {"rand": "0.1965383823100506", "pageNum": "0", "pageSize": "5000"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["list"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"_",
"_",
"机构名称",
"机构类型",
"公示网址",
]
temp_df = temp_df[
[
"序号",
"机构类型",
"机构名称",
"公示网址",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L161-L191
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 22.580645 |
[
7,
8,
9,
10,
11,
12,
13,
14,
22,
30
] | 32.258065 | false | 6.811146 | 31 | 1 | 67.741935 | 4 |
def amac_person_bond_org_list() -> pd.DataFrame:
url = "https://human.amac.org.cn/web/api/publicityAddress"
params = {"rand": "0.1965383823100506", "pageNum": "0", "pageSize": "5000"}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["list"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.columns = [
"序号",
"_",
"_",
"机构名称",
"机构类型",
"公示网址",
]
temp_df = temp_df[
[
"序号",
"机构类型",
"机构名称",
"公示网址",
]
]
return temp_df
| 18,679 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_manager_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/index.html
:return: 私募基金管理人综合查询
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/index.html
:return: 私募基金管理人综合查询
:rtype: pandas.DataFrame
| 196 | 245 |
def amac_manager_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/index.html
:return: 私募基金管理人综合查询
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"artificialPersonName",
"primaryInvestType",
"registerProvince",
"registerNo",
"establishDate",
"registerDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"私募基金管理人名称",
"法定代表人/执行事务合伙人(委派代表)姓名",
"机构类型",
"注册地",
"登记编号",
"成立时间",
"登记时间",
]
manager_data_out["成立时间"] = pd.to_datetime(
manager_data_out["成立时间"], unit="ms"
).dt.date
manager_data_out["登记时间"] = pd.to_datetime(
manager_data_out["登记时间"], unit="ms"
).dt.date
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L196-L245
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
32,
33,
34,
43,
46,
49
] | 38 | false | 6.811146 | 50 | 2 | 62 | 4 |
def amac_manager_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"artificialPersonName",
"primaryInvestType",
"registerProvince",
"registerNo",
"establishDate",
"registerDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"私募基金管理人名称",
"法定代表人/执行事务合伙人(委派代表)姓名",
"机构类型",
"注册地",
"登记编号",
"成立时间",
"登记时间",
]
manager_data_out["成立时间"] = pd.to_datetime(
manager_data_out["成立时间"], unit="ms"
).dt.date
manager_data_out["登记时间"] = pd.to_datetime(
manager_data_out["登记时间"], unit="ms"
).dt.date
return manager_data_out
| 18,680 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_manager_classify_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/managerList.html
:return: 私募基金管理人分类公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/managerList.html
:return: 私募基金管理人分类公示
:rtype: pandas.DataFrame
| 249 | 311 |
def amac_manager_classify_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示
http://gs.amac.org.cn/amac-infodisc/res/pof/manager/managerList.html
:return: 私募基金管理人分类公示
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
keys_list = [
"managerName",
"artificialPersonName",
"primaryInvestType",
"registerNo",
"registerProvince",
"officeAdrAgg",
"establishDate",
"registerDate",
"fundCount",
"memberType",
"hasSpecialTips",
"hasCreditTips",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"私募基金管理人名称",
"法定代表人/执行事务合伙人(委派代表)姓名",
"机构类型",
"登记编号",
"注册地",
"办公地",
"成立时间",
"登记时间",
"在管基金数量",
"会员类型",
"是否有提示信息",
"是否有诚信信息",
]
manager_data_out["成立时间"] = pd.to_datetime(
manager_data_out["成立时间"], unit="ms"
).dt.date
manager_data_out["登记时间"] = pd.to_datetime(
manager_data_out["登记时间"], unit="ms"
).dt.date
manager_data_out["在管基金数量"] = pd.to_numeric(manager_data_out["在管基金数量"])
manager_data_out["是否有提示信息"] = manager_data_out["是否有提示信息"].map({True: "是", False: "否"})
manager_data_out["是否有诚信信息"] = manager_data_out["是否有诚信信息"].map({True: "是", False: "否"})
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L249-L311
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.111111 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
37,
38,
39,
53,
56,
59,
60,
61,
62
] | 34.920635 | false | 6.811146 | 63 | 2 | 65.079365 | 4 |
def amac_manager_classify_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = pd.concat([big_df, temp_df], ignore_index=True)
keys_list = [
"managerName",
"artificialPersonName",
"primaryInvestType",
"registerNo",
"registerProvince",
"officeAdrAgg",
"establishDate",
"registerDate",
"fundCount",
"memberType",
"hasSpecialTips",
"hasCreditTips",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"私募基金管理人名称",
"法定代表人/执行事务合伙人(委派代表)姓名",
"机构类型",
"登记编号",
"注册地",
"办公地",
"成立时间",
"登记时间",
"在管基金数量",
"会员类型",
"是否有提示信息",
"是否有诚信信息",
]
manager_data_out["成立时间"] = pd.to_datetime(
manager_data_out["成立时间"], unit="ms"
).dt.date
manager_data_out["登记时间"] = pd.to_datetime(
manager_data_out["登记时间"], unit="ms"
).dt.date
manager_data_out["在管基金数量"] = pd.to_numeric(manager_data_out["在管基金数量"])
manager_data_out["是否有提示信息"] = manager_data_out["是否有提示信息"].map({True: "是", False: "否"})
manager_data_out["是否有诚信信息"] = manager_data_out["是否有诚信信息"].map({True: "是", False: "否"})
return manager_data_out
| 18,681 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_member_sub_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html?primaryInvestType=private
:return: 证券公司私募基金子公司管理人信息公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html?primaryInvestType=private
:return: 证券公司私募基金子公司管理人信息公示
:rtype: pandas.DataFrame
| 315 | 359 |
def amac_member_sub_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示
http://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html?primaryInvestType=private
:return: 证券公司私募基金子公司管理人信息公示
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"memberBehalf",
"memberType",
"memberCode",
"memberDate",
"primaryInvestType",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"机构(会员)名称",
"会员代表",
"会员类型",
"会员编号",
"入会时间",
"公司类型",
]
manager_data_out["入会时间"] = pd.to_datetime(
manager_data_out["入会时间"], unit="ms"
).dt.date
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L315-L359
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.555556 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
31,
32,
33,
41,
44
] | 40 | false | 6.811146 | 45 | 2 | 60 | 4 |
def amac_member_sub_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"managerName",
"memberBehalf",
"memberType",
"memberCode",
"memberDate",
"primaryInvestType",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"机构(会员)名称",
"会员代表",
"会员类型",
"会员编号",
"入会时间",
"公司类型",
]
manager_data_out["入会时间"] = pd.to_datetime(
manager_data_out["入会时间"], unit="ms"
).dt.date
return manager_data_out
| 18,682 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_fund_info
|
(start_page: str = '1', end_page: str = "2000")
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品
http://gs.amac.org.cn/amac-infodisc/res/pof/fund/index.html
:param start_page: 开始页码, 获取指定页码直接的数据
:type start_page: str
:param end_page: 结束页码, 获取指定页码直接的数据
:type end_page: str
:return: 私募基金管理人基金产品
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品
http://gs.amac.org.cn/amac-infodisc/res/pof/fund/index.html
:param start_page: 开始页码, 获取指定页码直接的数据
:type start_page: str
:param end_page: 结束页码, 获取指定页码直接的数据
:type end_page: str
:return: 私募基金管理人基金产品
:rtype: pandas.DataFrame
| 364 | 420 |
def amac_fund_info(start_page: str = '1', end_page: str = "2000") -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品
http://gs.amac.org.cn/amac-infodisc/res/pof/fund/index.html
:param start_page: 开始页码, 获取指定页码直接的数据
:type start_page: str
:param end_page: 结束页码, 获取指定页码直接的数据
:type end_page: str
:return: 私募基金管理人基金产品
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/fund"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = int(data_json["totalPages"])
if total_page > int(end_page):
real_end_page = int(end_page)
else:
real_end_page = total_page
big_df = pd.DataFrame()
for page in tqdm(range(int(start_page) - 1, real_end_page), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"fundName",
"managerName",
"managerType",
"workingState",
"putOnRecordDate",
"establishDate",
"mandatorName",
] # 定义要取的 value 的 keys
manager_data_out = big_df[keys_list]
manager_data_out.columns = [
"基金名称",
"私募基金管理人名称",
"私募基金管理人类型",
"运行状态",
"备案时间",
"建立时间",
"托管人名称",
]
manager_data_out["建立时间"] = pd.to_datetime(
manager_data_out["建立时间"], unit="ms"
).dt.date
manager_data_out["备案时间"] = pd.to_datetime(
manager_data_out["备案时间"], unit="ms"
).dt.date
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L364-L420
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
] | 19.298246 |
[
11,
12,
17,
18,
19,
20,
21,
23,
24,
25,
26,
27,
28,
29,
30,
31,
40,
41,
50,
53,
56
] | 36.842105 | false | 6.811146 | 57 | 3 | 63.157895 | 8 |
def amac_fund_info(start_page: str = '1', end_page: str = "2000") -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/fund"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = int(data_json["totalPages"])
if total_page > int(end_page):
real_end_page = int(end_page)
else:
real_end_page = total_page
big_df = pd.DataFrame()
for page in tqdm(range(int(start_page) - 1, real_end_page), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"fundName",
"managerName",
"managerType",
"workingState",
"putOnRecordDate",
"establishDate",
"mandatorName",
] # 定义要取的 value 的 keys
manager_data_out = big_df[keys_list]
manager_data_out.columns = [
"基金名称",
"私募基金管理人名称",
"私募基金管理人类型",
"运行状态",
"备案时间",
"建立时间",
"托管人名称",
]
manager_data_out["建立时间"] = pd.to_datetime(
manager_data_out["建立时间"], unit="ms"
).dt.date
manager_data_out["备案时间"] = pd.to_datetime(
manager_data_out["备案时间"], unit="ms"
).dt.date
return manager_data_out
| 18,683 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_securities_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/securities/index.html
:return: 证券公司集合资管产品公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/securities/index.html
:return: 证券公司集合资管产品公示
:rtype: pandas.DataFrame
| 424 | 473 |
def amac_securities_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-证券公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/securities/index.html
:return: 证券公司集合资管产品公示
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/securities"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"cpmc",
"cpbm",
"gljg",
"slrq",
"dqr",
"tzlx",
"sffj",
"tgjg",
"barq",
"yzzt",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品名称",
"产品编码",
"管理人名称",
"成立日期",
"到期时间",
"投资类型",
"是否分级",
"托管人名称",
"备案日期",
"运作状态",
]
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L424-L473
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
35,
36,
37,
49
] | 34 | false | 6.811146 | 50 | 2 | 66 | 4 |
def amac_securities_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/securities"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"cpmc",
"cpbm",
"gljg",
"slrq",
"dqr",
"tzlx",
"sffj",
"tgjg",
"barq",
"yzzt",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品名称",
"产品编码",
"管理人名称",
"成立日期",
"到期时间",
"投资类型",
"是否分级",
"托管人名称",
"备案日期",
"运作状态",
]
return manager_data_out
| 18,684 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_aoin_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司直投基金
http://gs.amac.org.cn/amac-infodisc/res/aoin/product/index.html
:return: 证券公司直投基金
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司直投基金
http://gs.amac.org.cn/amac-infodisc/res/aoin/product/index.html
:return: 证券公司直投基金
:rtype: pandas.DataFrame
| 477 | 517 |
def amac_aoin_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-证券公司直投基金
http://gs.amac.org.cn/amac-infodisc/res/aoin/product/index.html
:return: 证券公司直投基金
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/aoin/product"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"code",
"name",
"aoinName",
"managerName",
"createDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品编码",
"产品名称",
"直投子公司",
"管理机构",
"设立日期",
]
manager_data_out["设立日期"] = pd.to_datetime(manager_data_out["设立日期"], unit="ms")
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L477-L517
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 17.073171 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
30,
31,
32,
39,
40
] | 43.902439 | false | 6.811146 | 41 | 2 | 56.097561 | 4 |
def amac_aoin_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/aoin/product"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"code",
"name",
"aoinName",
"managerName",
"createDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品编码",
"产品名称",
"直投子公司",
"管理机构",
"设立日期",
]
manager_data_out["设立日期"] = pd.to_datetime(manager_data_out["设立日期"], unit="ms")
return manager_data_out
| 18,685 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_fund_sub_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金
http://gs.amac.org.cn/amac-infodisc/res/pof/subfund/index.html
:return: 证券公司私募投资基金
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金
http://gs.amac.org.cn/amac-infodisc/res/pof/subfund/index.html
:return: 证券公司私募投资基金
:rtype: pandas.DataFrame
| 521 | 564 |
def amac_fund_sub_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金
http://gs.amac.org.cn/amac-infodisc/res/pof/subfund/index.html
:return: 证券公司私募投资基金
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/subfund"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"productCode",
"productName",
"mgrName",
"trustee",
"foundDate",
"registeredDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品编码",
"产品名称",
"私募基金管理人名称",
"托管人名称",
"成立日期",
"备案日期",
]
manager_data_out["备案日期"] = pd.to_datetime(manager_data_out["备案日期"], unit="ms")
manager_data_out["成立日期"] = pd.to_datetime(manager_data_out["成立日期"], unit="ms")
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L521-L564
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.909091 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
31,
32,
33,
41,
42,
43
] | 43.181818 | false | 6.811146 | 44 | 2 | 56.818182 | 4 |
def amac_fund_sub_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/subfund"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"productCode",
"productName",
"mgrName",
"trustee",
"foundDate",
"registeredDate",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品编码",
"产品名称",
"私募基金管理人名称",
"托管人名称",
"成立日期",
"备案日期",
]
manager_data_out["备案日期"] = pd.to_datetime(manager_data_out["备案日期"], unit="ms")
manager_data_out["成立日期"] = pd.to_datetime(manager_data_out["成立日期"], unit="ms")
return manager_data_out
| 18,686 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_fund_account_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/fund/account/index.html
:return: 基金公司及子公司集合资管产品公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/fund/account/index.html
:return: 基金公司及子公司集合资管产品公示
:rtype: pandas.DataFrame
| 568 | 606 |
def amac_fund_account_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/fund/account/index.html
:return: 基金公司及子公司集合资管产品公示
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/fund/account"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"registerDate",
"registerCode",
"name",
"manager",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"成立日期",
"产品编码",
"产品名称",
"管理人名称",
]
manager_data_out["成立日期"] = pd.to_datetime(manager_data_out["成立日期"], unit="ms")
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L568-L606
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 17.948718 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
29,
30,
31,
37,
38
] | 46.153846 | false | 6.811146 | 39 | 2 | 53.846154 | 4 |
def amac_fund_account_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/fund/account"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"registerDate",
"registerCode",
"name",
"manager",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"成立日期",
"产品编码",
"产品名称",
"管理人名称",
]
manager_data_out["成立日期"] = pd.to_datetime(manager_data_out["成立日期"], unit="ms")
return manager_data_out
| 18,687 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_fund_abs
|
()
|
return big_df
|
中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划公示信息
https://gs.amac.org.cn/amac-infodisc/res/fund/abs/index.html
:return: 资产支持专项计划公示信息
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划公示信息
https://gs.amac.org.cn/amac-infodisc/res/fund/abs/index.html
:return: 资产支持专项计划公示信息
:rtype: pandas.DataFrame
| 610 | 664 |
def amac_fund_abs() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划公示信息
https://gs.amac.org.cn/amac-infodisc/res/fund/abs/index.html
:return: 资产支持专项计划公示信息
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/fund/abs"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
big_df.columns = [
"编号",
"_",
"_",
"专项计划全称",
"备案编号",
"管理人",
"托管人",
"备案通过时间",
"成立日期",
"预期到期时间",
]
big_df["备案通过时间"] = pd.to_datetime(big_df["备案通过时间"], unit="ms").dt.date
big_df["成立日期"] = pd.to_datetime(big_df["成立日期"], unit="ms").dt.date
big_df["预期到期时间"] = pd.to_datetime(
big_df["预期到期时间"], unit="ms", errors="coerce"
).dt.date
big_df = big_df[
[
"编号",
"备案编号",
"专项计划全称",
"管理人",
"托管人",
"成立日期",
"预期到期时间",
"备案通过时间",
]
]
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L610-L664
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.727273 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
37,
38,
39,
42,
54
] | 36.363636 | false | 6.811146 | 55 | 2 | 63.636364 | 4 |
def amac_fund_abs() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/fund/abs"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = range(1, len(big_df) + 1)
big_df.columns = [
"编号",
"_",
"_",
"专项计划全称",
"备案编号",
"管理人",
"托管人",
"备案通过时间",
"成立日期",
"预期到期时间",
]
big_df["备案通过时间"] = pd.to_datetime(big_df["备案通过时间"], unit="ms").dt.date
big_df["成立日期"] = pd.to_datetime(big_df["成立日期"], unit="ms").dt.date
big_df["预期到期时间"] = pd.to_datetime(
big_df["预期到期时间"], unit="ms", errors="coerce"
).dt.date
big_df = big_df[
[
"编号",
"备案编号",
"专项计划全称",
"管理人",
"托管人",
"成立日期",
"预期到期时间",
"备案通过时间",
]
]
return big_df
| 18,688 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_futures_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/futures/index.html
:return: 期货公司集合资管产品公示
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/futures/index.html
:return: 期货公司集合资管产品公示
:rtype: pandas.DataFrame
| 668 | 717 |
def amac_futures_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示
http://gs.amac.org.cn/amac-infodisc/res/pof/futures/index.html
:return: 期货公司集合资管产品公示
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/futures"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"mpiName",
"mpiProductCode",
"aoiName",
"mpiTrustee",
"mpiCreateDate",
"tzlx",
"sfjgh",
"registeredDate",
"dueDate",
"fundStatus",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品名称",
"产品编码",
"管理人名称",
"托管人名称",
"成立日期",
"投资类型",
"是否分级",
"备案日期",
"到期日",
"运作状态",
]
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L668-L717
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14 |
[
7,
8,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
35,
36,
37,
49
] | 34 | false | 6.811146 | 50 | 2 | 66 | 4 |
def amac_futures_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/pof/futures"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"mpiName",
"mpiProductCode",
"aoiName",
"mpiTrustee",
"mpiCreateDate",
"tzlx",
"sfjgh",
"registeredDate",
"dueDate",
"fundStatus",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"产品名称",
"产品编码",
"管理人名称",
"托管人名称",
"成立日期",
"投资类型",
"是否分级",
"备案日期",
"到期日",
"运作状态",
]
return manager_data_out
| 18,689 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_amac.py
|
amac_manager_cancelled_info
|
()
|
return manager_data_out
|
中国证券投资基金业协会-信息公示-诚信信息公示-已注销私募基金管理人名单
http://gs.amac.org.cn/amac-infodisc/res/cancelled/manager/index.html
主动注销: 100
依公告注销: 200
协会注销: 300
:return: 已注销私募基金管理人名单
:rtype: pandas.DataFrame
|
中国证券投资基金业协会-信息公示-诚信信息公示-已注销私募基金管理人名单
http://gs.amac.org.cn/amac-infodisc/res/cancelled/manager/index.html
主动注销: 100
依公告注销: 200
协会注销: 300
:return: 已注销私募基金管理人名单
:rtype: pandas.DataFrame
| 722 | 764 |
def amac_manager_cancelled_info() -> pd.DataFrame:
"""
中国证券投资基金业协会-信息公示-诚信信息公示-已注销私募基金管理人名单
http://gs.amac.org.cn/amac-infodisc/res/cancelled/manager/index.html
主动注销: 100
依公告注销: 200
协会注销: 300
:return: 已注销私募基金管理人名单
:rtype: pandas.DataFrame
"""
url = "https://gs.amac.org.cn/amac-infodisc/api/cancelled/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"orgName",
"orgCode",
"orgSignDate",
"cancelDate",
"status",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"管理人名称",
"统一社会信用代码",
"登记时间",
"注销时间",
"注销类型",
]
return manager_data_out
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_amac.py#L722-L764
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 23.255814 |
[
10,
11,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
33,
34,
35,
42
] | 39.534884 | false | 6.811146 | 43 | 2 | 60.465116 | 7 |
def amac_manager_cancelled_info() -> pd.DataFrame:
url = "https://gs.amac.org.cn/amac-infodisc/api/cancelled/manager"
params = {
"rand": "0.7665138514630696",
"page": "1",
"size": "100",
}
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
total_page = data_json["totalPages"]
big_df = pd.DataFrame()
for page in tqdm(range(0, int(total_page)), leave=False):
params.update({"page": page})
r = requests.post(url, params=params, json={}, verify=False)
data_json = r.json()
temp_df = pd.DataFrame(data_json["content"])
big_df = big_df.append(temp_df, ignore_index=True)
keys_list = [
"orgName",
"orgCode",
"orgSignDate",
"cancelDate",
"status",
] # 定义要取的 value 的 keys
manager_data_out = pd.DataFrame(big_df)
manager_data_out = manager_data_out[keys_list]
manager_data_out.columns = [
"管理人名称",
"统一社会信用代码",
"登记时间",
"注销时间",
"注销类型",
]
return manager_data_out
| 18,690 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_scale_em.py
|
fund_scale_change_em
|
()
|
return big_df
|
天天基金网-基金数据-规模份额-规模变动
http://fund.eastmoney.com/data/gmbdlist.html
:return: 规模变动
:rtype: pandas.DataFrame
|
天天基金网-基金数据-规模份额-规模变动
http://fund.eastmoney.com/data/gmbdlist.html
:return: 规模变动
:rtype: pandas.DataFrame
| 14 | 59 |
def fund_scale_change_em() -> pd.DataFrame:
"""
天天基金网-基金数据-规模份额-规模变动
http://fund.eastmoney.com/data/gmbdlist.html
:return: 规模变动
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "9",
"pi": "1",
"pn": "50",
"mc": "hypzDetail",
"st": "desc",
"sc": "reportdate",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
total_page = data_json["pages"]
big_df = pd.DataFrame()
for page in range(1, int(total_page) + 1):
params.update({"pi": page})
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df["index"] + 1
big_df.columns = [
"序号",
"截止日期",
"基金家数",
"期间申购",
"期间赎回",
"期末总份额",
"期末净资产",
]
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"]).dt.date
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"])
big_df["期间申购"] = pd.to_numeric(big_df["期间申购"].str.replace(",", ""))
big_df["期间赎回"] = pd.to_numeric(big_df["期间赎回"].str.replace(",", ""))
big_df["期末总份额"] = pd.to_numeric(big_df["期末总份额"].str.replace(",", ""))
big_df["期末净资产"] = pd.to_numeric(big_df["期末净资产"].str.replace(",", ""))
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_scale_em.py#L14-L59
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.217391 |
[
7,
8,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
39,
40,
41,
42,
43,
44,
45
] | 52.173913 | false | 11.864407 | 46 | 2 | 47.826087 | 4 |
def fund_scale_change_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "9",
"pi": "1",
"pn": "50",
"mc": "hypzDetail",
"st": "desc",
"sc": "reportdate",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
total_page = data_json["pages"]
big_df = pd.DataFrame()
for page in range(1, int(total_page) + 1):
params.update({"pi": page})
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df["index"] + 1
big_df.columns = [
"序号",
"截止日期",
"基金家数",
"期间申购",
"期间赎回",
"期末总份额",
"期末净资产",
]
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"]).dt.date
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"])
big_df["期间申购"] = pd.to_numeric(big_df["期间申购"].str.replace(",", ""))
big_df["期间赎回"] = pd.to_numeric(big_df["期间赎回"].str.replace(",", ""))
big_df["期末总份额"] = pd.to_numeric(big_df["期末总份额"].str.replace(",", ""))
big_df["期末净资产"] = pd.to_numeric(big_df["期末净资产"].str.replace(",", ""))
return big_df
| 18,691 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_scale_em.py
|
fund_hold_structure_em
|
()
|
return big_df
|
天天基金网-基金数据-规模份额-持有人结构
http://fund.eastmoney.com/data/cyrjglist.html
:return: 持有人结构
:rtype: pandas.DataFrame
|
天天基金网-基金数据-规模份额-持有人结构
http://fund.eastmoney.com/data/cyrjglist.html
:return: 持有人结构
:rtype: pandas.DataFrame
| 62 | 107 |
def fund_hold_structure_em() -> pd.DataFrame:
"""
天天基金网-基金数据-规模份额-持有人结构
http://fund.eastmoney.com/data/cyrjglist.html
:return: 持有人结构
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "11",
"pi": "1",
"pn": "50",
"mc": "hypzDetail",
"st": "desc",
"sc": "reportdate",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
total_page = data_json["pages"]
big_df = pd.DataFrame()
for page in range(1, int(total_page) + 1):
params.update({"pi": page})
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df["index"] + 1
big_df.columns = [
"序号",
"截止日期",
"基金家数",
'机构持有比列',
'个人持有比列',
'内部持有比列',
'总份额',
]
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"]).dt.date
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"])
big_df["机构持有比列"] = pd.to_numeric(big_df["机构持有比列"])
big_df["个人持有比列"] = pd.to_numeric(big_df["个人持有比列"])
big_df["内部持有比列"] = pd.to_numeric(big_df["内部持有比列"])
big_df["总份额"] = pd.to_numeric(big_df["总份额"].str.replace(",", ""))
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_scale_em.py#L62-L107
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.217391 |
[
7,
8,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
39,
40,
41,
42,
43,
44,
45
] | 52.173913 | false | 11.864407 | 46 | 2 | 47.826087 | 4 |
def fund_hold_structure_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx"
params = {
"dt": "11",
"pi": "1",
"pn": "50",
"mc": "hypzDetail",
"st": "desc",
"sc": "reportdate",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
total_page = data_json["pages"]
big_df = pd.DataFrame()
for page in range(1, int(total_page) + 1):
params.update({"pi": page})
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_df = pd.DataFrame(data_json["data"])
big_df = big_df.append(temp_df, ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df["index"] + 1
big_df.columns = [
"序号",
"截止日期",
"基金家数",
'机构持有比列',
'个人持有比列',
'内部持有比列',
'总份额',
]
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"]).dt.date
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"])
big_df["机构持有比列"] = pd.to_numeric(big_df["机构持有比列"])
big_df["个人持有比列"] = pd.to_numeric(big_df["个人持有比列"])
big_df["内部持有比列"] = pd.to_numeric(big_df["内部持有比列"])
big_df["总份额"] = pd.to_numeric(big_df["总份额"].str.replace(",", ""))
return big_df
| 18,692 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rank_em.py
|
fund_open_fund_rank_em
|
(symbol: str = "全部") ->
|
return temp_df
|
东方财富网-数据中心-开放基金排行
http://fund.eastmoney.com/data/fundranking.html
:param symbol: choice of {"全部", "股票型", "混合型", "债券型", "指数型", "QDII", "LOF", "FOF"}
:type symbol: str
:return: 开放基金排行
:rtype: pandas.DataFrame
|
东方财富网-数据中心-开放基金排行
http://fund.eastmoney.com/data/fundranking.html
:param symbol: choice of {"全部", "股票型", "混合型", "债券型", "指数型", "QDII", "LOF", "FOF"}
:type symbol: str
:return: 开放基金排行
:rtype: pandas.DataFrame
| 18 | 118 |
def fund_open_fund_rank_em(symbol: str = "全部") -> pd.DataFrame:
"""
东方财富网-数据中心-开放基金排行
http://fund.eastmoney.com/data/fundranking.html
:param symbol: choice of {"全部", "股票型", "混合型", "债券型", "指数型", "QDII", "LOF", "FOF"}
:type symbol: str
:return: 开放基金排行
:rtype: pandas.DataFrame
"""
current_date = datetime.datetime.now().date().isoformat()
last_date = str(int(current_date[:4]) - 1) + current_date[4:]
url = "http://fund.eastmoney.com/data/rankhandler.aspx"
type_map = {
"全部": ["all", "zzf"],
"股票型": ["gp", "6yzf"],
"混合型": ["hh", "6yzf"],
"债券型": ["zq", "6yzf"],
"指数型": ["zs", "6yzf"],
"QDII": ["qdii", "6yzf"],
"LOF": ["lof", "6yzf"],
"FOF": ["fof", "6yzf"],
}
params = {
"op": "ph",
"dt": "kf",
"ft": type_map[symbol][0],
"rs": "",
"gs": "0",
"sc": type_map[symbol][1],
"st": "desc",
"sd": last_date,
"ed": current_date,
"qdii": "",
"tabSubtype": ",,,,,",
"pi": "1",
"pn": "20000",
"dx": "1",
"v": "0.1591891419018292",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["datas"])
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"_",
"日期",
"单位净值",
"累计净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"_",
"_",
"自定义",
"_",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"单位净值",
"累计净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"自定义",
"手续费",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rank_em.py#L18-L118
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 8.910891 |
[
9,
10,
11,
12,
22,
39,
43,
44,
45,
46,
47,
48,
49,
50,
78,
100
] | 15.841584 | false | 12.087912 | 101 | 1 | 84.158416 | 6 |
def fund_open_fund_rank_em(symbol: str = "全部") -> pd.DataFrame:
current_date = datetime.datetime.now().date().isoformat()
last_date = str(int(current_date[:4]) - 1) + current_date[4:]
url = "http://fund.eastmoney.com/data/rankhandler.aspx"
type_map = {
"全部": ["all", "zzf"],
"股票型": ["gp", "6yzf"],
"混合型": ["hh", "6yzf"],
"债券型": ["zq", "6yzf"],
"指数型": ["zs", "6yzf"],
"QDII": ["qdii", "6yzf"],
"LOF": ["lof", "6yzf"],
"FOF": ["fof", "6yzf"],
}
params = {
"op": "ph",
"dt": "kf",
"ft": type_map[symbol][0],
"rs": "",
"gs": "0",
"sc": type_map[symbol][1],
"st": "desc",
"sd": last_date,
"ed": current_date,
"qdii": "",
"tabSubtype": ",,,,,",
"pi": "1",
"pn": "20000",
"dx": "1",
"v": "0.1591891419018292",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["datas"])
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"_",
"日期",
"单位净值",
"累计净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"_",
"_",
"自定义",
"_",
"手续费",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"单位净值",
"累计净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"自定义",
"手续费",
]
]
return temp_df
| 18,693 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rank_em.py
|
fund_em_exchange_rank
|
()
|
return temp_df
|
东方财富网-数据中心-场内交易基金排行
http://fund.eastmoney.com/data/fbsfundranking.html
:return: 场内交易基金数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-场内交易基金排行
http://fund.eastmoney.com/data/fbsfundranking.html
:return: 场内交易基金数据
:rtype: pandas.DataFrame
| 121 | 197 |
def fund_em_exchange_rank() -> pd.DataFrame:
"""
东方财富网-数据中心-场内交易基金排行
http://fund.eastmoney.com/data/fbsfundranking.html
:return: 场内交易基金数据
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/rankhandler.aspx"
params = {
"op": "ph",
"dt": "fb",
"ft": "ct",
"rs": "",
"gs": "0",
"sc": "zzf",
"st": "desc",
"pi": "1",
"pn": "10000",
"v": "0.1591891419018292",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["datas"])
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"_",
"日期",
"单位净值",
"累计净值",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"单位净值",
"累计净值",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rank_em.py#L121-L197
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.090909 |
[
7,
8,
20,
24,
25,
26,
27,
28,
29,
30,
31,
57,
76
] | 16.883117 | false | 12.087912 | 77 | 1 | 83.116883 | 4 |
def fund_em_exchange_rank() -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/rankhandler.aspx"
params = {
"op": "ph",
"dt": "fb",
"ft": "ct",
"rs": "",
"gs": "0",
"sc": "zzf",
"st": "desc",
"pi": "1",
"pn": "10000",
"v": "0.1591891419018292",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["datas"])
temp_df = temp_df.iloc[:, 0].str.split(",", expand=True)
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"_",
"日期",
"单位净值",
"累计净值",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"单位净值",
"累计净值",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
]
]
return temp_df
| 18,694 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rank_em.py
|
fund_em_money_rank
|
()
|
return temp_df
|
东方财富网-数据中心-货币型基金排行
http://fund.eastmoney.com/data/hbxfundranking.html
:return: 货币型基金排行
:rtype: pandas.DataFrame
|
东方财富网-数据中心-货币型基金排行
http://fund.eastmoney.com/data/hbxfundranking.html
:return: 货币型基金排行
:rtype: pandas.DataFrame
| 200 | 279 |
def fund_em_money_rank() -> pd.DataFrame:
"""
东方财富网-数据中心-货币型基金排行
http://fund.eastmoney.com/data/hbxfundranking.html
:return: 货币型基金排行
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/FundRank/GetHbRankList"
params = {
"intCompany": "0",
"MinsgType": "",
"IsSale": "1",
"strSortCol": "SYL_Y",
"orderType": "desc",
"pageIndex": "1",
"pageSize": "10000",
"callback": "jQuery18303264654966943197_1603867158043",
"_": "1603867224251",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"近1年",
"近2年",
"近3年",
"近5年",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率7日",
"_",
"年化收益率14日",
"年化收益率28日",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"_",
"手续费",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率7日",
"年化收益率14日",
"年化收益率28日",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"近5年",
"今年来",
"成立来",
"手续费",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rank_em.py#L200-L279
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.75 |
[
7,
8,
19,
23,
24,
25,
26,
27,
28,
29,
57,
79
] | 15 | false | 12.087912 | 80 | 1 | 85 | 4 |
def fund_em_money_rank() -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/FundRank/GetHbRankList"
params = {
"intCompany": "0",
"MinsgType": "",
"IsSale": "1",
"strSortCol": "SYL_Y",
"orderType": "desc",
"pageIndex": "1",
"pageSize": "10000",
"callback": "jQuery18303264654966943197_1603867158043",
"_": "1603867224251",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
json_data = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(json_data["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"近1年",
"近2年",
"近3年",
"近5年",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率7日",
"_",
"年化收益率14日",
"年化收益率28日",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"_",
"手续费",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率7日",
"年化收益率14日",
"年化收益率28日",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"近5年",
"今年来",
"成立来",
"手续费",
]
]
return temp_df
| 18,695 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rank_em.py
|
fund_em_lcx_rank
|
()
|
return temp_df
|
东方财富网-数据中心-理财基金排行
# 该接口暂时没有数据
http://fund.eastmoney.com/data/lcxfundranking.html#t;c0;r;sSYL_Z;ddesc;pn50;f;os1;
:return: 理财基金排行
:rtype: pandas.DataFrame
|
东方财富网-数据中心-理财基金排行
# 该接口暂时没有数据
http://fund.eastmoney.com/data/lcxfundranking.html#t;c0;r;sSYL_Z;ddesc;pn50;f;os1;
:return: 理财基金排行
:rtype: pandas.DataFrame
| 282 | 360 |
def fund_em_lcx_rank() -> pd.DataFrame:
"""
东方财富网-数据中心-理财基金排行
# 该接口暂时没有数据
http://fund.eastmoney.com/data/lcxfundranking.html#t;c0;r;sSYL_Z;ddesc;pn50;f;os1;
:return: 理财基金排行
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/FundRank/GetLcRankList"
params = {
"intCompany": "0",
"MinsgType": "undefined",
"IsSale": "1",
"strSortCol": "SYL_Z",
"orderType": "desc",
"pageIndex": "1",
"pageSize": "50",
"FBQ": "",
"callback": "jQuery18303264654966943197_1603867158043",
"_": "1603867224251",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
try:
data_json = r.json()
except:
return None
temp_df = pd.DataFrame(data_json["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"近1周",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率-7日",
"_",
"年化收益率-14日",
"年化收益率-28日",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"可购买",
"手续费",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率-7日",
"年化收益率-14日",
"年化收益率-28日",
"近1周",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"可购买",
"手续费",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rank_em.py#L282-L360
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 10.126582 |
[
8,
9,
21,
25,
26,
27,
28,
29,
30,
31,
32,
33,
58,
78
] | 17.721519 | false | 12.087912 | 79 | 2 | 82.278481 | 5 |
def fund_em_lcx_rank() -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/FundRank/GetLcRankList"
params = {
"intCompany": "0",
"MinsgType": "undefined",
"IsSale": "1",
"strSortCol": "SYL_Z",
"orderType": "desc",
"pageIndex": "1",
"pageSize": "50",
"FBQ": "",
"callback": "jQuery18303264654966943197_1603867158043",
"_": "1603867224251",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
try:
data_json = r.json()
except:
return None
temp_df = pd.DataFrame(data_json["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"近1周",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率-7日",
"_",
"年化收益率-14日",
"年化收益率-28日",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"可购买",
"手续费",
"_",
"_",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"日期",
"万份收益",
"年化收益率-7日",
"年化收益率-14日",
"年化收益率-28日",
"近1周",
"近1月",
"近3月",
"近6月",
"今年来",
"成立来",
"可购买",
"手续费",
]
]
return temp_df
| 18,696 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_rank_em.py
|
fund_em_hk_rank
|
()
|
return temp_df
|
东方财富网-数据中心-香港基金排行
http://overseas.1234567.com.cn/FundList
:return: 香港基金排行
:rtype: pandas.DataFrame
|
东方财富网-数据中心-香港基金排行
http://overseas.1234567.com.cn/FundList
:return: 香港基金排行
:rtype: pandas.DataFrame
| 363 | 440 |
def fund_em_hk_rank() -> pd.DataFrame:
"""
东方财富网-数据中心-香港基金排行
http://overseas.1234567.com.cn/FundList
:return: 香港基金排行
:rtype: pandas.DataFrame
"""
format_date = datetime.datetime.now().date().isoformat()
url = "http://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx"
params = {
'api': 'HKFDApi',
'm': 'MethodFundList',
'action': '1',
'pageindex': '0',
'pagesize': '5000',
'dy': '1',
'date1': format_date,
'date2': format_date,
'sortfield': 'W',
'sorttype': '-1',
'isbuy': '0',
'_': '1610790553848',
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"_",
"香港基金代码",
"基金代码",
"_",
"基金简称",
"可购买",
"日期",
"单位净值",
"日增长率",
"_",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"币种",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"币种",
"日期",
"单位净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"可购买",
"香港基金代码",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_rank_em.py#L363-L440
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 8.974359 |
[
7,
8,
9,
23,
27,
28,
29,
30,
31,
32,
55,
77
] | 15.384615 | false | 12.087912 | 78 | 1 | 84.615385 | 4 |
def fund_em_hk_rank() -> pd.DataFrame:
format_date = datetime.datetime.now().date().isoformat()
url = "http://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx"
params = {
'api': 'HKFDApi',
'm': 'MethodFundList',
'action': '1',
'pageindex': '0',
'pagesize': '5000',
'dy': '1',
'date1': format_date,
'date2': format_date,
'sortfield': 'W',
'sorttype': '-1',
'isbuy': '0',
'_': '1610790553848',
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fundguzhi.html",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = list(range(1, len(temp_df) + 1))
temp_df.columns = [
"序号",
"_",
"香港基金代码",
"基金代码",
"_",
"基金简称",
"可购买",
"日期",
"单位净值",
"日增长率",
"_",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"币种",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"币种",
"日期",
"单位净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"可购买",
"香港基金代码",
]
]
return temp_df
| 18,697 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_em.py
|
_fund_etf_code_id_map_em
|
()
|
return temp_dict
|
东方财富-ETF 代码和市场标识映射
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 代码和市场标识映射
:rtype: pandas.DataFrame
|
东方财富-ETF 代码和市场标识映射
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 代码和市场标识映射
:rtype: pandas.DataFrame
| 15 | 41 |
def _fund_etf_code_id_map_em() -> dict:
"""
东方财富-ETF 代码和市场标识映射
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 代码和市场标识映射
:rtype: pandas.DataFrame
"""
url = "http://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "5000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024",
"fields": "f12,f13",
"_": "1672806290972",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
return temp_dict
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_etf_em.py#L15-L41
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 25.925926 |
[
7,
8,
22,
23,
24,
25,
26
] | 25.925926 | false | 8.77193 | 27 | 1 | 74.074074 | 4 |
def _fund_etf_code_id_map_em() -> dict:
url = "http://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "5000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024",
"fields": "f12,f13",
"_": "1672806290972",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
return temp_dict
| 18,698 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_em.py
|
fund_etf_spot_em
|
()
|
return temp_df
|
东方财富-ETF 实时行情
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 实时行情
:rtype: pandas.DataFrame
|
东方财富-ETF 实时行情
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 实时行情
:rtype: pandas.DataFrame
| 44 | 118 |
def fund_etf_spot_em() -> pd.DataFrame:
"""
东方财富-ETF 实时行情
https://quote.eastmoney.com/center/gridlist.html#fund_etf
:return: ETF 实时行情
:rtype: pandas.DataFrame
"""
url = "http://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "2000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1672806290972",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.rename(
columns={
"f12": "代码",
"f14": "名称",
"f2": "最新价",
"f4": "涨跌额",
"f3": "涨跌幅",
"f5": "成交量",
"f6": "成交额",
"f17": "开盘价",
"f15": "最高价",
"f16": "最低价",
"f18": "昨收",
"f8": "换手率",
"f21": "流通市值",
"f20": "总市值",
},
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/fund/fund_etf_em.py#L44-L118
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 9.333333 |
[
7,
8,
22,
23,
24,
25,
44,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74
] | 26.666667 | false | 8.77193 | 75 | 1 | 73.333333 | 4 |
def fund_etf_spot_em() -> pd.DataFrame:
url = "http://88.push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": "1",
"pz": "2000",
"po": "1",
"np": "1",
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
"fltt": "2",
"invt": "2",
"wbp2u": "|0|0|0|web",
"fid": "f3",
"fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024",
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
"_": "1672806290972",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["data"]["diff"])
temp_df.rename(
columns={
"f12": "代码",
"f14": "名称",
"f2": "最新价",
"f4": "涨跌额",
"f3": "涨跌幅",
"f5": "成交量",
"f6": "成交额",
"f17": "开盘价",
"f15": "最高价",
"f16": "最低价",
"f18": "昨收",
"f8": "换手率",
"f21": "流通市值",
"f20": "总市值",
},
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,699 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_em.py
|
fund_etf_hist_em
|
(
symbol: str = "159707",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
)
|
return temp_df
|
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
|
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
| 121 | 190 |
def fund_etf_hist_em(
symbol: str = "159707",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param period: choice of {'daily', 'weekly', 'monthly'}
:type period: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
:type adjust: str
:return: 每日行情
:rtype: pandas.DataFrame
"""
code_id_dict = _fund_etf_code_id_map_em()
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": start_date,
"end": end_date,
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not (data_json["data"] and data_json["data"]["klines"]):
return pd.DataFrame()
temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_etf_em.py#L121-L190
| 25 |
[
0
] | 1.428571 |
[
23,
24,
25,
26,
27,
38,
39,
40,
41,
42,
43,
56,
57,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69
] | 34.285714 | false | 8.77193 | 70 | 4 | 65.714286 | 14 |
def fund_etf_hist_em(
symbol: str = "159707",
period: str = "daily",
start_date: str = "19700101",
end_date: str = "20500101",
adjust: str = "",
) -> pd.DataFrame:
code_id_dict = _fund_etf_code_id_map_em()
adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period_dict[period],
"fqt": adjust_dict[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": start_date,
"end": end_date,
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
if not (data_json["data"] and data_json["data"]["klines"]):
return pd.DataFrame()
temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
temp_df.columns = [
"日期",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["日期"])
temp_df.reset_index(inplace=True, drop=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
return temp_df
| 18,700 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_etf_em.py
|
fund_etf_hist_min_em
|
(
symbol: str = "159707",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
)
|
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
|
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
| 193 | 320 |
def fund_etf_hist_min_em(
symbol: str = "159707",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
) -> pd.DataFrame:
"""
东方财富-ETF 行情
https://quote.eastmoney.com/sz159707.html
:param symbol: ETF 代码
:type symbol: str
:param start_date: 开始日期
:type start_date: str
:param end_date: 结束日期
:type end_date: str
:param period: choice of {'1', '5', '15', '30', '60'}
:type period: str
:param adjust: choice of {'', 'qfq', 'hfq'}
:type adjust: str
:return: 每日分时行情
:rtype: pandas.DataFrame
"""
code_id_dict = _fund_etf_code_id_map_em()
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"ndays": "5",
"iscr": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_etf_em.py#L193-L320
| 25 |
[
0
] | 0.78125 |
[
23,
24,
29,
30,
31,
40,
41,
42,
45,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
68,
69,
80,
81,
82,
85,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
112,
127
] | 33.59375 | false | 8.77193 | 128 | 4 | 66.40625 | 14 |
def fund_etf_hist_min_em(
symbol: str = "159707",
start_date: str = "1979-09-01 09:32:00",
end_date: str = "2222-01-01 09:32:00",
period: str = "5",
adjust: str = "",
) -> pd.DataFrame:
code_id_dict = _fund_etf_code_id_map_em()
adjust_map = {
"": "0",
"qfq": "1",
"hfq": "2",
}
if period == "1":
url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"ndays": "5",
"iscr": "0",
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1623766962675",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["trends"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"最新价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
"ut": "7eea3edcaed734bea9cbfc24409ed989",
"klt": period,
"fqt": adjust_map[adjust],
"secid": f"{code_id_dict[symbol]}.{symbol}",
"beg": "0",
"end": "20500000",
"_": "1630930917857",
}
r = requests.get(url, params=params)
data_json = r.json()
temp_df = pd.DataFrame(
[item.split(",") for item in data_json["data"]["klines"]]
)
temp_df.columns = [
"时间",
"开盘",
"收盘",
"最高",
"最低",
"成交量",
"成交额",
"振幅",
"涨跌幅",
"涨跌额",
"换手率",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
temp_df.reset_index(drop=True, inplace=True)
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"])
temp_df["收盘"] = pd.to_numeric(temp_df["收盘"])
temp_df["最高"] = pd.to_numeric(temp_df["最高"])
temp_df["最低"] = pd.to_numeric(temp_df["最低"])
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"])
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"])
temp_df["振幅"] = pd.to_numeric(temp_df["振幅"])
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"])
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"])
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"])
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
temp_df = temp_df[
[
"时间",
"开盘",
"收盘",
"最高",
"最低",
"涨跌幅",
"涨跌额",
"成交量",
"成交额",
"振幅",
"换手率",
]
]
return temp_df
| 18,701 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_report_cninfo.py
|
fund_report_stock_cninfo
|
(date: str = "20210630")
|
return temp_df
|
巨潮资讯-数据中心-专题统计-基金报表-基金重仓股
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}
:type date: str
:return: 基金重仓股
:rtype: pandas.DataFrame
|
巨潮资讯-数据中心-专题统计-基金报表-基金重仓股
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}
:type date: str
:return: 基金重仓股
:rtype: pandas.DataFrame
| 45 | 107 |
def fund_report_stock_cninfo(date: str = "20210630") -> pd.DataFrame:
"""
巨潮资讯-数据中心-专题统计-基金报表-基金重仓股
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}
:type date: str
:return: 基金重仓股
:rtype: pandas.DataFrame
"""
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1112"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
params = {
"rdate": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.post(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
"F003N": "持股总市值",
"F002N": "持股总数",
"F001N": "基金覆盖家数",
"SECNAME": "股票简称",
"ID": "序号",
"SECCODE": "股票代码",
"ENDDATE": "报告期",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"股票代码",
"股票简称",
"报告期",
"基金覆盖家数",
"持股总数",
"持股总市值",
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["持股总数"] = pd.to_numeric(temp_df["持股总数"])
temp_df["持股总市值"] = pd.to_numeric(temp_df["持股总市值"])
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_report_cninfo.py#L45-L107
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.285714 |
[
9,
10,
11,
12,
13,
14,
29,
32,
33,
34,
35,
47,
58,
59,
60,
61,
62
] | 26.984127 | false | 14.705882 | 63 | 1 | 73.015873 | 6 |
def fund_report_stock_cninfo(date: str = "20210630") -> pd.DataFrame:
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1112"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
params = {
"rdate": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.post(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
"F003N": "持股总市值",
"F002N": "持股总数",
"F001N": "基金覆盖家数",
"SECNAME": "股票简称",
"ID": "序号",
"SECCODE": "股票代码",
"ENDDATE": "报告期",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"股票代码",
"股票简称",
"报告期",
"基金覆盖家数",
"持股总数",
"持股总市值",
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["持股总数"] = pd.to_numeric(temp_df["持股总数"])
temp_df["持股总市值"] = pd.to_numeric(temp_df["持股总市值"])
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
return temp_df
| 18,702 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_report_cninfo.py
|
fund_report_industry_allocation_cninfo
|
(date: str = "20210630")
|
return temp_df
|
巨潮资讯-数据中心-专题统计-基金报表-基金行业配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}, 从 2017 年开始
:type date: str
:return: 基金行业配置
:rtype: pandas.DataFrame
|
巨潮资讯-数据中心-专题统计-基金报表-基金行业配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}, 从 2017 年开始
:type date: str
:return: 基金行业配置
:rtype: pandas.DataFrame
| 110 | 170 |
def fund_report_industry_allocation_cninfo(date: str = "20210630") -> pd.DataFrame:
"""
巨潮资讯-数据中心-专题统计-基金报表-基金行业配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}, 从 2017 年开始
:type date: str
:return: 基金行业配置
:rtype: pandas.DataFrame
"""
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1113"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
params = {
"rdate": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.post(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
'F004N': '行业规模',
'F003N': '基金覆盖家数',
'F002V': '证监会行业名称',
'F001V': '行业编码',
'ENDDATE': '报告期',
'F005N': '占净资产比例'
},
inplace=True,
)
temp_df = temp_df[
[
'行业编码',
'证监会行业名称',
'报告期',
'基金覆盖家数',
'行业规模',
'占净资产比例',
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
temp_df["行业规模"] = pd.to_numeric(temp_df["行业规模"])
temp_df["占净资产比例"] = pd.to_numeric(temp_df["占净资产比例"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_report_cninfo.py#L110-L170
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 14.754098 |
[
9,
10,
11,
12,
13,
14,
29,
32,
33,
34,
35,
46,
56,
57,
58,
59,
60
] | 27.868852 | false | 14.705882 | 61 | 1 | 72.131148 | 6 |
def fund_report_industry_allocation_cninfo(date: str = "20210630") -> pd.DataFrame:
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1113"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
params = {
"rdate": "-".join([date[:4], date[4:6], date[6:]]),
}
r = requests.post(url, headers=headers, params=params)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
'F004N': '行业规模',
'F003N': '基金覆盖家数',
'F002V': '证监会行业名称',
'F001V': '行业编码',
'ENDDATE': '报告期',
'F005N': '占净资产比例'
},
inplace=True,
)
temp_df = temp_df[
[
'行业编码',
'证监会行业名称',
'报告期',
'基金覆盖家数',
'行业规模',
'占净资产比例',
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
temp_df["行业规模"] = pd.to_numeric(temp_df["行业规模"])
temp_df["占净资产比例"] = pd.to_numeric(temp_df["占净资产比例"])
return temp_df
| 18,703 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_report_cninfo.py
|
fund_report_asset_allocation_cninfo
|
()
|
return temp_df
|
巨潮资讯-数据中心-专题统计-基金报表-基金资产配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:return: 基金资产配置
:rtype: pandas.DataFrame
|
巨潮资讯-数据中心-专题统计-基金报表-基金资产配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:return: 基金资产配置
:rtype: pandas.DataFrame
| 173 | 230 |
def fund_report_asset_allocation_cninfo() -> pd.DataFrame:
"""
巨潮资讯-数据中心-专题统计-基金报表-基金资产配置
http://webapi.cninfo.com.cn/#/thematicStatistics
:return: 基金资产配置
:rtype: pandas.DataFrame
"""
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1114"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
r = requests.post(url, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
'F001N': '基金覆盖家数',
'F008N': '现金货币类占净资产比例',
'F007N': '债券固定收益类占净资产比例',
'F006N': '股票权益类占净资产比例',
'ENDDATE': '报告期',
'F005N': '基金市场净资产规模'
},
inplace=True,
)
temp_df = temp_df[
[
'报告期',
'基金覆盖家数',
'股票权益类占净资产比例',
'债券固定收益类占净资产比例',
'现金货币类占净资产比例',
'基金市场净资产规模',
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
temp_df["股票权益类占净资产比例"] = pd.to_numeric(temp_df["股票权益类占净资产比例"])
temp_df["债券固定收益类占净资产比例"] = pd.to_numeric(temp_df["债券固定收益类占净资产比例"])
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/fund/fund_report_cninfo.py#L173-L230
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 12.068966 |
[
7,
8,
9,
10,
11,
12,
27,
28,
29,
30,
41,
51,
52,
53,
54,
55,
56,
57
] | 31.034483 | false | 14.705882 | 58 | 1 | 68.965517 | 4 |
def fund_report_asset_allocation_cninfo() -> pd.DataFrame:
url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1114"
random_time_str = str(int(time.time()))
js_code = py_mini_racer.MiniRacer()
js_code.eval(js_str)
mcode = js_code.call("mcode", random_time_str)
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "webapi.cninfo.com.cn",
"mcode": mcode,
"Origin": "http://webapi.cninfo.com.cn",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://webapi.cninfo.com.cn/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
}
r = requests.post(url, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["records"])
temp_df.rename(
columns={
'F001N': '基金覆盖家数',
'F008N': '现金货币类占净资产比例',
'F007N': '债券固定收益类占净资产比例',
'F006N': '股票权益类占净资产比例',
'ENDDATE': '报告期',
'F005N': '基金市场净资产规模'
},
inplace=True,
)
temp_df = temp_df[
[
'报告期',
'基金覆盖家数',
'股票权益类占净资产比例',
'债券固定收益类占净资产比例',
'现金货币类占净资产比例',
'基金市场净资产规模',
]
]
temp_df["报告期"] = pd.to_datetime(temp_df["报告期"]).dt.date
temp_df["基金覆盖家数"] = pd.to_numeric(temp_df["基金覆盖家数"])
temp_df["股票权益类占净资产比例"] = pd.to_numeric(temp_df["股票权益类占净资产比例"])
temp_df["债券固定收益类占净资产比例"] = pd.to_numeric(temp_df["债券固定收益类占净资产比例"])
temp_df["现金货币类占净资产比例"] = pd.to_numeric(temp_df["现金货币类占净资产比例"])
temp_df["基金市场净资产规模"] = pd.to_numeric(temp_df["基金市场净资产规模"])
return temp_df
| 18,704 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_scale_sina.py
|
fund_scale_open_sina
|
(symbol: str = "股票型基金") -> pd.Dat
|
return temp_df
|
新浪财经-基金数据中心-基金规模-开放式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"}
:type symbol: str
:return: 基金规模
:rtype: pandas.DataFrame
|
新浪财经-基金数据中心-基金规模-开放式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"}
:type symbol: str
:return: 基金规模
:rtype: pandas.DataFrame
| 14 | 88 |
def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame:
"""
新浪财经-基金数据中心-基金规模-开放式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:param symbol: choice of {"股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"}
:type symbol: str
:return: 基金规模
:rtype: pandas.DataFrame
"""
fund_map = {
"股票型基金": "2",
"混合型基金": "1",
"债券型基金": "3",
"货币型基金": "5",
"QDII基金": "6",
}
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['J2cW8KXheoWKdSHc']/NetValueReturn_Service.NetValueReturnOpen"
params = {
"page": "1",
"num": "10000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": fund_map[symbol],
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], 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/fund/fund_scale_sina.py#L14-L88
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 12 |
[
9,
16,
17,
26,
27,
28,
29,
30,
31,
32,
56,
69,
70,
71,
72,
73,
74
] | 22.666667 | false | 12.121212 | 75 | 1 | 77.333333 | 6 |
def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame:
fund_map = {
"股票型基金": "2",
"混合型基金": "1",
"债券型基金": "3",
"货币型基金": "5",
"QDII基金": "6",
}
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['J2cW8KXheoWKdSHc']/NetValueReturn_Service.NetValueReturnOpen"
params = {
"page": "1",
"num": "10000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": fund_map[symbol],
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce")
temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce")
return temp_df
| 18,705 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_scale_sina.py
|
fund_scale_close_sina
|
()
|
return temp_df
|
新浪财经-基金数据中心-基金规模-封闭式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
|
新浪财经-基金数据中心-基金规模-封闭式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
| 91 | 156 |
def fund_scale_close_sina() -> pd.DataFrame:
"""
新浪财经-基金数据中心-基金规模-封闭式基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['_bjN6KvXOkfPy2Bu']/NetValueReturn_Service.NetValueReturnClose"
params = {
"page": "1",
"num": "1000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": '',
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], 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/fund/fund_scale_sina.py#L91-L156
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10.606061 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
47,
60,
61,
62,
63,
64,
65
] | 24.242424 | false | 12.121212 | 66 | 1 | 75.757576 | 4 |
def fund_scale_close_sina() -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['_bjN6KvXOkfPy2Bu']/NetValueReturn_Service.NetValueReturnClose"
params = {
"page": "1",
"num": "1000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": '',
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce")
temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce")
return temp_df
| 18,706 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_scale_sina.py
|
fund_scale_structured_sina
|
()
|
return temp_df
|
新浪财经-基金数据中心-基金规模-分级子基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
|
新浪财经-基金数据中心-基金规模-分级子基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
| 159 | 224 |
def fund_scale_structured_sina() -> pd.DataFrame:
"""
新浪财经-基金数据中心-基金规模-分级子基金
http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
:return: 基金规模
:rtype: pandas.DataFrame
"""
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['cRrwseM7NWX68rDa']/NetValueReturn_Service.NetValueReturnCX"
params = {
"page": "1",
"num": "1000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": '',
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], 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/fund/fund_scale_sina.py#L159-L224
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10.606061 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
47,
60,
61,
62,
63,
64,
65
] | 24.242424 | false | 12.121212 | 66 | 1 | 75.757576 | 4 |
def fund_scale_structured_sina() -> pd.DataFrame:
url = "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2.CallbackList['cRrwseM7NWX68rDa']/NetValueReturn_Service.NetValueReturnCX"
params = {
"page": "1",
"num": "1000",
"sort": "zmjgm",
"asc": "0",
"ccode": "",
"type2": '',
"type3": "",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2])
temp_df = pd.DataFrame(data_json["data"])
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(
columns={
"index": "序号",
"symbol": "基金代码",
"sname": "基金简称",
"per_nav": "-",
"total_nav": "-",
"three_month": "-",
"six_month": "-",
"one_year": "-",
"form_year": "-",
"form_start": "-",
"name": "-",
"zmjgm": "总募集规模",
"clrq": "成立日期",
"jjjl": "基金经理",
"dwjz": "单位净值",
"ljjz": "-",
"jzrq": "更新日期",
"zjzfe": "最近总份额",
"jjglr_code": "-",
},
inplace=True,
)
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"单位净值",
"总募集规模",
"最近总份额",
"成立日期",
"基金经理",
"更新日期",
]
]
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date
temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce")
temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce")
return temp_df
| 18,707 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_portfolio_em.py
|
fund_portfolio_hold_em
|
(
symbol: str = "162411", date: str = "2020"
)
|
return big_df
|
天天基金网-基金档案-投资组合-基金持仓
https://fundf10.eastmoney.com/ccmx_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 基金持仓
:rtype: pandas.DataFrame
|
天天基金网-基金档案-投资组合-基金持仓
https://fundf10.eastmoney.com/ccmx_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 基金持仓
:rtype: pandas.DataFrame
| 15 | 88 |
def fund_portfolio_hold_em(
symbol: str = "162411", date: str = "2020"
) -> pd.DataFrame:
"""
天天基金网-基金档案-投资组合-基金持仓
https://fundf10.eastmoney.com/ccmx_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 基金持仓
:rtype: pandas.DataFrame
"""
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "jjcc",
"code": symbol,
"topline": "200",
"year": date,
"month": "",
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"股票代码": str})[
item
]
del temp_df["相关资讯"]
temp_df.rename(
columns={"占净值 比例": "占净值比例"}, inplace=True
)
temp_df["占净值比例"] = (
temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0]
)
temp_df.rename(
columns={"持股数(万股)": "持股数", "持仓市值(万元)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数 (万股)": "持股数", "持仓市值 (万元)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数(万股)": "持股数", "持仓市值(万元人民币)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数 (万股)": "持股数", "持仓市值 (万元人民币)": "持仓市值"}, inplace=True
)
temp_df["季度"] = item_label[item]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"占净值比例",
"持股数",
"持仓市值",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce")
big_df["持股数"] = pd.to_numeric(big_df["持股数"], errors="coerce")
big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce")
big_df["序号"] = range(1, len(big_df) + 1)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_portfolio_em.py#L15-L88
| 25 |
[
0
] | 1.351351 |
[
13,
14,
22,
23,
24,
25,
26,
30,
31,
32,
35,
36,
39,
42,
45,
48,
51,
56,
57,
68,
69,
70,
71,
72,
73
] | 33.783784 | false | 9.52381 | 74 | 3 | 66.216216 | 8 |
def fund_portfolio_hold_em(
symbol: str = "162411", date: str = "2020"
) -> pd.DataFrame:
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "jjcc",
"code": symbol,
"topline": "200",
"year": date,
"month": "",
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"股票代码": str})[
item
]
del temp_df["相关资讯"]
temp_df.rename(
columns={"占净值 比例": "占净值比例"}, inplace=True
)
temp_df["占净值比例"] = (
temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0]
)
temp_df.rename(
columns={"持股数(万股)": "持股数", "持仓市值(万元)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数 (万股)": "持股数", "持仓市值 (万元)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数(万股)": "持股数", "持仓市值(万元人民币)": "持仓市值"}, inplace=True
)
temp_df.rename(
columns={"持股数 (万股)": "持股数", "持仓市值 (万元人民币)": "持仓市值"}, inplace=True
)
temp_df["季度"] = item_label[item]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"占净值比例",
"持股数",
"持仓市值",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce")
big_df["持股数"] = pd.to_numeric(big_df["持股数"], errors="coerce")
big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce")
big_df["序号"] = range(1, len(big_df) + 1)
return big_df
| 18,708 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_portfolio_em.py
|
fund_portfolio_bond_hold_em
|
(
symbol: str = "000001", date: str = "2021"
)
|
return big_df
|
天天基金网-基金档案-投资组合-债券持仓
http://fundf10.eastmoney.com/ccmx1_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 债券持仓
:rtype: pandas.DataFrame
|
天天基金网-基金档案-投资组合-债券持仓
http://fundf10.eastmoney.com/ccmx1_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 债券持仓
:rtype: pandas.DataFrame
| 91 | 143 |
def fund_portfolio_bond_hold_em(
symbol: str = "000001", date: str = "2021"
) -> pd.DataFrame:
"""
天天基金网-基金档案-投资组合-债券持仓
http://fundf10.eastmoney.com/ccmx1_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 债券持仓
:rtype: pandas.DataFrame
"""
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "zqcc",
"code": symbol,
"year": date,
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"债券代码": str})[
item
]
temp_df["占净值比例"] = (
temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0]
)
temp_df.rename(columns={"持仓市值(万元)": "持仓市值"}, inplace=True)
temp_df["季度"] = item_label[item]
temp_df = temp_df[
[
"序号",
"债券代码",
"债券名称",
"占净值比例",
"持仓市值",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce")
big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce")
big_df["序号"] = range(1, len(big_df) + 1)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_portfolio_em.py#L91-L143
| 25 |
[
0
] | 1.886792 |
[
13,
14,
20,
21,
22,
23,
24,
28,
29,
30,
33,
36,
37,
38,
48,
49,
50,
51,
52
] | 35.849057 | false | 9.52381 | 53 | 3 | 64.150943 | 8 |
def fund_portfolio_bond_hold_em(
symbol: str = "000001", date: str = "2021"
) -> pd.DataFrame:
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "zqcc",
"code": symbol,
"year": date,
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"债券代码": str})[
item
]
temp_df["占净值比例"] = (
temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0]
)
temp_df.rename(columns={"持仓市值(万元)": "持仓市值"}, inplace=True)
temp_df["季度"] = item_label[item]
temp_df = temp_df[
[
"序号",
"债券代码",
"债券名称",
"占净值比例",
"持仓市值",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce")
big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce")
big_df["序号"] = range(1, len(big_df) + 1)
return big_df
| 18,709 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_portfolio_em.py
|
fund_portfolio_industry_allocation_em
|
(
symbol: str = "000001", date: str = "2021"
)
|
return temp_df
|
天天基金网-基金档案-投资组合-行业配置
http://fundf10.eastmoney.com/hytz_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 行业配置
:rtype: pandas.DataFrame
|
天天基金网-基金档案-投资组合-行业配置
http://fundf10.eastmoney.com/hytz_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 行业配置
:rtype: pandas.DataFrame
| 146 | 216 |
def fund_portfolio_industry_allocation_em(
symbol: str = "000001", date: str = "2021"
) -> pd.DataFrame:
"""
天天基金网-基金档案-投资组合-行业配置
http://fundf10.eastmoney.com/hytz_000001.html
:param symbol: 基金代码
:type symbol: str
:param date: 查询年份
:type date: str
:return: 行业配置
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/f10/HYPZ/"
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Host": "api.fund.eastmoney.com",
"Pragma": "no-cache",
"Referer": "http://fundf10.eastmoney.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36",
}
params = {
"fundCode": symbol,
"year": date,
"callback": "jQuery183006997159478989867_1648016188499",
"_": "1648016377955",
}
r = requests.get(url, params=params, headers=headers)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_list = []
for item in data_json["Data"]["QuarterInfos"]:
temp_list.extend(item["HYPZInfo"])
temp_df = pd.DataFrame(temp_list)
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"-",
"截止时间",
"-",
"行业类别",
"市值",
"-",
"占净值比例",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"序号",
"行业类别",
"占净值比例",
"市值",
"截止时间",
]
]
temp_df["市值"] = pd.to_numeric(temp_df["市值"])
temp_df["占净值比例"] = pd.to_numeric(temp_df["占净值比例"], errors="coerce")
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_portfolio_em.py#L146-L216
| 25 |
[
0
] | 1.408451 |
[
13,
14,
25,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
59,
68,
69,
70
] | 23.943662 | false | 9.52381 | 71 | 2 | 76.056338 | 8 |
def fund_portfolio_industry_allocation_em(
symbol: str = "000001", date: str = "2021"
) -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/f10/HYPZ/"
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Host": "api.fund.eastmoney.com",
"Pragma": "no-cache",
"Referer": "http://fundf10.eastmoney.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36",
}
params = {
"fundCode": symbol,
"year": date,
"callback": "jQuery183006997159478989867_1648016188499",
"_": "1648016377955",
}
r = requests.get(url, params=params, headers=headers)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
temp_list = []
for item in data_json["Data"]["QuarterInfos"]:
temp_list.extend(item["HYPZInfo"])
temp_df = pd.DataFrame(temp_list)
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"-",
"截止时间",
"-",
"行业类别",
"市值",
"-",
"占净值比例",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"序号",
"行业类别",
"占净值比例",
"市值",
"截止时间",
]
]
temp_df["市值"] = pd.to_numeric(temp_df["市值"])
temp_df["占净值比例"] = pd.to_numeric(temp_df["占净值比例"], errors="coerce")
return temp_df
| 18,710 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_portfolio_em.py
|
fund_portfolio_change_em
|
(
symbol: str = "003567", indicator: str = "累计买入", date: str = "2020"
)
|
return big_df
|
天天基金网-基金档案-投资组合-重大变动
http://fundf10.eastmoney.com/ccbd_000001.html
:param symbol: 基金代码
:type symbol: str
:param indicator: choice of {"累计买入", "累计卖出"}
:type indicator: str
:param date: 查询年份
:type date: str
:return: 重大变动
:rtype: pandas.DataFrame
|
天天基金网-基金档案-投资组合-重大变动
http://fundf10.eastmoney.com/ccbd_000001.html
:param symbol: 基金代码
:type symbol: str
:param indicator: choice of {"累计买入", "累计卖出"}
:type indicator: str
:param date: 查询年份
:type date: str
:return: 重大变动
:rtype: pandas.DataFrame
| 219 | 292 |
def fund_portfolio_change_em(
symbol: str = "003567", indicator: str = "累计买入", date: str = "2020"
) -> pd.DataFrame:
"""
天天基金网-基金档案-投资组合-重大变动
http://fundf10.eastmoney.com/ccbd_000001.html
:param symbol: 基金代码
:type symbol: str
:param indicator: choice of {"累计买入", "累计卖出"}
:type indicator: str
:param date: 查询年份
:type date: str
:return: 重大变动
:rtype: pandas.DataFrame
"""
indicator_map = {
"累计买入": "1",
"累计卖出": "2",
}
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "zdbd",
"code": symbol,
"zdbd": indicator_map[indicator],
"year": date,
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"股票代码": str})[
item
]
del temp_df["相关资讯"]
temp_df["占期初基金资产净值比例(%)"] = (
temp_df["占期初基金资产净值比例(%)"].str.split("%", expand=True).iloc[:, 0]
)
temp_df["季度"] = item_label[item]
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"本期累计买入金额",
"占期初基金资产净值比例",
"季度",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"本期累计买入金额",
"占期初基金资产净值比例",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
del big_df["序号"]
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.rename(columns={"index": "序号"}, inplace=True)
big_df["本期累计买入金额"] = pd.to_numeric(big_df["本期累计买入金额"], errors="coerce")
big_df["占期初基金资产净值比例"] = pd.to_numeric(
big_df["占期初基金资产净值比例"], errors="coerce"
)
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_portfolio_em.py#L219-L292
| 25 |
[
0
] | 1.351351 |
[
15,
19,
20,
27,
28,
29,
30,
31,
35,
36,
37,
40,
41,
44,
45,
53,
63,
64,
65,
66,
67,
69,
70,
73
] | 32.432432 | false | 9.52381 | 74 | 3 | 67.567568 | 10 |
def fund_portfolio_change_em(
symbol: str = "003567", indicator: str = "累计买入", date: str = "2020"
) -> pd.DataFrame:
indicator_map = {
"累计买入": "1",
"累计卖出": "2",
}
url = "http://fundf10.eastmoney.com/FundArchivesDatas.aspx"
params = {
"type": "zdbd",
"code": symbol,
"zdbd": indicator_map[indicator],
"year": date,
"rt": "0.913877030254846",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text[data_text.find("{") : -1])
soup = BeautifulSoup(data_json["content"], "lxml")
item_label = [
item.text.split("\xa0\xa0")[1]
for item in soup.find_all("h4", attrs={"class": "t"})
]
big_df = pd.DataFrame()
for item in range(len(item_label)):
temp_df = pd.read_html(data_json["content"], converters={"股票代码": str})[
item
]
del temp_df["相关资讯"]
temp_df["占期初基金资产净值比例(%)"] = (
temp_df["占期初基金资产净值比例(%)"].str.split("%", expand=True).iloc[:, 0]
)
temp_df["季度"] = item_label[item]
temp_df.columns = [
"序号",
"股票代码",
"股票名称",
"本期累计买入金额",
"占期初基金资产净值比例",
"季度",
]
temp_df = temp_df[
[
"序号",
"股票代码",
"股票名称",
"本期累计买入金额",
"占期初基金资产净值比例",
"季度",
]
]
big_df = pd.concat([big_df, temp_df], ignore_index=True)
del big_df["序号"]
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.rename(columns={"index": "序号"}, inplace=True)
big_df["本期累计买入金额"] = pd.to_numeric(big_df["本期累计买入金额"], errors="coerce")
big_df["占期初基金资产净值比例"] = pd.to_numeric(
big_df["占期初基金资产净值比例"], errors="coerce"
)
return big_df
| 18,711 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_fhsp_em.py
|
fund_fh_em
|
()
|
return big_df
|
天天基金网-基金数据-分红送配-基金分红
https://fund.eastmoney.com/data/fundfenhong.html#DJR,desc,1,,,
:return: 基金分红
:rtype: pandas.DataFrame
|
天天基金网-基金数据-分红送配-基金分红
https://fund.eastmoney.com/data/fundfenhong.html#DJR,desc,1,,,
:return: 基金分红
:rtype: pandas.DataFrame
| 13 | 60 |
def fund_fh_em() -> pd.DataFrame:
"""
天天基金网-基金数据-分红送配-基金分红
https://fund.eastmoney.com/data/fundfenhong.html#DJR,desc,1,,,
:return: 基金分红
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "8",
"page": "1",
"rank": "BZDM",
"sort": "asc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_list = eval(
data_text[data_text.find("[["): data_text.find(";var jjfh_jjgs")]
)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"权益登记日",
"除息日期",
"分红",
"分红发放日",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "权益登记日", "除息日期", "分红", "分红发放日"]]
big_df['权益登记日'] = pd.to_datetime(big_df['权益登记日']).dt.date
big_df['除息日期'] = pd.to_datetime(big_df['除息日期']).dt.date
big_df['分红发放日'] = pd.to_datetime(big_df['分红发放日']).dt.date
big_df['分红'] = pd.to_numeric(big_df['分红'])
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_fhsp_em.py#L13-L60
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.583333 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
25,
28,
29,
30,
31,
32,
42,
43,
44,
45,
46,
47
] | 45.833333 | false | 10.126582 | 48 | 2 | 54.166667 | 4 |
def fund_fh_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "8",
"page": "1",
"rank": "BZDM",
"sort": "asc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_list = eval(
data_text[data_text.find("[["): data_text.find(";var jjfh_jjgs")]
)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df["index"] = big_df.index + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"权益登记日",
"除息日期",
"分红",
"分红发放日",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "权益登记日", "除息日期", "分红", "分红发放日"]]
big_df['权益登记日'] = pd.to_datetime(big_df['权益登记日']).dt.date
big_df['除息日期'] = pd.to_datetime(big_df['除息日期']).dt.date
big_df['分红发放日'] = pd.to_datetime(big_df['分红发放日']).dt.date
big_df['分红'] = pd.to_numeric(big_df['分红'])
return big_df
| 18,712 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_fhsp_em.py
|
fund_cf_em
|
()
|
return big_df
|
天天基金网-基金数据-分红送配-基金拆分
https://fund.eastmoney.com/data/fundchaifen.html#FSRQ,desc,1,,,
:return: 基金拆分
:rtype: pandas.DataFrame
|
天天基金网-基金数据-分红送配-基金拆分
https://fund.eastmoney.com/data/fundchaifen.html#FSRQ,desc,1,,,
:return: 基金拆分
:rtype: pandas.DataFrame
| 63 | 108 |
def fund_cf_em() -> pd.DataFrame:
"""
天天基金网-基金数据-分红送配-基金拆分
https://fund.eastmoney.com/data/fundchaifen.html#FSRQ,desc,1,,,
:return: 基金拆分
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "9",
"page": "1",
"rank": "FSRQ",
"sort": "desc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_str = data_text[data_text.find("[["): data_text.find(";var jjcf_jjgs")]
if temp_str:
temp_list = eval(temp_str)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df.loc[:, 'index'] = big_df['index'] + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"拆分折算日",
"拆分类型",
"拆分折算",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "拆分折算日", "拆分类型", "拆分折算"]]
big_df['拆分折算日'] = pd.to_datetime(big_df['拆分折算日']).dt.date
big_df['拆分折算'] = pd.to_numeric(big_df['拆分折算'], errors="coerce")
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_fhsp_em.py#L63-L108
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 15.217391 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
31,
32,
33,
42,
43,
44,
45
] | 47.826087 | false | 10.126582 | 46 | 3 | 52.173913 | 4 |
def fund_cf_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "9",
"page": "1",
"rank": "FSRQ",
"sort": "desc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_str = data_text[data_text.find("[["): data_text.find(";var jjcf_jjgs")]
if temp_str:
temp_list = eval(temp_str)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df.loc[:, 'index'] = big_df['index'] + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"拆分折算日",
"拆分类型",
"拆分折算",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "拆分折算日", "拆分类型", "拆分折算"]]
big_df['拆分折算日'] = pd.to_datetime(big_df['拆分折算日']).dt.date
big_df['拆分折算'] = pd.to_numeric(big_df['拆分折算'], errors="coerce")
return big_df
| 18,713 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_fhsp_em.py
|
fund_fh_rank_em
|
()
|
return big_df
|
天天基金网-基金数据-分红送配-基金分红排行
https://fund.eastmoney.com/data/fundleijifenhong.html
:return: 基金分红排行
:rtype: pandas.DataFrame
|
天天基金网-基金数据-分红送配-基金分红排行
https://fund.eastmoney.com/data/fundleijifenhong.html
:return: 基金分红排行
:rtype: pandas.DataFrame
| 111 | 157 |
def fund_fh_rank_em() -> pd.DataFrame:
"""
天天基金网-基金数据-分红送配-基金分红排行
https://fund.eastmoney.com/data/fundleijifenhong.html
:return: 基金分红排行
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "10",
"page": "1",
"rank": "FHFCZ",
"sort": "desc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_list = eval(
data_text[data_text.find("[["): data_text.find(";var fhph_jjgs")]
)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df.loc[:, "index"] = big_df.index + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"累计分红",
"累计次数",
"成立日期",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "累计分红", "累计次数", "成立日期"]]
big_df['成立日期'] = pd.to_datetime(big_df['成立日期']).dt.date
big_df['累计分红'] = pd.to_numeric(big_df['累计分红'], errors="coerce")
big_df['累计次数'] = pd.to_numeric(big_df['累计次数'], errors="coerce")
return big_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_fhsp_em.py#L111-L157
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 14.893617 |
[
7,
8,
17,
18,
19,
20,
21,
22,
23,
24,
25,
28,
29,
31,
32,
33,
42,
43,
44,
45,
46
] | 44.680851 | false | 10.126582 | 47 | 2 | 55.319149 | 4 |
def fund_fh_rank_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/Data/funddataIndex_Interface.aspx"
params = {
"dt": "10",
"page": "1",
"rank": "FHFCZ",
"sort": "desc",
"gs": "",
"ftype": "",
"year": "",
}
r = requests.get(url, params=params)
data_text = r.text
total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0]
big_df = pd.DataFrame()
for page in tqdm(range(1, total_page + 1), leave=False):
params.update({"page": page})
r = requests.get(url, params=params)
data_text = r.text
temp_list = eval(
data_text[data_text.find("[["): data_text.find(";var fhph_jjgs")]
)
temp_df = pd.DataFrame(temp_list)
big_df = pd.concat([big_df, temp_df], ignore_index=True)
big_df.reset_index(inplace=True)
big_df.loc[:, "index"] = big_df.index + 1
big_df.columns = [
"序号",
"基金代码",
"基金简称",
"累计分红",
"累计次数",
"成立日期",
"-",
]
big_df = big_df[["序号", "基金代码", "基金简称", "累计分红", "累计次数", "成立日期"]]
big_df['成立日期'] = pd.to_datetime(big_df['成立日期']).dt.date
big_df['累计分红'] = pd.to_numeric(big_df['累计分红'], errors="coerce")
big_df['累计次数'] = pd.to_numeric(big_df['累计次数'], errors="coerce")
return big_df
| 18,714 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_init_em.py
|
fund_new_found_em
|
()
|
return temp_df
|
基金数据-新发基金-新成立基金
http://fund.eastmoney.com/data/xinfound.html
:return: 新成立基金
:rtype: pandas.DataFrame
|
基金数据-新发基金-新成立基金
http://fund.eastmoney.com/data/xinfound.html
:return: 新成立基金
:rtype: pandas.DataFrame
| 14 | 77 |
def fund_new_found_em() -> pd.DataFrame:
"""
基金数据-新发基金-新成立基金
http://fund.eastmoney.com/data/xinfound.html
:return: 新成立基金
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/data/FundNewIssue.aspx"
params = {
"t": "xcln",
"sort": "jzrgq,desc",
"y": "",
"page": "1,50000",
"isbuy": "1",
"v": "0.4069919776543214",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var newfunddata="))
temp_df = pd.DataFrame(data_json["datas"])
temp_df.columns = [
"基金代码",
"基金简称",
"发行公司",
"_",
"基金类型",
"募集份额",
"成立日期",
"成立来涨幅",
"基金经理",
"申购状态",
"集中认购期",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"优惠费率",
]
temp_df = temp_df[
[
"基金代码",
"基金简称",
"发行公司",
"基金类型",
"集中认购期",
"募集份额",
"成立日期",
"成立来涨幅",
"基金经理",
"申购状态",
"优惠费率",
]
]
temp_df['募集份额'] = pd.to_numeric(temp_df['募集份额'])
temp_df['成立日期'] = pd.to_datetime(temp_df['成立日期']).dt.date
temp_df['成立来涨幅'] = pd.to_numeric(temp_df['成立来涨幅'].str.replace(',', ''))
temp_df['优惠费率'] = temp_df['优惠费率'].str.strip("%")
temp_df['优惠费率'] = pd.to_numeric(temp_df['优惠费率'])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_init_em.py#L14-L77
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10.9375 |
[
7,
8,
16,
17,
18,
19,
20,
41,
57,
58,
59,
60,
61,
63
] | 21.875 | false | 27.272727 | 64 | 1 | 78.125 | 4 |
def fund_new_found_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/data/FundNewIssue.aspx"
params = {
"t": "xcln",
"sort": "jzrgq,desc",
"y": "",
"page": "1,50000",
"isbuy": "1",
"v": "0.4069919776543214",
}
r = requests.get(url, params=params)
data_text = r.text
data_json = demjson.decode(data_text.strip("var newfunddata="))
temp_df = pd.DataFrame(data_json["datas"])
temp_df.columns = [
"基金代码",
"基金简称",
"发行公司",
"_",
"基金类型",
"募集份额",
"成立日期",
"成立来涨幅",
"基金经理",
"申购状态",
"集中认购期",
"_",
"_",
"_",
"_",
"_",
"_",
"_",
"优惠费率",
]
temp_df = temp_df[
[
"基金代码",
"基金简称",
"发行公司",
"基金类型",
"集中认购期",
"募集份额",
"成立日期",
"成立来涨幅",
"基金经理",
"申购状态",
"优惠费率",
]
]
temp_df['募集份额'] = pd.to_numeric(temp_df['募集份额'])
temp_df['成立日期'] = pd.to_datetime(temp_df['成立日期']).dt.date
temp_df['成立来涨幅'] = pd.to_numeric(temp_df['成立来涨幅'].str.replace(',', ''))
temp_df['优惠费率'] = temp_df['优惠费率'].str.strip("%")
temp_df['优惠费率'] = pd.to_numeric(temp_df['优惠费率'])
return temp_df
| 18,715 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_purchase_em
|
()
|
return temp_df
|
东方财富网站-天天基金网-基金数据-基金申购状态
https://fund.eastmoney.com/Fund_sgzt_bzdm.html#fcode,asc_1
:return: 基金申购状态
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-基金申购状态
https://fund.eastmoney.com/Fund_sgzt_bzdm.html#fcode,asc_1
:return: 基金申购状态
:rtype: pandas.DataFrame
| 20 | 82 |
def fund_purchase_em() -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-基金申购状态
https://fund.eastmoney.com/Fund_sgzt_bzdm.html#fcode,asc_1
:return: 基金申购状态
:rtype: pandas.DataFrame
"""
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
params = {
"t": "8",
"page": "1,50000",
"js": "reData",
"sort": "fcode,asc",
"_": "1641528557742",
}
r = requests.get(url, params=params, headers=headers)
data_text = r.text
data_json = demjson.decode(data_text.strip("var reData="))
temp_df = pd.DataFrame(data_json["datas"])
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"基金类型",
"最新净值/万份收益",
"最新净值/万份收益-报告时间",
"申购状态",
"赎回状态",
"下一开放日",
"购买起点",
"日累计限定金额",
"-",
"-",
"手续费",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"基金类型",
"最新净值/万份收益",
"最新净值/万份收益-报告时间",
"申购状态",
"赎回状态",
"下一开放日",
"购买起点",
"日累计限定金额",
"手续费",
]
]
temp_df["下一开放日"] = pd.to_datetime(temp_df["下一开放日"]).dt.date
temp_df["最新净值/万份收益"] = pd.to_numeric(temp_df["最新净值/万份收益"])
temp_df["购买起点"] = pd.to_numeric(temp_df["购买起点"])
temp_df["日累计限定金额"] = pd.to_numeric(temp_df["日累计限定金额"])
temp_df["手续费"] = temp_df["手续费"].str.strip("%")
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"])
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L20-L82
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 11.111111 |
[
7,
8,
11,
18,
19,
20,
21,
22,
23,
24,
40,
56,
57,
58,
59,
60,
61,
62
] | 28.571429 | false | 6.413994 | 63 | 1 | 71.428571 | 4 |
def fund_purchase_em() -> pd.DataFrame:
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
params = {
"t": "8",
"page": "1,50000",
"js": "reData",
"sort": "fcode,asc",
"_": "1641528557742",
}
r = requests.get(url, params=params, headers=headers)
data_text = r.text
data_json = demjson.decode(data_text.strip("var reData="))
temp_df = pd.DataFrame(data_json["datas"])
temp_df.reset_index(inplace=True)
temp_df["index"] = temp_df.index + 1
temp_df.columns = [
"序号",
"基金代码",
"基金简称",
"基金类型",
"最新净值/万份收益",
"最新净值/万份收益-报告时间",
"申购状态",
"赎回状态",
"下一开放日",
"购买起点",
"日累计限定金额",
"-",
"-",
"手续费",
]
temp_df = temp_df[
[
"序号",
"基金代码",
"基金简称",
"基金类型",
"最新净值/万份收益",
"最新净值/万份收益-报告时间",
"申购状态",
"赎回状态",
"下一开放日",
"购买起点",
"日累计限定金额",
"手续费",
]
]
temp_df["下一开放日"] = pd.to_datetime(temp_df["下一开放日"]).dt.date
temp_df["最新净值/万份收益"] = pd.to_numeric(temp_df["最新净值/万份收益"])
temp_df["购买起点"] = pd.to_numeric(temp_df["购买起点"])
temp_df["日累计限定金额"] = pd.to_numeric(temp_df["日累计限定金额"])
temp_df["手续费"] = temp_df["手续费"].str.strip("%")
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"])
return temp_df
| 18,716 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_name_em
|
()
|
return temp_df
|
东方财富网站-天天基金网-基金数据-所有基金的名称和类型
https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc
:return: 所有基金的名称和类型
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-所有基金的名称和类型
https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc
:return: 所有基金的名称和类型
:rtype: pandas.DataFrame
| 85 | 101 |
def fund_name_em() -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-所有基金的名称和类型
https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc
:return: 所有基金的名称和类型
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/js/fundcode_search.js"
res = requests.get(url, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var r = ")[:-1])
temp_df = pd.DataFrame(data_json)
temp_df.columns = ["基金代码", "拼音缩写", "基金简称", "基金类型", "拼音全称"]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L85-L101
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 41.176471 |
[
7,
10,
11,
12,
13,
14,
15,
16
] | 47.058824 | false | 6.413994 | 17 | 1 | 52.941176 | 4 |
def fund_name_em() -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/js/fundcode_search.js"
res = requests.get(url, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var r = ")[:-1])
temp_df = pd.DataFrame(data_json)
temp_df.columns = ["基金代码", "拼音缩写", "基金简称", "基金类型", "拼音全称"]
return temp_df
| 18,717 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_info_index_em
|
(
symbol: str = "沪深指数", indicator: str = "被动指数型"
)
|
return temp_df
|
东方财富网站-天天基金网-基金数据-基金信息-指数型
https://fund.eastmoney.com/trade/zs.html
:param symbol: choice of {"全部", "沪深指数", "行业主题", "大盘指数", "中盘指数", "小盘指数", "股票指数", "债券指数"}
:type symbol: str
:param indicator: choice of {"全部", "被动指数型", "增强指数型"}
:type indicator: str
:return: pandas.DataFrame
:rtype: 基金信息-指数型
|
东方财富网站-天天基金网-基金数据-基金信息-指数型
https://fund.eastmoney.com/trade/zs.html
:param symbol: choice of {"全部", "沪深指数", "行业主题", "大盘指数", "中盘指数", "小盘指数", "股票指数", "债券指数"}
:type symbol: str
:param indicator: choice of {"全部", "被动指数型", "增强指数型"}
:type indicator: str
:return: pandas.DataFrame
:rtype: 基金信息-指数型
| 104 | 255 |
def fund_info_index_em(
symbol: str = "沪深指数", indicator: str = "被动指数型"
) -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-基金信息-指数型
https://fund.eastmoney.com/trade/zs.html
:param symbol: choice of {"全部", "沪深指数", "行业主题", "大盘指数", "中盘指数", "小盘指数", "股票指数", "债券指数"}
:type symbol: str
:param indicator: choice of {"全部", "被动指数型", "增强指数型"}
:type indicator: str
:return: pandas.DataFrame
:rtype: 基金信息-指数型
"""
symbol_map = {
"全部": "",
"沪深指数": "053",
"行业主题": "054",
"大盘指数": "01",
"中盘指数": "02",
"小盘指数": "03",
"股票指数": "050|001",
"债券指数": "050|003",
}
indicator_map = {
"全部": "",
"被动指数型": "051",
"增强指数型": "052",
}
url = "http://api.fund.eastmoney.com/FundTradeRank/GetRankList"
if symbol in {"股票指数", "股票指数"}:
params = {
"ft": "zs",
"sc": "1n",
"st": "desc",
"pi": "1",
"pn": "10000",
"cp": "",
"ct": "",
"cd": "",
"ms": "",
"fr": symbol_map[symbol].split("|")[0],
"plevel": "",
"fst": "",
"ftype": symbol_map[symbol].split("|")[1],
"fr1": indicator_map[indicator],
"fl": "0",
"isab": "1",
"_": "1658888335885",
}
else:
params = {
"ft": "zs",
"sc": "1n",
"st": "desc",
"pi": "1",
"pn": "10000",
"cp": "",
"ct": "",
"cd": "",
"ms": "",
"fr": symbol_map[symbol].split("|")[0],
"plevel": "",
"fst": "",
"ftype": "",
"fr1": indicator_map[indicator],
"fl": "0",
"isab": "1",
"_": "1658888335885",
}
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Host": "api.fund.eastmoney.com",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://fund.eastmoney.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_json = json.loads(data_json["Data"])
temp_df = pd.DataFrame([item.split("|") for item in data_json["datas"]])
temp_df.columns = [
"基金代码",
"基金名称",
"-",
"日期",
"单位净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"-",
"-",
"-",
"手续费",
"-",
"-",
"-",
"-",
"-",
"起购金额",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"基金代码",
"基金名称",
"单位净值",
"日期",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"手续费",
"起购金额",
]
]
temp_df["跟踪标的"] = symbol
temp_df["跟踪方式"] = indicator
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
temp_df["近1周"] = pd.to_numeric(temp_df["近1周"])
temp_df["近1月"] = pd.to_numeric(temp_df["近1月"])
temp_df["近3月"] = pd.to_numeric(temp_df["近3月"])
temp_df["近6月"] = pd.to_numeric(temp_df["近6月"])
temp_df["近1年"] = pd.to_numeric(temp_df["近1年"])
temp_df["近2年"] = pd.to_numeric(temp_df["近2年"])
temp_df["近3年"] = pd.to_numeric(temp_df["近3年"])
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/fund/fund_em.py#L104-L255
| 25 |
[
0
] | 0.657895 |
[
13,
23,
28,
29,
30,
50,
69,
80,
81,
82,
83,
84,
115,
135,
136,
138,
139,
140,
141,
142,
143,
144,
145,
146,
147,
148,
149,
151
] | 18.421053 | false | 6.413994 | 152 | 3 | 81.578947 | 8 |
def fund_info_index_em(
symbol: str = "沪深指数", indicator: str = "被动指数型"
) -> pd.DataFrame:
symbol_map = {
"全部": "",
"沪深指数": "053",
"行业主题": "054",
"大盘指数": "01",
"中盘指数": "02",
"小盘指数": "03",
"股票指数": "050|001",
"债券指数": "050|003",
}
indicator_map = {
"全部": "",
"被动指数型": "051",
"增强指数型": "052",
}
url = "http://api.fund.eastmoney.com/FundTradeRank/GetRankList"
if symbol in {"股票指数", "股票指数"}:
params = {
"ft": "zs",
"sc": "1n",
"st": "desc",
"pi": "1",
"pn": "10000",
"cp": "",
"ct": "",
"cd": "",
"ms": "",
"fr": symbol_map[symbol].split("|")[0],
"plevel": "",
"fst": "",
"ftype": symbol_map[symbol].split("|")[1],
"fr1": indicator_map[indicator],
"fl": "0",
"isab": "1",
"_": "1658888335885",
}
else:
params = {
"ft": "zs",
"sc": "1n",
"st": "desc",
"pi": "1",
"pn": "10000",
"cp": "",
"ct": "",
"cd": "",
"ms": "",
"fr": symbol_map[symbol].split("|")[0],
"plevel": "",
"fst": "",
"ftype": "",
"fr1": indicator_map[indicator],
"fl": "0",
"isab": "1",
"_": "1658888335885",
}
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Cache-Control": "no-cache",
"Host": "api.fund.eastmoney.com",
"Pragma": "no-cache",
"Proxy-Connection": "keep-alive",
"Referer": "http://fund.eastmoney.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
data_json = json.loads(data_json["Data"])
temp_df = pd.DataFrame([item.split("|") for item in data_json["datas"]])
temp_df.columns = [
"基金代码",
"基金名称",
"-",
"日期",
"单位净值",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"-",
"-",
"-",
"手续费",
"-",
"-",
"-",
"-",
"-",
"起购金额",
"-",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"基金代码",
"基金名称",
"单位净值",
"日期",
"日增长率",
"近1周",
"近1月",
"近3月",
"近6月",
"近1年",
"近2年",
"近3年",
"今年来",
"成立来",
"手续费",
"起购金额",
]
]
temp_df["跟踪标的"] = symbol
temp_df["跟踪方式"] = indicator
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
temp_df["近1周"] = pd.to_numeric(temp_df["近1周"])
temp_df["近1月"] = pd.to_numeric(temp_df["近1月"])
temp_df["近3月"] = pd.to_numeric(temp_df["近3月"])
temp_df["近6月"] = pd.to_numeric(temp_df["近6月"])
temp_df["近1年"] = pd.to_numeric(temp_df["近1年"])
temp_df["近2年"] = pd.to_numeric(temp_df["近2年"])
temp_df["近3年"] = pd.to_numeric(temp_df["近3年"])
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,718 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_open_fund_daily_em
|
()
|
return data_df
|
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:return: 当前交易日的所有开放式基金净值数据
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:return: 当前交易日的所有开放式基金净值数据
:rtype: pandas.DataFrame
| 258 | 324 |
def fund_open_fund_daily_em() -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:return: 当前交易日的所有开放式基金净值数据
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
params = {
"t": "1",
"lx": "1",
"letter": "",
"gsid": "",
"text": "",
"sort": "zdf,desc",
"page": "1,20000",
"dt": "1580914040623",
"atfc": "",
"onlySale": "0",
}
res = requests.get(url, params=params, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var db="))
temp_df = pd.DataFrame(data_json["datas"])
show_day = data_json["showday"]
temp_df.columns = [
"基金代码",
"基金简称",
"-",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}-单位净值",
f"{show_day[1]}-累计净值",
"日增长值",
"日增长率",
"申购状态",
"赎回状态",
"-",
"-",
"-",
"-",
"-",
"-",
"手续费",
"-",
"-",
"-",
]
data_df = temp_df[
[
"基金代码",
"基金简称",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}-单位净值",
f"{show_day[1]}-累计净值",
"日增长值",
"日增长率",
"申购状态",
"赎回状态",
"手续费",
]
]
return data_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L258-L324
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10.447761 |
[
7,
10,
11,
23,
24,
25,
26,
27,
28,
51,
66
] | 16.41791 | false | 6.413994 | 67 | 1 | 83.58209 | 4 |
def fund_open_fund_daily_em() -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
params = {
"t": "1",
"lx": "1",
"letter": "",
"gsid": "",
"text": "",
"sort": "zdf,desc",
"page": "1,20000",
"dt": "1580914040623",
"atfc": "",
"onlySale": "0",
}
res = requests.get(url, params=params, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var db="))
temp_df = pd.DataFrame(data_json["datas"])
show_day = data_json["showday"]
temp_df.columns = [
"基金代码",
"基金简称",
"-",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}-单位净值",
f"{show_day[1]}-累计净值",
"日增长值",
"日增长率",
"申购状态",
"赎回状态",
"-",
"-",
"-",
"-",
"-",
"-",
"手续费",
"-",
"-",
"-",
]
data_df = temp_df[
[
"基金代码",
"基金简称",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}-单位净值",
f"{show_day[1]}-累计净值",
"日增长值",
"日增长率",
"申购状态",
"赎回状态",
"手续费",
]
]
return data_df
| 18,719 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_open_fund_info_em
|
(
fund: str = "000002", indicator: str = "单位净值走势"
)
|
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:param fund: 基金代码; 可以通过调用 fund_open_fund_daily_em 获取所有开放式基金代码
:type fund: str
:param indicator: 需要获取的指标
:type indicator: str
:return: 指定基金指定指标的数据
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:param fund: 基金代码; 可以通过调用 fund_open_fund_daily_em 获取所有开放式基金代码
:type fund: str
:param indicator: 需要获取的指标
:type indicator: str
:return: 指定基金指定指标的数据
:rtype: pandas.DataFrame
| 327 | 528 |
def fund_open_fund_info_em(
fund: str = "000002", indicator: str = "单位净值走势"
) -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-开放式基金净值
https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1
:param fund: 基金代码; 可以通过调用 fund_open_fund_daily_em 获取所有开放式基金代码
:type fund: str
:param indicator: 需要获取的指标
:type indicator: str
:return: 指定基金指定指标的数据
:rtype: pandas.DataFrame
"""
# url = f"http://fundgz.1234567.com.cn/js/{fund}.js" # 描述信息
url = f"http://fund.eastmoney.com/pingzhongdata/{fund}.js" # 各类数据都在里面
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
r = requests.get(url, headers=headers)
data_text = r.text
# 单位净值走势
if indicator == "单位净值走势":
try:
data_json = demjson.decode(
data_text[
data_text.find("Data_netWorthTrend")
+ 21 : data_text.find("Data_ACWorthTrend")
- 15
]
)
except:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json)
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"净值日期",
"单位净值",
"日增长率",
"_",
]
temp_df = temp_df[
[
"净值日期",
"单位净值",
"日增长率",
]
]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
return temp_df
# 累计净值走势
if indicator == "累计净值走势":
try:
data_json = demjson.decode(
data_text[
data_text.find("Data_ACWorthTrend")
+ 20 : data_text.find("Data_grandTotal")
- 16
]
)
except:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json)
if temp_df.empty:
return pd.DataFrame()
temp_df.columns = ["x", "y"]
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"净值日期",
"累计净值",
]
temp_df = temp_df[
[
"净值日期",
"累计净值",
]
]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"])
return temp_df
# 累计收益率走势
if indicator == "累计收益率走势":
data_json = demjson.decode(
data_text[
data_text.find("Data_grandTotal")
+ 18 : data_text.find("Data_rateInSimilarType")
- 15
]
)
temp_df_main = pd.DataFrame(data_json[0]["data"]) # 本产品
# temp_df_mean = pd.DataFrame(data_json[1]["data"]) # 同类平均
# temp_df_hs = pd.DataFrame(data_json[2]["data"]) # 沪深300
temp_df_main.columns = ["x", "y"]
temp_df_main["x"] = pd.to_datetime(
temp_df_main["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df_main["x"] = temp_df_main["x"].dt.date
temp_df_main.columns = [
"净值日期",
"累计收益率",
]
temp_df_main = temp_df_main[
[
"净值日期",
"累计收益率",
]
]
temp_df_main["净值日期"] = pd.to_datetime(temp_df_main["净值日期"]).dt.date
temp_df_main["累计收益率"] = pd.to_numeric(temp_df_main["累计收益率"])
return temp_df_main
# 同类排名走势
if indicator == "同类排名走势":
data_json = demjson.decode(
data_text[
data_text.find("Data_rateInSimilarType")
+ 25 : data_text.find("Data_rateInSimilarPersent")
- 16
]
)
temp_df = pd.DataFrame(data_json)
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"报告日期",
"同类型排名-每日近三月排名",
"总排名-每日近三月排名",
]
temp_df = temp_df[
[
"报告日期",
"同类型排名-每日近三月排名",
"总排名-每日近三月排名",
]
]
temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
temp_df["同类型排名-每日近三月排名"] = pd.to_numeric(temp_df["同类型排名-每日近三月排名"])
temp_df["总排名-每日近三月排名"] = pd.to_numeric(temp_df["总排名-每日近三月排名"])
return temp_df
# 同类排名百分比
if indicator == "同类排名百分比":
data_json = demjson.decode(
data_text[
data_text.find("Data_rateInSimilarPersent")
+ 26 : data_text.find("Data_fluctuationScale")
- 23
]
)
temp_df = pd.DataFrame(data_json)
temp_df.columns = ["x", "y"]
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"报告日期",
"同类型排名-每日近3月收益排名百分比",
]
temp_df = temp_df[
[
"报告日期",
"同类型排名-每日近3月收益排名百分比",
]
]
temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
temp_df["同类型排名-每日近3月收益排名百分比"] = pd.to_numeric(
temp_df["同类型排名-每日近3月收益排名百分比"]
)
return temp_df
# 分红送配详情
if indicator == "分红送配详情":
url = f"http://fundf10.eastmoney.com/fhsp_{fund}.html"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[1]
if temp_df.iloc[0, 1] == "暂无分红信息!":
return None
else:
return temp_df
# 拆分详情
if indicator == "拆分详情":
url = f"http://fundf10.eastmoney.com/fhsp_{fund}.html"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[2]
if temp_df.iloc[0, 1] == "暂无拆分信息!":
return None
else:
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L327-L528
| 25 |
[
0
] | 0.49505 |
[
14,
15,
18,
19,
22,
23,
24,
31,
32,
33,
34,
37,
38,
44,
51,
52,
53,
54,
57,
58,
59,
66,
67,
68,
69,
70,
71,
72,
75,
76,
80,
86,
87,
88,
91,
92,
99,
102,
103,
106,
107,
111,
117,
118,
119,
122,
123,
130,
131,
134,
135,
140,
147,
148,
149,
150,
153,
154,
161,
162,
163,
166,
167,
171,
177,
178,
181,
184,
185,
186,
187,
188,
189,
191,
194,
195,
196,
197,
198,
199,
201
] | 40.09901 | false | 6.413994 | 202 | 13 | 59.90099 | 8 |
def fund_open_fund_info_em(
fund: str = "000002", indicator: str = "单位净值走势"
) -> pd.DataFrame:
# url = f"http://fundgz.1234567.com.cn/js/{fund}.js" # 描述信息
url = f"http://fund.eastmoney.com/pingzhongdata/{fund}.js" # 各类数据都在里面
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
r = requests.get(url, headers=headers)
data_text = r.text
# 单位净值走势
if indicator == "单位净值走势":
try:
data_json = demjson.decode(
data_text[
data_text.find("Data_netWorthTrend")
+ 21 : data_text.find("Data_ACWorthTrend")
- 15
]
)
except:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json)
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"净值日期",
"单位净值",
"日增长率",
"_",
]
temp_df = temp_df[
[
"净值日期",
"单位净值",
"日增长率",
]
]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
return temp_df
# 累计净值走势
if indicator == "累计净值走势":
try:
data_json = demjson.decode(
data_text[
data_text.find("Data_ACWorthTrend")
+ 20 : data_text.find("Data_grandTotal")
- 16
]
)
except:
return pd.DataFrame()
temp_df = pd.DataFrame(data_json)
if temp_df.empty:
return pd.DataFrame()
temp_df.columns = ["x", "y"]
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"净值日期",
"累计净值",
]
temp_df = temp_df[
[
"净值日期",
"累计净值",
]
]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"])
return temp_df
# 累计收益率走势
if indicator == "累计收益率走势":
data_json = demjson.decode(
data_text[
data_text.find("Data_grandTotal")
+ 18 : data_text.find("Data_rateInSimilarType")
- 15
]
)
temp_df_main = pd.DataFrame(data_json[0]["data"]) # 本产品
# temp_df_mean = pd.DataFrame(data_json[1]["data"]) # 同类平均
# temp_df_hs = pd.DataFrame(data_json[2]["data"]) # 沪深300
temp_df_main.columns = ["x", "y"]
temp_df_main["x"] = pd.to_datetime(
temp_df_main["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df_main["x"] = temp_df_main["x"].dt.date
temp_df_main.columns = [
"净值日期",
"累计收益率",
]
temp_df_main = temp_df_main[
[
"净值日期",
"累计收益率",
]
]
temp_df_main["净值日期"] = pd.to_datetime(temp_df_main["净值日期"]).dt.date
temp_df_main["累计收益率"] = pd.to_numeric(temp_df_main["累计收益率"])
return temp_df_main
# 同类排名走势
if indicator == "同类排名走势":
data_json = demjson.decode(
data_text[
data_text.find("Data_rateInSimilarType")
+ 25 : data_text.find("Data_rateInSimilarPersent")
- 16
]
)
temp_df = pd.DataFrame(data_json)
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"报告日期",
"同类型排名-每日近三月排名",
"总排名-每日近三月排名",
]
temp_df = temp_df[
[
"报告日期",
"同类型排名-每日近三月排名",
"总排名-每日近三月排名",
]
]
temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
temp_df["同类型排名-每日近三月排名"] = pd.to_numeric(temp_df["同类型排名-每日近三月排名"])
temp_df["总排名-每日近三月排名"] = pd.to_numeric(temp_df["总排名-每日近三月排名"])
return temp_df
# 同类排名百分比
if indicator == "同类排名百分比":
data_json = demjson.decode(
data_text[
data_text.find("Data_rateInSimilarPersent")
+ 26 : data_text.find("Data_fluctuationScale")
- 23
]
)
temp_df = pd.DataFrame(data_json)
temp_df.columns = ["x", "y"]
temp_df["x"] = pd.to_datetime(
temp_df["x"], unit="ms", utc=True
).dt.tz_convert("Asia/Shanghai")
temp_df["x"] = temp_df["x"].dt.date
temp_df.columns = [
"报告日期",
"同类型排名-每日近3月收益排名百分比",
]
temp_df = temp_df[
[
"报告日期",
"同类型排名-每日近3月收益排名百分比",
]
]
temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
temp_df["同类型排名-每日近3月收益排名百分比"] = pd.to_numeric(
temp_df["同类型排名-每日近3月收益排名百分比"]
)
return temp_df
# 分红送配详情
if indicator == "分红送配详情":
url = f"http://fundf10.eastmoney.com/fhsp_{fund}.html"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[1]
if temp_df.iloc[0, 1] == "暂无分红信息!":
return None
else:
return temp_df
# 拆分详情
if indicator == "拆分详情":
url = f"http://fundf10.eastmoney.com/fhsp_{fund}.html"
r = requests.get(url, headers=headers)
temp_df = pd.read_html(r.text)[2]
if temp_df.iloc[0, 1] == "暂无拆分信息!":
return None
else:
return temp_df
| 18,720 |
|
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_money_fund_daily_em
|
()
|
return temp_df
|
东方财富网-天天基金网-基金数据-货币型基金收益
http://fund.eastmoney.com/HBJJ_pjsyl.html
:return: 当前交易日的所有货币型基金收益数据
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-货币型基金收益
http://fund.eastmoney.com/HBJJ_pjsyl.html
:return: 当前交易日的所有货币型基金收益数据
:rtype: pandas.DataFrame
| 531 | 565 |
def fund_money_fund_daily_em() -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-货币型基金收益
http://fund.eastmoney.com/HBJJ_pjsyl.html
:return: 当前交易日的所有货币型基金收益数据
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/HBJJ_pjsyl.html"
r = requests.get(url, headers=headers)
r.encoding = "gb2312"
show_day = pd.read_html(r.text)[1].iloc[0, 5:11].tolist()
temp_df = pd.read_html(r.text)[1].iloc[1:, 2:]
temp_df_columns = temp_df.iloc[0, :].tolist()[1:]
temp_df = temp_df.iloc[1:, 1:]
temp_df.columns = temp_df_columns
temp_df["基金简称"] = temp_df["基金简称"].str.strip("基金吧档案")
temp_df.columns = [
"基金代码",
"基金简称",
f"{show_day[0]}-万份收益",
f"{show_day[1]}-7日年化%",
f"{show_day[2]}-单位净值",
f"{show_day[3]}-万份收益",
f"{show_day[4]}-7日年化%",
f"{show_day[5]}-单位净值",
"日涨幅",
"成立日期",
"基金经理",
"手续费",
"可购全部",
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L531-L565
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 20 |
[
7,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
34
] | 34.285714 | false | 6.413994 | 35 | 1 | 65.714286 | 4 |
def fund_money_fund_daily_em() -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/HBJJ_pjsyl.html"
r = requests.get(url, headers=headers)
r.encoding = "gb2312"
show_day = pd.read_html(r.text)[1].iloc[0, 5:11].tolist()
temp_df = pd.read_html(r.text)[1].iloc[1:, 2:]
temp_df_columns = temp_df.iloc[0, :].tolist()[1:]
temp_df = temp_df.iloc[1:, 1:]
temp_df.columns = temp_df_columns
temp_df["基金简称"] = temp_df["基金简称"].str.strip("基金吧档案")
temp_df.columns = [
"基金代码",
"基金简称",
f"{show_day[0]}-万份收益",
f"{show_day[1]}-7日年化%",
f"{show_day[2]}-单位净值",
f"{show_day[3]}-万份收益",
f"{show_day[4]}-7日年化%",
f"{show_day[5]}-单位净值",
"日涨幅",
"成立日期",
"基金经理",
"手续费",
"可购全部",
]
return temp_df
| 18,721 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_money_fund_info_em
|
(fund: str = "000009")
|
return temp_df
|
东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame
| 568 | 611 |
def fund_money_fund_info_em(fund: str = "000009") -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_004186.html
:param fund: 货币型基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18306461675574671744_1588245122574",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"每万份收益",
"7日年化收益率",
"_",
"_",
"_",
"_",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L568-L611
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 20.454545 |
[
9,
10,
14,
23,
24,
25,
26,
27,
42,
43
] | 22.727273 | false | 6.413994 | 44 | 1 | 77.272727 | 6 |
def fund_money_fund_info_em(fund: str = "000009") -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18306461675574671744_1588245122574",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"每万份收益",
"7日年化收益率",
"_",
"_",
"_",
"_",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]]
return temp_df
| 18,722 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_financial_fund_daily_em
|
()
|
return data_df
|
东方财富网站-天天基金网-基金数据-理财型基金收益
# 该接口暂无数据
http://fund.eastmoney.com/lcjj.html#1_1__0__ljjz,desc_1_os1
:return: 当前交易日的所有理财型基金收益
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-理财型基金收益
# 该接口暂无数据
http://fund.eastmoney.com/lcjj.html#1_1__0__ljjz,desc_1_os1
:return: 当前交易日的所有理财型基金收益
:rtype: pandas.DataFrame
| 614 | 684 |
def fund_financial_fund_daily_em() -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-理财型基金收益
# 该接口暂无数据
http://fund.eastmoney.com/lcjj.html#1_1__0__ljjz,desc_1_os1
:return: 当前交易日的所有理财型基金收益
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/FundNetValue/GetLCJJJZ"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": "http://fund.eastmoney.com/lcjj.html",
}
params = {
"letter": "",
"jjgsid": "0",
"searchtext": "",
"sort": "ljjz,desc",
"page": "1,100",
"AttentionCodes": "",
"cycle": "",
"OnlySale": "1",
"_": "1588248310234",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"]["List"])
if temp_df.empty:
return
show_day = data_json["Data"]["showday"]
data_df = temp_df[
[
"Id",
"actualsyi",
"cycle",
"fcode",
"kfr",
"mui",
"shortname",
"syi",
"zrmui",
"zrsyi",
]
]
data_df.columns = [
"序号",
"上一期年化收益率",
"封闭期",
"基金代码",
"申购状态",
f"{show_day[0]}-万份收益",
"基金简称",
f"{show_day[0]}-7日年华",
f"{show_day[1]}-万份收益",
f"{show_day[1]}-7日年华",
]
data_df = data_df[
[
"序号",
"基金代码",
"基金简称",
"上一期年化收益率",
f"{show_day[0]}-万份收益",
f"{show_day[0]}-7日年华",
f"{show_day[1]}-万份收益",
f"{show_day[1]}-7日年华",
"封闭期",
"申购状态",
]
]
return data_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L614-L684
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 11.267606 |
[
8,
9,
13,
24,
25,
26,
27,
28,
29,
30,
44,
56,
70
] | 18.309859 | false | 6.413994 | 71 | 2 | 81.690141 | 5 |
def fund_financial_fund_daily_em() -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/FundNetValue/GetLCJJJZ"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": "http://fund.eastmoney.com/lcjj.html",
}
params = {
"letter": "",
"jjgsid": "0",
"searchtext": "",
"sort": "ljjz,desc",
"page": "1,100",
"AttentionCodes": "",
"cycle": "",
"OnlySale": "1",
"_": "1588248310234",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"]["List"])
if temp_df.empty:
return
show_day = data_json["Data"]["showday"]
data_df = temp_df[
[
"Id",
"actualsyi",
"cycle",
"fcode",
"kfr",
"mui",
"shortname",
"syi",
"zrmui",
"zrsyi",
]
]
data_df.columns = [
"序号",
"上一期年化收益率",
"封闭期",
"基金代码",
"申购状态",
f"{show_day[0]}-万份收益",
"基金简称",
f"{show_day[0]}-7日年华",
f"{show_day[1]}-万份收益",
f"{show_day[1]}-7日年华",
]
data_df = data_df[
[
"序号",
"基金代码",
"基金简称",
"上一期年化收益率",
f"{show_day[0]}-万份收益",
f"{show_day[0]}-7日年华",
f"{show_day[1]}-万份收益",
f"{show_day[1]}-7日年华",
"封闭期",
"申购状态",
]
]
return data_df
| 18,723 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_financial_fund_info_em
|
(fund: str = "000134")
|
return temp_df
|
东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_000791.html
:param fund: 理财型基金代码, 可以通过 fund_financial_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_000791.html
:param fund: 理财型基金代码, 可以通过 fund_financial_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
:rtype: pandas.DataFrame
| 687 | 730 |
def fund_financial_fund_info_em(fund: str = "000134") -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
http://fundf10.eastmoney.com/jjjz_000791.html
:param fund: 理财型基金代码, 可以通过 fund_financial_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值数据
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18307915911837995662_1588249228826",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"每万份收益",
"7日年化收益率",
"_",
"_",
"_",
"_",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L687-L730
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 20.454545 |
[
9,
10,
14,
23,
24,
25,
26,
27,
42,
43
] | 22.727273 | false | 6.413994 | 44 | 1 | 77.272727 | 6 |
def fund_financial_fund_info_em(fund: str = "000134") -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18307915911837995662_1588249228826",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"每万份收益",
"7日年化收益率",
"_",
"_",
"_",
"_",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]]
return temp_df
| 18,724 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_graded_fund_daily_em
|
()
|
return data_df
|
东方财富网站-天天基金网-基金数据-分级基金净值
http://fund.eastmoney.com/fjjj.html#1_1__0__zdf,desc_1
:return: 当前交易日的所有分级基金净值
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-分级基金净值
http://fund.eastmoney.com/fjjj.html#1_1__0__zdf,desc_1
:return: 当前交易日的所有分级基金净值
:rtype: pandas.DataFrame
| 733 | 798 |
def fund_graded_fund_daily_em() -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-分级基金净值
http://fund.eastmoney.com/fjjj.html#1_1__0__zdf,desc_1
:return: 当前交易日的所有分级基金净值
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fjjj.html",
}
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
params = {
"t": "1",
"lx": "9",
"letter": "",
"gsid": "0",
"text": "",
"sort": "zdf,desc",
"page": "1,10000",
"dt": "1580914040623",
"atfc": "",
}
res = requests.get(url, params=params, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var db="))
temp_df = pd.DataFrame(data_json["datas"])
show_day = data_json["showday"]
temp_df.columns = [
"基金代码",
"基金简称",
"-",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}--单位净值",
f"{show_day[1]}--累计净值",
"日增长值",
"日增长率",
"市价",
"折价率",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"手续费",
]
data_df = temp_df[
[
"基金代码",
"基金简称",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}--单位净值",
f"{show_day[1]}--累计净值",
"日增长值",
"日增长率",
"市价",
"折价率",
"手续费",
]
]
return data_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L733-L798
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 10.606061 |
[
7,
11,
12,
23,
24,
25,
26,
27,
28,
50,
65
] | 16.666667 | false | 6.413994 | 66 | 1 | 83.333333 | 4 |
def fund_graded_fund_daily_em() -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": "http://fund.eastmoney.com/fjjj.html",
}
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
params = {
"t": "1",
"lx": "9",
"letter": "",
"gsid": "0",
"text": "",
"sort": "zdf,desc",
"page": "1,10000",
"dt": "1580914040623",
"atfc": "",
}
res = requests.get(url, params=params, headers=headers)
text_data = res.text
data_json = demjson.decode(text_data.strip("var db="))
temp_df = pd.DataFrame(data_json["datas"])
show_day = data_json["showday"]
temp_df.columns = [
"基金代码",
"基金简称",
"-",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}--单位净值",
f"{show_day[1]}--累计净值",
"日增长值",
"日增长率",
"市价",
"折价率",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"手续费",
]
data_df = temp_df[
[
"基金代码",
"基金简称",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[1]}--单位净值",
f"{show_day[1]}--累计净值",
"日增长值",
"日增长率",
"市价",
"折价率",
"手续费",
]
]
return data_df
| 18,725 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_graded_fund_info_em
|
(fund: str = "150232")
|
return temp_df
|
东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
http://fundf10.eastmoney.com/jjjz_150232.html
:param fund: 分级基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
http://fundf10.eastmoney.com/jjjz_150232.html
:param fund: 分级基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
:rtype: pandas.DataFrame
| 801 | 844 |
def fund_graded_fund_info_em(fund: str = "150232") -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
http://fundf10.eastmoney.com/jjjz_150232.html
:param fund: 分级基金代码, 可以通过 fund_money_fund_daily_em 来获取
:type fund: str
:return: 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18309549480723031107_1588250168187",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"单位净值",
"累计净值",
"_",
"_",
"_",
"日增长率",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L801-L844
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 20.454545 |
[
9,
10,
14,
23,
24,
25,
26,
27,
42,
43
] | 22.727273 | false | 6.413994 | 44 | 1 | 77.272727 | 6 |
def fund_graded_fund_info_em(fund: str = "150232") -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"callback": "jQuery18309549480723031107_1588250168187",
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "",
"endDate": "",
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
text_data = r.text
data_json = demjson.decode(text_data[text_data.find("{") : -1])
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"单位净值",
"累计净值",
"_",
"_",
"_",
"日增长率",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]]
return temp_df
| 18,726 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_etf_fund_daily_em
|
()
|
return temp_df
|
东方财富网-天天基金网-基金数据-场内交易基金
http://fund.eastmoney.com/cnjy_dwjz.html
:return: 当前交易日的所有场内交易基金数据
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-场内交易基金
http://fund.eastmoney.com/cnjy_dwjz.html
:return: 当前交易日的所有场内交易基金数据
:rtype: pandas.DataFrame
| 847 | 880 |
def fund_etf_fund_daily_em() -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-场内交易基金
http://fund.eastmoney.com/cnjy_dwjz.html
:return: 当前交易日的所有场内交易基金数据
:rtype: pandas.DataFrame
"""
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/cnjy_dwjz.html"
r = requests.get(url, headers=headers)
r.encoding = "gb2312"
show_day = pd.read_html(r.text)[1].iloc[0, 6:10].tolist()
temp_df = pd.read_html(r.text)[1].iloc[1:, 2:]
temp_df_columns = temp_df.iloc[0, :].tolist()[1:]
temp_df = temp_df.iloc[1:, 1:]
temp_df.columns = temp_df_columns
temp_df["基金简称"] = temp_df["基金简称"].str.strip("基金吧档案")
temp_df.reset_index(inplace=True, drop=True)
temp_df.columns = [
"基金代码",
"基金简称",
"类型",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[2]}-单位净值",
f"{show_day[2]}-累计净值",
"增长值",
"增长率",
"市价",
"折价率",
]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L847-L880
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 20.588235 |
[
7,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
33
] | 38.235294 | false | 6.413994 | 34 | 1 | 61.764706 | 4 |
def fund_etf_fund_daily_em() -> pd.DataFrame:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
url = "http://fund.eastmoney.com/cnjy_dwjz.html"
r = requests.get(url, headers=headers)
r.encoding = "gb2312"
show_day = pd.read_html(r.text)[1].iloc[0, 6:10].tolist()
temp_df = pd.read_html(r.text)[1].iloc[1:, 2:]
temp_df_columns = temp_df.iloc[0, :].tolist()[1:]
temp_df = temp_df.iloc[1:, 1:]
temp_df.columns = temp_df_columns
temp_df["基金简称"] = temp_df["基金简称"].str.strip("基金吧档案")
temp_df.reset_index(inplace=True, drop=True)
temp_df.columns = [
"基金代码",
"基金简称",
"类型",
f"{show_day[0]}-单位净值",
f"{show_day[0]}-累计净值",
f"{show_day[2]}-单位净值",
f"{show_day[2]}-累计净值",
"增长值",
"增长率",
"市价",
"折价率",
]
return temp_df
| 18,727 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_etf_fund_info_em
|
(
fund: str = "511280",
start_date: str = "20000101",
end_date: str = "20500101",
)
|
return temp_df
|
东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
http://fundf10.eastmoney.com/jjjz_511280.html
:param fund: 场内交易基金代码, 可以通过 fund_etf_fund_daily_em 来获取
:type fund: str
:param start_date: 开始统计时间
:type start_date: str
:param end_date: 结束统计时间
:type end_date: str
:return: 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
:rtype: pandas.DataFrame
|
东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
http://fundf10.eastmoney.com/jjjz_511280.html
:param fund: 场内交易基金代码, 可以通过 fund_etf_fund_daily_em 来获取
:type fund: str
:param start_date: 开始统计时间
:type start_date: str
:param end_date: 结束统计时间
:type end_date: str
:return: 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
:rtype: pandas.DataFrame
| 883 | 939 |
def fund_etf_fund_info_em(
fund: str = "511280",
start_date: str = "20000101",
end_date: str = "20500101",
) -> pd.DataFrame:
"""
东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
http://fundf10.eastmoney.com/jjjz_511280.html
:param fund: 场内交易基金代码, 可以通过 fund_etf_fund_daily_em 来获取
:type fund: str
:param start_date: 开始统计时间
:type start_date: str
:param end_date: 结束统计时间
:type end_date: str
:return: 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
:rtype: pandas.DataFrame
"""
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "-".join(
[start_date[:4], start_date[4:6], start_date[6:]]
),
"endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]),
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"单位净值",
"累计净值",
"_",
"_",
"_",
"日增长率",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
temp_df.sort_values(['净值日期'], inplace=True, ignore_index=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L883-L939
| 25 |
[
0
] | 1.754386 |
[
17,
18,
22,
32,
33,
34,
35,
50,
51,
52,
53,
54,
55,
56
] | 24.561404 | false | 6.413994 | 57 | 1 | 75.438596 | 10 |
def fund_etf_fund_info_em(
fund: str = "511280",
start_date: str = "20000101",
end_date: str = "20500101",
) -> pd.DataFrame:
url = "http://api.fund.eastmoney.com/f10/lsjz"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Referer": f"http://fundf10.eastmoney.com/jjjz_{fund}.html",
}
params = {
"fundCode": fund,
"pageIndex": "1",
"pageSize": "10000",
"startDate": "-".join(
[start_date[:4], start_date[4:6], start_date[6:]]
),
"endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]),
"_": round(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
temp_df.columns = [
"净值日期",
"单位净值",
"累计净值",
"_",
"_",
"_",
"日增长率",
"申购状态",
"赎回状态",
"_",
"_",
"_",
"_",
]
temp_df = temp_df[["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]]
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"])
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
temp_df.sort_values(['净值日期'], inplace=True, ignore_index=True)
return temp_df
| 18,728 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_value_estimation_em
|
(symbol: str = "全部") ->
|
return temp_df
|
东方财富网-数据中心-净值估算
http://fund.eastmoney.com/fundguzhi.html
:param symbol: choice of {'全部', '股票型', '混合型', '债券型', '指数型', 'QDII', 'ETF联接', 'LOF', '场内交易基金'}
:type symbol: str
:return: 近期净值估算数据
:rtype: pandas.DataFrame
|
东方财富网-数据中心-净值估算
http://fund.eastmoney.com/fundguzhi.html
:param symbol: choice of {'全部', '股票型', '混合型', '债券型', '指数型', 'QDII', 'ETF联接', 'LOF', '场内交易基金'}
:type symbol: str
:return: 近期净值估算数据
:rtype: pandas.DataFrame
| 942 | 1,028 |
def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame:
"""
东方财富网-数据中心-净值估算
http://fund.eastmoney.com/fundguzhi.html
:param symbol: choice of {'全部', '股票型', '混合型', '债券型', '指数型', 'QDII', 'ETF联接', 'LOF', '场内交易基金'}
:type symbol: str
:return: 近期净值估算数据
:rtype: pandas.DataFrame
"""
symbol_map = {
"全部": 1,
"股票型": 2,
"混合型": 3,
"债券型": 4,
"指数型": 5,
"QDII": 6,
"ETF联接": 7,
"LOF": 8,
"场内交易基金": 9,
}
url = "http://api.fund.eastmoney.com/FundGuZhi/GetFundGZList"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/",
}
params = {
"type": symbol_map[symbol],
"sort": "3",
"orderType": "desc",
"canbuy": "0",
"pageIndex": "1",
"pageSize": "20000",
"_": int(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(json_data["Data"]["list"])
value_day = json_data["Data"]["gzrq"]
cal_day = json_data["Data"]["gxrq"]
temp_df.columns = [
"基金代码",
"-",
"-",
"-",
"-",
"-",
"基金类型",
"-",
"-",
"-",
"-",
"估算日期",
"-",
"-",
"-",
"-",
"_",
"-",
"-",
"估算偏差",
f"{cal_day}-估算数据-估算值",
f"{cal_day}-估算数据-估算增长率",
f"{cal_day}-公布数据-日增长率",
f"{value_day}-单位净值",
f"{cal_day}-公布数据-单位净值",
"-",
"基金名称",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"基金代码",
"基金名称",
f"{cal_day}-估算数据-估算值",
f"{cal_day}-估算数据-估算增长率",
f"{cal_day}-公布数据-单位净值",
f"{cal_day}-公布数据-日增长率",
"估算偏差",
f"{value_day}-单位净值",
]
]
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(columns={"index": "序号"}, inplace=True)
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L942-L1028
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8
] | 10.344828 |
[
9,
20,
21,
25,
34,
35,
36,
37,
38,
39,
71,
83,
84,
85,
86
] | 17.241379 | false | 6.413994 | 87 | 1 | 82.758621 | 6 |
def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame:
symbol_map = {
"全部": 1,
"股票型": 2,
"混合型": 3,
"债券型": 4,
"指数型": 5,
"QDII": 6,
"ETF联接": 7,
"LOF": 8,
"场内交易基金": 9,
}
url = "http://api.fund.eastmoney.com/FundGuZhi/GetFundGZList"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Referer": "http://fund.eastmoney.com/",
}
params = {
"type": symbol_map[symbol],
"sort": "3",
"orderType": "desc",
"canbuy": "0",
"pageIndex": "1",
"pageSize": "20000",
"_": int(time.time() * 1000),
}
r = requests.get(url, params=params, headers=headers)
json_data = r.json()
temp_df = pd.DataFrame(json_data["Data"]["list"])
value_day = json_data["Data"]["gzrq"]
cal_day = json_data["Data"]["gxrq"]
temp_df.columns = [
"基金代码",
"-",
"-",
"-",
"-",
"-",
"基金类型",
"-",
"-",
"-",
"-",
"估算日期",
"-",
"-",
"-",
"-",
"_",
"-",
"-",
"估算偏差",
f"{cal_day}-估算数据-估算值",
f"{cal_day}-估算数据-估算增长率",
f"{cal_day}-公布数据-日增长率",
f"{value_day}-单位净值",
f"{cal_day}-公布数据-单位净值",
"-",
"基金名称",
"-",
"-",
"-",
]
temp_df = temp_df[
[
"基金代码",
"基金名称",
f"{cal_day}-估算数据-估算值",
f"{cal_day}-估算数据-估算增长率",
f"{cal_day}-公布数据-单位净值",
f"{cal_day}-公布数据-日增长率",
"估算偏差",
f"{value_day}-单位净值",
]
]
temp_df.reset_index(inplace=True)
temp_df["index"] = range(1, len(temp_df) + 1)
temp_df.rename(columns={"index": "序号"}, inplace=True)
return temp_df
| 18,729 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/fund/fund_em.py
|
fund_hk_fund_hist_em
|
(
code: str = "1002200683", symbol: str = "历史净值明细"
)
|
return temp_one_df
|
东方财富网-天天基金网-基金数据-香港基金-历史净值明细(分红送配详情)
http://overseas.1234567.com.cn/f10/FundJz/968092#FHPS
:param code: 通过 fund_em_hk_rank 获取
:type code: str
:param symbol: choice of {"历史净值明细", "分红送配详情"}
:type symbol: str
:return: 香港基金-历史净值明细(分红送配详情)
:rtype: pandas.DataFrame
|
东方财富网-天天基金网-基金数据-香港基金-历史净值明细(分红送配详情)
http://overseas.1234567.com.cn/f10/FundJz/968092#FHPS
:param code: 通过 fund_em_hk_rank 获取
:type code: str
:param symbol: choice of {"历史净值明细", "分红送配详情"}
:type symbol: str
:return: 香港基金-历史净值明细(分红送配详情)
:rtype: pandas.DataFrame
| 1,031 | 1,124 |
def fund_hk_fund_hist_em(
code: str = "1002200683", symbol: str = "历史净值明细"
) -> pd.DataFrame:
"""
东方财富网-天天基金网-基金数据-香港基金-历史净值明细(分红送配详情)
http://overseas.1234567.com.cn/f10/FundJz/968092#FHPS
:param code: 通过 fund_em_hk_rank 获取
:type code: str
:param symbol: choice of {"历史净值明细", "分红送配详情"}
:type symbol: str
:return: 香港基金-历史净值明细(分红送配详情)
:rtype: pandas.DataFrame
"""
url = "http://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
if symbol == "历史净值明细":
params = {
"api": "HKFDApi",
"m": "MethodJZ",
"hkfcode": f"{code}",
"action": "2",
"pageindex": "0",
"pagesize": "1000",
"date1": "",
"date2": "",
"_": "1611131371333",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_one_df = pd.DataFrame(data_json["Data"])
temp_one_df.columns = [
"_",
"_",
"_",
"净值日期",
"单位净值",
"_",
"日增长值",
"日增长率",
"_",
"单位",
]
temp_one_df = temp_one_df[
[
"净值日期",
"单位净值",
"日增长值",
"日增长率",
"单位",
]
]
else:
params = {
"api": "HKFDApi",
"m": "MethodJZ",
"hkfcode": f"{code}",
"action": "3",
"pageindex": "0",
"pagesize": "1000",
"date1": "",
"date2": "",
"_": "1611131371333",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_one_df = pd.DataFrame(data_json["Data"])
temp_one_df.columns = [
"_",
"_",
"_",
"_",
"_",
"年份",
"分红金额",
"除息日",
"权益登记日",
"分红发放日",
"_",
"单位",
"_",
]
temp_one_df = temp_one_df[
[
"年份",
"权益登记日",
"除息日",
"分红发放日",
"分红金额",
"单位",
]
]
return temp_one_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/fund/fund_em.py#L1031-L1124
| 25 |
[
0
] | 1.06383 |
[
13,
14,
17,
18,
29,
30,
31,
32,
44,
54,
65,
66,
67,
68,
83,
93
] | 17.021277 | false | 6.413994 | 94 | 2 | 82.978723 | 8 |
def fund_hk_fund_hist_em(
code: str = "1002200683", symbol: str = "历史净值明细"
) -> pd.DataFrame:
url = "http://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}
if symbol == "历史净值明细":
params = {
"api": "HKFDApi",
"m": "MethodJZ",
"hkfcode": f"{code}",
"action": "2",
"pageindex": "0",
"pagesize": "1000",
"date1": "",
"date2": "",
"_": "1611131371333",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_one_df = pd.DataFrame(data_json["Data"])
temp_one_df.columns = [
"_",
"_",
"_",
"净值日期",
"单位净值",
"_",
"日增长值",
"日增长率",
"_",
"单位",
]
temp_one_df = temp_one_df[
[
"净值日期",
"单位净值",
"日增长值",
"日增长率",
"单位",
]
]
else:
params = {
"api": "HKFDApi",
"m": "MethodJZ",
"hkfcode": f"{code}",
"action": "3",
"pageindex": "0",
"pagesize": "1000",
"date1": "",
"date2": "",
"_": "1611131371333",
}
r = requests.get(url, params=params, headers=headers)
data_json = r.json()
temp_one_df = pd.DataFrame(data_json["Data"])
temp_one_df.columns = [
"_",
"_",
"_",
"_",
"_",
"年份",
"分红金额",
"除息日",
"权益登记日",
"分红发放日",
"_",
"单位",
"_",
]
temp_one_df = temp_one_df[
[
"年份",
"权益登记日",
"除息日",
"分红发放日",
"分红金额",
"单位",
]
]
return temp_one_df
| 18,730 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/artist_yien.py
|
_get_js_path
|
(name: str = "", module_file: str = "")
|
return module_json_path
|
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
|
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
| 19 | 31 |
def _get_js_path(name: str = "", module_file: str = "") -> str:
"""
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
"""
module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file)))
module_json_path = os.path.join(module_folder, "movie", name)
return module_json_path
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/artist_yien.py#L19-L31
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 76.923077 |
[
10,
11,
12
] | 23.076923 | false | 26 | 13 | 1 | 76.923077 | 7 |
def _get_js_path(name: str = "", module_file: str = "") -> str:
module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file)))
module_json_path = os.path.join(module_folder, "movie", name)
return module_json_path
| 18,731 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/artist_yien.py
|
_get_file_content
|
(file_name: str = "jm.js")
|
return file_data
|
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
|
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
| 34 | 46 |
def _get_file_content(file_name: str = "jm.js"):
"""
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
"""
setting_file_name = file_name
setting_file_path = _get_js_path(setting_file_name, __file__)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/artist_yien.py#L34-L46
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 61.538462 |
[
8,
9,
10,
11,
12
] | 38.461538 | false | 26 | 13 | 2 | 61.538462 | 5 |
def _get_file_content(file_name: str = "jm.js"):
setting_file_name = file_name
setting_file_path = _get_js_path(setting_file_name, __file__)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 18,732 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/artist_yien.py
|
decrypt
|
(origin_data: str = "")
|
return data
|
解密艺恩的加密数据
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
|
解密艺恩的加密数据
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
| 49 | 61 |
def decrypt(origin_data: str = "") -> str:
"""
解密艺恩的加密数据
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
"""
file_data = _get_file_content(file_name="jm.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
data = ctx.call("webInstace.shell", origin_data)
return data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/artist_yien.py#L49-L61
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 61.538462 |
[
8,
9,
10,
11,
12
] | 38.461538 | false | 26 | 13 | 1 | 61.538462 | 5 |
def decrypt(origin_data: str = "") -> str:
file_data = _get_file_content(file_name="jm.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
data = ctx.call("webInstace.shell", origin_data)
return data
| 18,733 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/artist_yien.py
|
business_value_artist
|
()
|
return temp_df
|
艺恩-艺人-艺人商业价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人商业价值
:rtype: pandas.DataFrame
|
艺恩-艺人-艺人商业价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人商业价值
:rtype: pandas.DataFrame
| 64 | 86 |
def business_value_artist() -> pd.DataFrame:
"""
艺恩-艺人-艺人商业价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人商业价值
:rtype: pandas.DataFrame
"""
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"Order": "BusinessValueIndex_L1",
"OrderType": "DESC",
"PageIndex": '1',
"PageSize": '100',
"MethodName": "Data_GetList_Star"
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table"])
temp_df.columns = ["排名", "-", "艺人", "商业价值", "-", "专业热度", "关注热度", "预测热度", "美誉度", "-"]
temp_df = temp_df[["排名", "艺人", "商业价值", "专业热度", "关注热度", "预测热度", "美誉度"]]
temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/artist_yien.py#L64-L86
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 30.434783 |
[
7,
8,
15,
16,
17,
18,
19,
20,
21,
22
] | 43.478261 | false | 26 | 23 | 1 | 56.521739 | 4 |
def business_value_artist() -> pd.DataFrame:
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"Order": "BusinessValueIndex_L1",
"OrderType": "DESC",
"PageIndex": '1',
"PageSize": '100',
"MethodName": "Data_GetList_Star"
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table"])
temp_df.columns = ["排名", "-", "艺人", "商业价值", "-", "专业热度", "关注热度", "预测热度", "美誉度", "-"]
temp_df = temp_df[["排名", "艺人", "商业价值", "专业热度", "关注热度", "预测热度", "美誉度"]]
temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
return temp_df
| 18,734 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/artist_yien.py
|
online_value_artist
|
()
|
return temp_df
|
艺恩-艺人-艺人流量价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人流量价值
:rtype: pandas.DataFrame
|
艺恩-艺人-艺人流量价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人流量价值
:rtype: pandas.DataFrame
| 89 | 111 |
def online_value_artist() -> pd.DataFrame:
"""
艺恩-艺人-艺人流量价值
https://www.endata.com.cn/Marketing/Artist/business.html
:return: 艺人流量价值
:rtype: pandas.DataFrame
"""
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"Order": "FlowValueIndex_L1",
"OrderType": "DESC",
"PageIndex": 1,
"PageSize": 100,
"MethodName": "Data_GetList_Star"
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table"])
temp_df.columns = ["排名", "-", "艺人", "-", "流量价值", "专业热度", "关注热度", "预测热度", "-", "带货力"]
temp_df = temp_df[["排名", "艺人", "流量价值", "专业热度", "关注热度", "预测热度", "带货力"]]
temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/artist_yien.py#L89-L111
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 30.434783 |
[
7,
8,
15,
16,
17,
18,
19,
20,
21,
22
] | 43.478261 | false | 26 | 23 | 1 | 56.521739 | 4 |
def online_value_artist() -> pd.DataFrame:
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"Order": "FlowValueIndex_L1",
"OrderType": "DESC",
"PageIndex": 1,
"PageSize": 100,
"MethodName": "Data_GetList_Star"
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table"])
temp_df.columns = ["排名", "-", "艺人", "-", "流量价值", "专业热度", "关注热度", "预测热度", "-", "带货力"]
temp_df = temp_df[["排名", "艺人", "流量价值", "专业热度", "关注热度", "预测热度", "带货力"]]
temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
return temp_df
| 18,735 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/movie_yien.py
|
_get_js_path
|
(name: str = "", module_file: str = "")
|
return module_json_path
|
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
|
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
| 17 | 29 |
def _get_js_path(name: str = "", module_file: str = "") -> str:
"""
get JS file path
:param name: file name
:type name: str
:param module_file: filename
:type module_file: str
:return: 路径
:rtype: str
"""
module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file)))
module_json_path = os.path.join(module_folder, "movie", name)
return module_json_path
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/movie_yien.py#L17-L29
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
] | 76.923077 |
[
10,
11,
12
] | 23.076923 | false | 15.037594 | 13 | 1 | 76.923077 | 7 |
def _get_js_path(name: str = "", module_file: str = "") -> str:
module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file)))
module_json_path = os.path.join(module_folder, "movie", name)
return module_json_path
| 18,736 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/movie_yien.py
|
_get_file_content
|
(file_name: str = "jm.js")
|
return file_data
|
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
|
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
| 32 | 44 |
def _get_file_content(file_name: str = "jm.js"):
"""
read the file content
:param file_name: filename
:type file_name: str
:return: file content
:rtype: str
"""
setting_file_name = file_name
setting_file_path = _get_js_path(setting_file_name, __file__)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/movie_yien.py#L32-L44
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 61.538462 |
[
8,
9,
10,
11,
12
] | 38.461538 | false | 15.037594 | 13 | 2 | 61.538462 | 5 |
def _get_file_content(file_name: str = "jm.js"):
setting_file_name = file_name
setting_file_path = _get_js_path(setting_file_name, __file__)
with open(setting_file_path) as f:
file_data = f.read()
return file_data
| 18,737 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/movie_yien.py
|
get_current_week
|
(date: str = "20201019")
|
return monday
|
当前周的周一
:param date: 具体的日期
:type date: str
:return: 当前周的周一
:rtype: datetime.date
|
当前周的周一
:param date: 具体的日期
:type date: str
:return: 当前周的周一
:rtype: datetime.date
| 47 | 59 |
def get_current_week(date: str = "20201019") -> int:
"""
当前周的周一
:param date: 具体的日期
:type date: str
:return: 当前周的周一
:rtype: datetime.date
"""
monday = datetime.datetime.strptime(date, "%Y%m%d").date()
one_day = datetime.timedelta(days=1)
while monday.weekday() != 0:
monday -= one_day
return monday
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/movie_yien.py#L47-L59
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 61.538462 |
[
8,
9,
10,
11,
12
] | 38.461538 | false | 15.037594 | 13 | 2 | 61.538462 | 5 |
def get_current_week(date: str = "20201019") -> int:
monday = datetime.datetime.strptime(date, "%Y%m%d").date()
one_day = datetime.timedelta(days=1)
while monday.weekday() != 0:
monday -= one_day
return monday
| 18,738 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/movie_yien.py
|
decrypt
|
(origin_data: str = "")
|
return data
|
解密
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
|
解密
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
| 62 | 74 |
def decrypt(origin_data: str = "") -> str:
"""
解密
:param origin_data: 解密前的字符串
:type origin_data: str
:return: 解密后的字符串
:rtype: str
"""
file_data = _get_file_content(file_name="jm.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
data = ctx.call("webInstace.shell", origin_data)
return data
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/movie_yien.py#L62-L74
| 25 |
[
0,
1,
2,
3,
4,
5,
6,
7
] | 61.538462 |
[
8,
9,
10,
11,
12
] | 38.461538 | false | 15.037594 | 13 | 1 | 61.538462 | 5 |
def decrypt(origin_data: str = "") -> str:
file_data = _get_file_content(file_name="jm.js")
ctx = py_mini_racer.MiniRacer()
ctx.eval(file_data)
data = ctx.call("webInstace.shell", origin_data)
return data
| 18,739 |
akfamily/akshare
|
087025d8d6f799b30ca114013e82c1ad22dc9294
|
akshare/movie/movie_yien.py
|
movie_boxoffice_realtime
|
()
|
return temp_df
|
电影票房-实时票房
https://www.endata.com.cn/BoxOffice/BO/RealTime/reTimeBO.html
:return: 实时票房数据
:rtype: pandas.DataFrame
|
电影票房-实时票房
https://www.endata.com.cn/BoxOffice/BO/RealTime/reTimeBO.html
:return: 实时票房数据
:rtype: pandas.DataFrame
| 77 | 98 |
def movie_boxoffice_realtime() -> pd.DataFrame:
"""
电影票房-实时票房
https://www.endata.com.cn/BoxOffice/BO/RealTime/reTimeBO.html
:return: 实时票房数据
:rtype: pandas.DataFrame
"""
today = datetime.datetime.today().date().strftime("%Y%m%d")
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"showDate": "",
"tdate": f"{today[:4]}-{today[4:6]}-{today[6:]}",
"MethodName": "BoxOffice_GetHourBoxOffice",
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table1"])
temp_df = temp_df.iloc[:, :7]
temp_df.columns = ["排序", "_", "影片名称", "实时票房", "累计票房", "上映天数", "票房占比"]
temp_df = temp_df[["排序", "影片名称", "实时票房", "票房占比", "上映天数", "累计票房"]]
return temp_df
|
https://github.com/akfamily/akshare/blob/087025d8d6f799b30ca114013e82c1ad22dc9294/project25/akshare/movie/movie_yien.py#L77-L98
| 25 |
[
0,
1,
2,
3,
4,
5,
6
] | 31.818182 |
[
7,
8,
9,
14,
15,
16,
17,
18,
19,
20,
21
] | 50 | false | 15.037594 | 22 | 1 | 50 | 4 |
def movie_boxoffice_realtime() -> pd.DataFrame:
today = datetime.datetime.today().date().strftime("%Y%m%d")
url = "https://www.endata.com.cn/API/GetData.ashx"
payload = {
"showDate": "",
"tdate": f"{today[:4]}-{today[4:6]}-{today[6:]}",
"MethodName": "BoxOffice_GetHourBoxOffice",
}
r = requests.post(url, data=payload)
r.encoding = "utf8"
data_json = json.loads(decrypt(r.text))
temp_df = pd.DataFrame(data_json["Data"]["Table1"])
temp_df = temp_df.iloc[:, :7]
temp_df.columns = ["排序", "_", "影片名称", "实时票房", "累计票房", "上映天数", "票房占比"]
temp_df = temp_df[["排序", "影片名称", "实时票房", "票房占比", "上映天数", "累计票房"]]
return temp_df
| 18,740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.