akshare 1.16.64__py3-none-any.whl → 1.16.65__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- akshare/__init__.py +2 -1
- akshare/air/cons.py +1 -0
- akshare/air/crypto.js +1 -1
- akshare/air/outcrypto.js +1 -1
- akshare/article/cons.py +1 -0
- akshare/article/epu_index.py +4 -3
- akshare/article/ff_factor.py +19 -8
- akshare/article/fred_md.py +4 -1
- akshare/article/risk_rv.py +3 -8
- akshare/bond/bond_cb_sina.py +1 -0
- akshare/bond/bond_cbond.py +19 -14
- akshare/bond/bond_em.py +34 -15
- akshare/bond/bond_summary.py +38 -37
- akshare/bond/bond_zh_cov.py +0 -6
- akshare/bond/cons.py +14 -11
- akshare/crypto/__init__.py +1 -1
- akshare/crypto/crypto_bitcoin_cme.py +7 -7
- akshare/crypto/crypto_hold.py +4 -1
- akshare/currency/currency.py +1 -0
- akshare/currency/currency_china_bank_sina.py +6 -3
- akshare/data/__init__.py +1 -1
- akshare/data/cninfo.js +1 -1
- akshare/economic/cons.py +10 -3
- akshare/economic/macro_australia.py +0 -7
- akshare/economic/macro_canada.py +92 -81
- akshare/economic/macro_china.py +0 -34
- akshare/economic/macro_china_hk.py +0 -1
- akshare/economic/macro_euro.py +103 -56
- akshare/economic/macro_germany.py +1 -1
- akshare/economic/macro_japan.py +0 -1
- akshare/economic/macro_other.py +1 -6
- akshare/economic/macro_swiss.py +2 -3
- akshare/economic/macro_uk.py +1 -1
- akshare/economic/macro_usa.py +0 -2
- akshare/energy/energy_carbon.py +0 -1
- akshare/energy/energy_oil_em.py +1 -2
- akshare/event/cons.py +1 -0
- akshare/forex/forex_em.py +0 -1
- akshare/fortune/fortune_bloomberg.py +6 -3
- akshare/fortune/fortune_forbes_500.py +3 -6
- akshare/fortune/fortune_hurun.py +2 -1
- akshare/fortune/fortune_xincaifu_500.py +17 -14
- akshare/fund/fund_announcement.py +1 -0
- akshare/fund/fund_aum_em.py +47 -35
- akshare/fund/fund_em.py +0 -7
- akshare/fund/fund_etf_em.py +0 -5
- akshare/fund/fund_fhsp_em.py +27 -20
- akshare/fund/fund_init_em.py +8 -5
- akshare/fund/fund_lof_em.py +0 -5
- akshare/fund/fund_manager.py +18 -7
- akshare/fund/fund_portfolio_em.py +0 -1
- akshare/fund/fund_position_lg.py +19 -8
- akshare/fund/fund_rank_em.py +0 -3
- akshare/fund/fund_rating.py +28 -9
- akshare/fund/fund_scale_em.py +24 -13
- akshare/futures/futures_comex_em.py +1 -0
- akshare/futures/futures_contract_detail.py +11 -8
- akshare/futures/futures_inventory_em.py +0 -2
- akshare/futures/futures_rule.py +5 -1
- akshare/futures/futures_settlement_price_sgx.py +21 -6
- akshare/futures/futures_stock_js.py +0 -1
- akshare/futures/receipt.py +279 -153
- akshare/futures/requests_fun.py +16 -3
- akshare/futures_derivative/cons.py +100 -103
- akshare/futures_derivative/futures_contract_info_cffex.py +53 -39
- akshare/futures_derivative/futures_contract_info_dce.py +16 -9
- akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
- akshare/futures_derivative/futures_index_sina.py +25 -13
- akshare/fx/cons.py +12 -7
- akshare/fx/fx_quote.py +1 -0
- akshare/fx/fx_quote_baidu.py +2 -1
- akshare/hf/__init__.py +1 -1
- akshare/hf/hf_sp500.py +8 -7
- akshare/index/index_eri.py +1 -0
- akshare/index/index_global_em.py +0 -1
- akshare/index/index_kq_fz.py +17 -14
- akshare/index/index_kq_ss.py +1 -0
- akshare/index/index_stock_hk.py +0 -1
- akshare/index/index_stock_zh.py +0 -3
- akshare/index/index_sugar.py +18 -4
- akshare/index/index_zh_em.py +0 -15
- akshare/interest_rate/interbank_rate_em.py +0 -1
- akshare/movie/jm.js +0 -1
- akshare/news/__init__.py +1 -1
- akshare/news/news_stock.py +0 -1
- akshare/option/option_commodity_sina.py +22 -26
- akshare/option/option_daily_stats_sse_szse.py +0 -1
- akshare/option/option_em.py +0 -1
- akshare/option/option_lhb_em.py +0 -1
- akshare/option/option_risk_indicator_sse.py +0 -1
- akshare/other/__init__.py +1 -1
- akshare/pro/__init__.py +0 -1
- akshare/pro/client.py +6 -4
- akshare/pro/cons.py +3 -2
- akshare/pro/data_pro.py +6 -5
- akshare/qhkc/qhkc_api.py +63 -21
- akshare/qhkc_web/qhkc_fund.py +1 -0
- akshare/qhkc_web/qhkc_index.py +1 -0
- akshare/qhkc_web/qhkc_tool.py +55 -54
- akshare/rate/__init__.py +1 -1
- akshare/rate/repo_rate.py +36 -32
- akshare/reits/__init__.py +1 -1
- akshare/reits/reits_basic.py +44 -2
- akshare/sport/__init__.py +1 -1
- akshare/sport/sport_olympic.py +1 -0
- akshare/spot/__init__.py +1 -1
- akshare/stock/cons.py +19 -12
- akshare/stock/stock_board_concept_em.py +0 -6
- akshare/stock/stock_board_industry_em.py +0 -6
- akshare/stock/stock_dzjy_em.py +1 -1
- akshare/stock/stock_fund_em.py +0 -2
- akshare/stock/stock_fund_hold.py +1 -2
- akshare/stock/stock_gsrl_em.py +1 -0
- akshare/stock/stock_hk_famous.py +0 -1
- akshare/stock/stock_hk_fhpx_ths.py +2 -1
- akshare/stock/stock_hk_hot_rank_em.py +1 -0
- akshare/stock/stock_hold_control_em.py +0 -2
- akshare/stock/stock_hot_up_em.py +4 -1
- akshare/stock/stock_hsgt_em.py +0 -2
- akshare/stock/stock_industry.py +1 -0
- akshare/stock/stock_info.py +0 -2
- akshare/stock/stock_info_em.py +0 -1
- akshare/stock/stock_repurchase_em.py +7 -2
- akshare/stock/stock_share_hold.py +0 -1
- akshare/stock/stock_stop.py +0 -1
- akshare/stock/stock_summary.py +0 -2
- akshare/stock/stock_us_famous.py +0 -1
- akshare/stock/stock_us_js.py +3 -2
- akshare/stock/stock_us_pink.py +0 -1
- akshare/stock/stock_weibo_nlp.py +18 -20
- akshare/stock/stock_zh_a_special.py +0 -3
- akshare/stock/stock_zh_a_tick_tx.py +11 -3
- akshare/stock_a/stock_board_concept_name_em.py +0 -1
- akshare/stock_a/stock_zh_a_spot.py +0 -1
- akshare/stock_feature/cons.py +1 -0
- akshare/stock_feature/stock_account_em.py +0 -1
- akshare/stock_feature/stock_all_pb.py +2 -1
- akshare/stock_feature/stock_analyst_em.py +0 -3
- akshare/stock_feature/stock_buffett_index_lg.py +7 -6
- akshare/stock_feature/stock_classify_sina.py +3 -6
- akshare/stock_feature/stock_comment_em.py +0 -2
- akshare/stock_feature/stock_congestion_lg.py +2 -1
- akshare/stock_feature/stock_dxsyl_em.py +116 -71
- akshare/stock_feature/stock_gdzjc_em.py +16 -5
- akshare/stock_feature/stock_gxl_lg.py +3 -2
- akshare/stock_feature/stock_hist_em.py +0 -20
- akshare/stock_feature/stock_hist_tx.py +10 -8
- akshare/stock_feature/stock_hot_xq.py +4 -6
- akshare/stock_feature/stock_hsgt_em.py +0 -2
- akshare/stock_feature/stock_hsgt_exchange_rate.py +0 -2
- akshare/stock_feature/stock_hsgt_min_em.py +13 -16
- akshare/stock_feature/stock_inner_trade_xq.py +0 -1
- akshare/stock_feature/stock_lhb_em.py +0 -1
- akshare/stock_feature/stock_margin_em.py +0 -1
- akshare/stock_feature/stock_margin_sse.py +0 -2
- akshare/stock_feature/stock_pankou_em.py +0 -2
- akshare/stock_feature/stock_qsjy_em.py +13 -4
- akshare/stock_feature/stock_research_report_em.py +0 -1
- akshare/stock_feature/stock_yjyg_cninfo.py +4 -1
- akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
- akshare/stock_feature/stock_ztb_em.py +0 -6
- akshare/stock_fundamental/__init__.py +1 -1
- akshare/stock_fundamental/stock_hold.py +26 -17
- akshare/stock_fundamental/stock_ipo_declare.py +1 -0
- akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
- akshare/stock_fundamental/stock_kcb_sse.py +26 -25
- akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
- akshare/stock_fundamental/stock_recommend.py +20 -4
- akshare/utils/demjson.py +2005 -1334
- akshare/utils/token_process.py +6 -5
- {akshare-1.16.64.dist-info → akshare-1.16.65.dist-info}/METADATA +3 -8
- {akshare-1.16.64.dist-info → akshare-1.16.65.dist-info}/RECORD +175 -175
- {akshare-1.16.64.dist-info → akshare-1.16.65.dist-info}/WHEEL +0 -0
- {akshare-1.16.64.dist-info → akshare-1.16.65.dist-info}/licenses/LICENSE +0 -0
- {akshare-1.16.64.dist-info → akshare-1.16.65.dist-info}/top_level.txt +0 -0
akshare/fund/fund_init_em.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/11/7 18:30
|
|
5
5
|
Desc: 基金数据-新发基金-新成立基金
|
6
6
|
https://fund.eastmoney.com/data/xinfound.html
|
7
7
|
"""
|
8
|
+
|
8
9
|
import pandas as pd
|
9
10
|
import requests
|
10
11
|
|
@@ -67,11 +68,13 @@ def fund_new_found_em() -> pd.DataFrame:
|
|
67
68
|
"优惠费率",
|
68
69
|
]
|
69
70
|
]
|
70
|
-
temp_df[
|
71
|
-
temp_df[
|
72
|
-
temp_df[
|
73
|
-
|
74
|
-
|
71
|
+
temp_df["募集份额"] = pd.to_numeric(temp_df["募集份额"], errors="coerce")
|
72
|
+
temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"], errors="coerce").dt.date
|
73
|
+
temp_df["成立来涨幅"] = pd.to_numeric(
|
74
|
+
temp_df["成立来涨幅"].str.replace(",", ""), errors="coerce"
|
75
|
+
)
|
76
|
+
temp_df["优惠费率"] = temp_df["优惠费率"].str.strip("%")
|
77
|
+
temp_df["优惠费率"] = pd.to_numeric(temp_df["优惠费率"], errors="coerce")
|
75
78
|
return temp_df
|
76
79
|
|
77
80
|
|
akshare/fund/fund_lof_em.py
CHANGED
@@ -36,7 +36,6 @@ def _fund_lof_code_id_map_em() -> dict:
|
|
36
36
|
"fid": "f12",
|
37
37
|
"fs": "b:MK0404,b:MK0405,b:MK0406,b:MK0407",
|
38
38
|
"fields": "f3,f12,f13",
|
39
|
-
"_": "1672806290972",
|
40
39
|
}
|
41
40
|
temp_df = fetch_paginated_data(url, params)
|
42
41
|
temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
|
@@ -64,7 +63,6 @@ def fund_lof_spot_em() -> pd.DataFrame:
|
|
64
63
|
"fs": "b:MK0404,b:MK0405,b:MK0406,b:MK0407",
|
65
64
|
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,"
|
66
65
|
"f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
|
67
|
-
"_": "1672806290972",
|
68
66
|
}
|
69
67
|
temp_df = fetch_paginated_data(url, params)
|
70
68
|
temp_df.rename(
|
@@ -155,7 +153,6 @@ def fund_lof_hist_em(
|
|
155
153
|
"secid": f"{code_id_dict[symbol]}.{symbol}",
|
156
154
|
"beg": start_date,
|
157
155
|
"end": end_date,
|
158
|
-
"_": "1623766962675",
|
159
156
|
}
|
160
157
|
r = requests.get(url, params=params)
|
161
158
|
data_json = r.json()
|
@@ -228,7 +225,6 @@ def fund_lof_hist_min_em(
|
|
228
225
|
"ndays": "5",
|
229
226
|
"iscr": "0",
|
230
227
|
"secid": f"{code_id_dict[symbol]}.{symbol}",
|
231
|
-
"_": "1623766962675",
|
232
228
|
}
|
233
229
|
r = requests.get(url, params=params)
|
234
230
|
data_json = r.json()
|
@@ -268,7 +264,6 @@ def fund_lof_hist_min_em(
|
|
268
264
|
"secid": f"{code_id_dict[symbol]}.{symbol}",
|
269
265
|
"beg": "0",
|
270
266
|
"end": "20500000",
|
271
|
-
"_": "1630930917857",
|
272
267
|
}
|
273
268
|
r = requests.get(url, params=params)
|
274
269
|
data_json = r.json()
|
akshare/fund/fund_manager.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/11/5 20:00
|
|
5
5
|
Desc: 基金经理大全
|
6
6
|
https://fund.eastmoney.com/manager/default.html
|
7
7
|
"""
|
8
|
+
|
8
9
|
import pandas as pd
|
9
10
|
import requests
|
10
11
|
from tqdm import tqdm
|
@@ -35,9 +36,11 @@ def fund_manager_em() -> pd.DataFrame:
|
|
35
36
|
data_json = demjson.decode(data_text.strip("var returnjson= "))
|
36
37
|
total_page = data_json["pages"]
|
37
38
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
38
|
-
params.update(
|
39
|
-
|
40
|
-
|
39
|
+
params.update(
|
40
|
+
{
|
41
|
+
"pi": page,
|
42
|
+
}
|
43
|
+
)
|
41
44
|
r = requests.get(url, params=params)
|
42
45
|
data_text = r.text
|
43
46
|
data_json = demjson.decode(data_text.strip("var returnjson= "))
|
@@ -71,11 +74,19 @@ def fund_manager_em() -> pd.DataFrame:
|
|
71
74
|
"现任基金最佳回报",
|
72
75
|
]
|
73
76
|
]
|
74
|
-
big_df["现任基金最佳回报"] =
|
75
|
-
|
77
|
+
big_df["现任基金最佳回报"] = (
|
78
|
+
big_df["现任基金最佳回报"].str.split("%", expand=True).iloc[:, 0]
|
79
|
+
)
|
80
|
+
big_df["现任基金资产总规模"] = (
|
81
|
+
big_df["现任基金资产总规模"].str.split("亿元", expand=True).iloc[:, 0]
|
82
|
+
)
|
76
83
|
big_df["累计从业时间"] = pd.to_numeric(big_df["累计从业时间"], errors="coerce")
|
77
|
-
big_df["现任基金最佳回报"] = pd.to_numeric(
|
78
|
-
|
84
|
+
big_df["现任基金最佳回报"] = pd.to_numeric(
|
85
|
+
big_df["现任基金最佳回报"], errors="coerce"
|
86
|
+
)
|
87
|
+
big_df["现任基金资产总规模"] = pd.to_numeric(
|
88
|
+
big_df["现任基金资产总规模"], errors="coerce"
|
89
|
+
)
|
79
90
|
big_df["现任基金"] = big_df["现任基金"].apply(lambda x: x.split(","))
|
80
91
|
big_df = big_df.explode(column="现任基金")
|
81
92
|
big_df.reset_index(drop=True, inplace=True)
|
@@ -181,7 +181,6 @@ def fund_portfolio_industry_allocation_em(
|
|
181
181
|
"fundCode": symbol,
|
182
182
|
"year": date,
|
183
183
|
"callback": "jQuery183006997159478989867_1648016188499",
|
184
|
-
"_": "1648016377955",
|
185
184
|
}
|
186
185
|
r = requests.get(url, params=params, headers=headers)
|
187
186
|
data_text = r.text
|
akshare/fund/fund_position_lg.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/4/5 22:05
|
|
5
5
|
Desc: 乐咕乐股-基金仓位
|
6
6
|
https://legulegu.com/stockdata/fund-position/pos-stock
|
7
7
|
"""
|
8
|
+
|
8
9
|
import pandas as pd
|
9
10
|
import requests
|
10
11
|
|
@@ -20,11 +21,16 @@ def fund_stock_position_lg() -> pd.DataFrame:
|
|
20
21
|
"""
|
21
22
|
url = "https://legulegu.com/api/stockdata/fund-position"
|
22
23
|
token = get_token_lg()
|
23
|
-
params = {
|
24
|
+
params = {
|
25
|
+
"token": token,
|
26
|
+
"type": "pos_stock",
|
27
|
+
"category": "总仓位",
|
28
|
+
"marketId": "5",
|
29
|
+
}
|
24
30
|
r = requests.get(
|
25
31
|
url,
|
26
32
|
params=params,
|
27
|
-
**get_cookie_csrf(url="https://legulegu.com/stockdata/fund-position/pos-stock")
|
33
|
+
**get_cookie_csrf(url="https://legulegu.com/stockdata/fund-position/pos-stock"),
|
28
34
|
)
|
29
35
|
data_json = r.json()
|
30
36
|
temp_df = pd.DataFrame(data_json)
|
@@ -36,7 +42,7 @@ def fund_stock_position_lg() -> pd.DataFrame:
|
|
36
42
|
"position",
|
37
43
|
]
|
38
44
|
]
|
39
|
-
temp_df[
|
45
|
+
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
|
40
46
|
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
|
41
47
|
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
|
42
48
|
return temp_df
|
@@ -62,7 +68,7 @@ def fund_balance_position_lg() -> pd.DataFrame:
|
|
62
68
|
params=params,
|
63
69
|
**get_cookie_csrf(
|
64
70
|
url="https://legulegu.com/stockdata/fund-position/pos-pingheng"
|
65
|
-
)
|
71
|
+
),
|
66
72
|
)
|
67
73
|
data_json = r.json()
|
68
74
|
temp_df = pd.DataFrame(data_json)
|
@@ -74,7 +80,7 @@ def fund_balance_position_lg() -> pd.DataFrame:
|
|
74
80
|
"position",
|
75
81
|
]
|
76
82
|
]
|
77
|
-
temp_df[
|
83
|
+
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
|
78
84
|
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
|
79
85
|
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
|
80
86
|
return temp_df
|
@@ -89,13 +95,18 @@ def fund_linghuo_position_lg() -> pd.DataFrame:
|
|
89
95
|
"""
|
90
96
|
url = "https://legulegu.com/api/stockdata/fund-position"
|
91
97
|
token = get_token_lg()
|
92
|
-
params = {
|
98
|
+
params = {
|
99
|
+
"token": token,
|
100
|
+
"type": "pos_linghuo",
|
101
|
+
"category": "总仓位",
|
102
|
+
"marketId": "5",
|
103
|
+
}
|
93
104
|
r = requests.get(
|
94
105
|
url,
|
95
106
|
params=params,
|
96
107
|
**get_cookie_csrf(
|
97
108
|
url="https://legulegu.com/stockdata/fund-position/pos-linghuo"
|
98
|
-
)
|
109
|
+
),
|
99
110
|
)
|
100
111
|
data_json = r.json()
|
101
112
|
temp_df = pd.DataFrame(data_json)
|
@@ -107,7 +118,7 @@ def fund_linghuo_position_lg() -> pd.DataFrame:
|
|
107
118
|
"position",
|
108
119
|
]
|
109
120
|
]
|
110
|
-
temp_df[
|
121
|
+
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
|
111
122
|
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
|
112
123
|
temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce")
|
113
124
|
return temp_df
|
akshare/fund/fund_rank_em.py
CHANGED
@@ -259,7 +259,6 @@ def fund_money_rank_em() -> pd.DataFrame:
|
|
259
259
|
"orderType": "desc",
|
260
260
|
"pageIndex": "1",
|
261
261
|
"pageSize": "10000",
|
262
|
-
"_": "1603867224251",
|
263
262
|
}
|
264
263
|
headers = {
|
265
264
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
@@ -363,7 +362,6 @@ def fund_lcx_rank_em() -> pd.DataFrame:
|
|
363
362
|
"pageSize": "50",
|
364
363
|
"FBQ": "",
|
365
364
|
"callback": "jQuery18303264654966943197_1603867158043",
|
366
|
-
"_": "1603867224251",
|
367
365
|
}
|
368
366
|
headers = {
|
369
367
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
@@ -447,7 +445,6 @@ def fund_hk_rank_em() -> pd.DataFrame:
|
|
447
445
|
"sortfield": "Y",
|
448
446
|
"sorttype": "-1",
|
449
447
|
"isbuy": "0",
|
450
|
-
"_": "1610790553848",
|
451
448
|
}
|
452
449
|
headers = {
|
453
450
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
akshare/fund/fund_rating.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/12/12 16:30
|
|
5
5
|
Desc: 基金评级
|
6
6
|
https://fund.eastmoney.com/data/fundrating.html
|
7
7
|
"""
|
8
|
+
|
8
9
|
import pandas as pd
|
9
10
|
import requests
|
10
11
|
from bs4 import BeautifulSoup
|
@@ -79,7 +80,9 @@ def fund_rating_all() -> pd.DataFrame:
|
|
79
80
|
temp_df["上海证券"] = pd.to_numeric(temp_df["上海证券"], errors="coerce")
|
80
81
|
temp_df["招商证券"] = pd.to_numeric(temp_df["招商证券"], errors="coerce")
|
81
82
|
temp_df["济安金信"] = pd.to_numeric(temp_df["济安金信"], errors="coerce")
|
82
|
-
temp_df["手续费"] =
|
83
|
+
temp_df["手续费"] = (
|
84
|
+
pd.to_numeric(temp_df["手续费"].str.strip("%"), errors="coerce") / 100
|
85
|
+
)
|
83
86
|
return temp_df
|
84
87
|
|
85
88
|
|
@@ -161,10 +164,18 @@ def fund_rating_sh(date: str = "20230630") -> pd.DataFrame:
|
|
161
164
|
]
|
162
165
|
]
|
163
166
|
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
|
164
|
-
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
165
|
-
|
166
|
-
|
167
|
-
temp_df["
|
167
|
+
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
168
|
+
temp_df["3年期评级-3年评级"], errors="coerce"
|
169
|
+
)
|
170
|
+
temp_df["3年期评级-较上期"] = pd.to_numeric(
|
171
|
+
temp_df["3年期评级-较上期"], errors="coerce"
|
172
|
+
)
|
173
|
+
temp_df["5年期评级-5年评级"] = pd.to_numeric(
|
174
|
+
temp_df["5年期评级-5年评级"], errors="coerce"
|
175
|
+
)
|
176
|
+
temp_df["5年期评级-较上期"] = pd.to_numeric(
|
177
|
+
temp_df["5年期评级-较上期"], errors="coerce"
|
178
|
+
)
|
168
179
|
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
169
180
|
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
170
181
|
temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce")
|
@@ -246,8 +257,12 @@ def fund_rating_zs(date: str = "20230331") -> pd.DataFrame:
|
|
246
257
|
]
|
247
258
|
]
|
248
259
|
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
|
249
|
-
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
250
|
-
|
260
|
+
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
261
|
+
temp_df["3年期评级-3年评级"], errors="coerce"
|
262
|
+
)
|
263
|
+
temp_df["3年期评级-较上期"] = pd.to_numeric(
|
264
|
+
temp_df["3年期评级-较上期"], errors="coerce"
|
265
|
+
)
|
251
266
|
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
252
267
|
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
253
268
|
temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce")
|
@@ -330,8 +345,12 @@ def fund_rating_ja(date: str = "20230331") -> pd.DataFrame:
|
|
330
345
|
]
|
331
346
|
]
|
332
347
|
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
|
333
|
-
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
334
|
-
|
348
|
+
temp_df["3年期评级-3年评级"] = pd.to_numeric(
|
349
|
+
temp_df["3年期评级-3年评级"], errors="coerce"
|
350
|
+
)
|
351
|
+
temp_df["3年期评级-较上期"] = pd.to_numeric(
|
352
|
+
temp_df["3年期评级-较上期"], errors="coerce"
|
353
|
+
)
|
335
354
|
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
336
355
|
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
337
356
|
temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce")
|
akshare/fund/fund_scale_em.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/10/27 20:30
|
|
5
5
|
Desc: 天天基金网-基金数据-规模份额
|
6
6
|
https://fund.eastmoney.com/data/cyrjglist.html
|
7
7
|
"""
|
8
|
+
|
8
9
|
import pandas as pd
|
9
10
|
import requests
|
10
11
|
|
@@ -29,14 +30,14 @@ def fund_scale_change_em() -> pd.DataFrame:
|
|
29
30
|
}
|
30
31
|
r = requests.get(url, params=params)
|
31
32
|
data_text = r.text
|
32
|
-
data_json = demjson.decode(data_text[data_text.find("{"): -1])
|
33
|
+
data_json = demjson.decode(data_text[data_text.find("{") : -1])
|
33
34
|
total_page = data_json["pages"]
|
34
35
|
big_df = pd.DataFrame()
|
35
36
|
for page in range(1, int(total_page) + 1):
|
36
37
|
params.update({"pi": page})
|
37
38
|
r = requests.get(url, params=params)
|
38
39
|
data_text = r.text
|
39
|
-
data_json = demjson.decode(data_text[data_text.find("{"): -1])
|
40
|
+
data_json = demjson.decode(data_text[data_text.find("{") : -1])
|
40
41
|
temp_df = pd.DataFrame(data_json["data"])
|
41
42
|
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
42
43
|
big_df.reset_index(inplace=True)
|
@@ -52,10 +53,18 @@ def fund_scale_change_em() -> pd.DataFrame:
|
|
52
53
|
]
|
53
54
|
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"], errors="coerce").dt.date
|
54
55
|
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"], errors="coerce")
|
55
|
-
big_df["期间申购"] = pd.to_numeric(
|
56
|
-
|
57
|
-
|
58
|
-
big_df["
|
56
|
+
big_df["期间申购"] = pd.to_numeric(
|
57
|
+
big_df["期间申购"].str.replace(",", ""), errors="coerce"
|
58
|
+
)
|
59
|
+
big_df["期间赎回"] = pd.to_numeric(
|
60
|
+
big_df["期间赎回"].str.replace(",", ""), errors="coerce"
|
61
|
+
)
|
62
|
+
big_df["期末总份额"] = pd.to_numeric(
|
63
|
+
big_df["期末总份额"].str.replace(",", ""), errors="coerce"
|
64
|
+
)
|
65
|
+
big_df["期末净资产"] = pd.to_numeric(
|
66
|
+
big_df["期末净资产"].str.replace(",", ""), errors="coerce"
|
67
|
+
)
|
59
68
|
return big_df
|
60
69
|
|
61
70
|
|
@@ -77,14 +86,14 @@ def fund_hold_structure_em() -> pd.DataFrame:
|
|
77
86
|
}
|
78
87
|
r = requests.get(url, params=params)
|
79
88
|
data_text = r.text
|
80
|
-
data_json = demjson.decode(data_text[data_text.find("{"): -1])
|
89
|
+
data_json = demjson.decode(data_text[data_text.find("{") : -1])
|
81
90
|
total_page = data_json["pages"]
|
82
91
|
big_df = pd.DataFrame()
|
83
92
|
for page in range(1, int(total_page) + 1):
|
84
93
|
params.update({"pi": page})
|
85
94
|
r = requests.get(url, params=params)
|
86
95
|
data_text = r.text
|
87
|
-
data_json = demjson.decode(data_text[data_text.find("{"): -1])
|
96
|
+
data_json = demjson.decode(data_text[data_text.find("{") : -1])
|
88
97
|
temp_df = pd.DataFrame(data_json["data"])
|
89
98
|
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
90
99
|
big_df.reset_index(inplace=True)
|
@@ -93,17 +102,19 @@ def fund_hold_structure_em() -> pd.DataFrame:
|
|
93
102
|
"序号",
|
94
103
|
"截止日期",
|
95
104
|
"基金家数",
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
105
|
+
"机构持有比列",
|
106
|
+
"个人持有比列",
|
107
|
+
"内部持有比列",
|
108
|
+
"总份额",
|
100
109
|
]
|
101
110
|
big_df["截止日期"] = pd.to_datetime(big_df["截止日期"], errors="coerce").dt.date
|
102
111
|
big_df["基金家数"] = pd.to_numeric(big_df["基金家数"], errors="coerce")
|
103
112
|
big_df["机构持有比列"] = pd.to_numeric(big_df["机构持有比列"], errors="coerce")
|
104
113
|
big_df["个人持有比列"] = pd.to_numeric(big_df["个人持有比列"], errors="coerce")
|
105
114
|
big_df["内部持有比列"] = pd.to_numeric(big_df["内部持有比列"], errors="coerce")
|
106
|
-
big_df["总份额"] = pd.to_numeric(
|
115
|
+
big_df["总份额"] = pd.to_numeric(
|
116
|
+
big_df["总份额"].str.replace(",", ""), errors="coerce"
|
117
|
+
)
|
107
118
|
return big_df
|
108
119
|
|
109
120
|
|
@@ -5,13 +5,14 @@ Date: 2024/1/29 17:00
|
|
5
5
|
Desc: 查询期货合约当前时刻的详情
|
6
6
|
https://finance.sina.com.cn/futures/quotes/V2101.shtml
|
7
7
|
"""
|
8
|
+
|
8
9
|
from io import StringIO
|
9
10
|
|
10
11
|
import pandas as pd
|
11
12
|
import requests
|
12
13
|
|
13
14
|
|
14
|
-
def futures_contract_detail(symbol: str =
|
15
|
+
def futures_contract_detail(symbol: str = "AP2101") -> pd.DataFrame:
|
15
16
|
"""
|
16
17
|
查询期货合约详情
|
17
18
|
https://finance.sina.com.cn/futures/quotes/V2101.shtml
|
@@ -22,18 +23,20 @@ def futures_contract_detail(symbol: str = 'AP2101') -> pd.DataFrame:
|
|
22
23
|
"""
|
23
24
|
url = f"https://finance.sina.com.cn/futures/quotes/{symbol}.shtml"
|
24
25
|
r = requests.get(url)
|
25
|
-
r.encoding =
|
26
|
+
r.encoding = "gb2312"
|
26
27
|
temp_df = pd.read_html(StringIO(r.text))[6]
|
27
28
|
data_one = temp_df.iloc[:, :2]
|
28
|
-
data_one.columns = [
|
29
|
+
data_one.columns = ["item", "value"]
|
29
30
|
data_two = temp_df.iloc[:, 2:4]
|
30
|
-
data_two.columns = [
|
31
|
+
data_two.columns = ["item", "value"]
|
31
32
|
data_three = temp_df.iloc[:, 4:]
|
32
|
-
data_three.columns = [
|
33
|
-
temp_df = pd.concat(
|
33
|
+
data_three.columns = ["item", "value"]
|
34
|
+
temp_df = pd.concat(
|
35
|
+
objs=[data_one, data_two, data_three], axis=0, ignore_index=True
|
36
|
+
)
|
34
37
|
return temp_df
|
35
38
|
|
36
39
|
|
37
|
-
if __name__ ==
|
38
|
-
futures_contract_detail_df = futures_contract_detail(symbol=
|
40
|
+
if __name__ == "__main__":
|
41
|
+
futures_contract_detail_df = futures_contract_detail(symbol="IM2402")
|
39
42
|
print(futures_contract_detail_df)
|
@@ -29,7 +29,6 @@ def futures_inventory_em(symbol: str = "a") -> pd.DataFrame:
|
|
29
29
|
"pageSize": "500",
|
30
30
|
"source": "WEB",
|
31
31
|
"client": "WEB",
|
32
|
-
"_": "1669352163467",
|
33
32
|
}
|
34
33
|
r = requests.get(url, params=params)
|
35
34
|
data_json = r.json()
|
@@ -51,7 +50,6 @@ def futures_inventory_em(symbol: str = "a") -> pd.DataFrame:
|
|
51
50
|
"sortColumns": "TRADE_DATE",
|
52
51
|
"source": "WEB",
|
53
52
|
"client": "WEB",
|
54
|
-
"_": "1669352163467",
|
55
53
|
}
|
56
54
|
r = requests.get(url, params=params)
|
57
55
|
data_json = r.json()
|
akshare/futures/futures_rule.py
CHANGED
@@ -5,6 +5,7 @@ Date: 2023/12/5 19:00
|
|
5
5
|
Desc: 国泰君安期货-交易日历数据表
|
6
6
|
https://www.gtjaqh.com/pc/calendar.html
|
7
7
|
"""
|
8
|
+
|
8
9
|
from io import StringIO
|
9
10
|
|
10
11
|
import pandas as pd
|
@@ -21,6 +22,7 @@ def futures_rule(date: str = "20231205") -> pd.DataFrame:
|
|
21
22
|
:rtype: pandas.DataFrame
|
22
23
|
"""
|
23
24
|
import urllib3
|
25
|
+
|
24
26
|
urllib3.disable_warnings()
|
25
27
|
url = " https://www.gtjaqh.com/pc/calendar"
|
26
28
|
params = {"date": f"{date}"}
|
@@ -32,7 +34,9 @@ def futures_rule(date: str = "20231205") -> pd.DataFrame:
|
|
32
34
|
big_df["涨跌停板幅度"] = pd.to_numeric(big_df["涨跌停板幅度"], errors="coerce")
|
33
35
|
big_df["合约乘数"] = pd.to_numeric(big_df["合约乘数"], errors="coerce")
|
34
36
|
big_df["最小变动价位"] = pd.to_numeric(big_df["最小变动价位"], errors="coerce")
|
35
|
-
big_df["限价单每笔最大下单手数"] = pd.to_numeric(
|
37
|
+
big_df["限价单每笔最大下单手数"] = pd.to_numeric(
|
38
|
+
big_df["限价单每笔最大下单手数"], errors="coerce"
|
39
|
+
)
|
36
40
|
return big_df
|
37
41
|
|
38
42
|
|
@@ -6,6 +6,7 @@ Desc: 新加坡交易所-衍生品-历史数据-历史结算价格
|
|
6
6
|
https://www.sgx.com/zh-hans/research-education/derivatives
|
7
7
|
https://links.sgx.com/1.0.0/derivatives-daily/5888/FUTURE.zip
|
8
8
|
"""
|
9
|
+
|
9
10
|
import zipfile
|
10
11
|
from io import BytesIO
|
11
12
|
from io import StringIO
|
@@ -33,15 +34,29 @@ def __fetch_ftse_index_futu(date: str = "20231108") -> int:
|
|
33
34
|
"iscca": "1",
|
34
35
|
"fields1": "f1,f2,f3,f4,f5,f6,f7,f8",
|
35
36
|
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",
|
36
|
-
|
37
|
-
|
37
|
+
"ut": "f057cbcbce2a86e2866ab8877db1d059",
|
38
|
+
"forcect": "1",
|
38
39
|
}
|
39
40
|
r = requests.get(url, params=params)
|
40
41
|
data_json = r.json()
|
41
|
-
temp_df = pd.DataFrame([item.split(",") for item in data_json[
|
42
|
-
temp_df.columns = [
|
43
|
-
|
44
|
-
|
42
|
+
temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
|
43
|
+
temp_df.columns = [
|
44
|
+
"date",
|
45
|
+
"-",
|
46
|
+
"open",
|
47
|
+
"close",
|
48
|
+
"high",
|
49
|
+
"low",
|
50
|
+
"volume",
|
51
|
+
"amount",
|
52
|
+
"_",
|
53
|
+
"-",
|
54
|
+
"open",
|
55
|
+
"close",
|
56
|
+
"high",
|
57
|
+
"low",
|
58
|
+
]
|
59
|
+
num = temp_df["date"].index[-1] + 791
|
45
60
|
return num
|
46
61
|
|
47
62
|
|
@@ -32,7 +32,6 @@ def futures_stock_shfe_js(date: str = "20240419") -> pd.DataFrame:
|
|
32
32
|
"category": "stock",
|
33
33
|
"date": "-".join([date[:4], date[4:6], date[6:]]),
|
34
34
|
"attr_id": "1",
|
35
|
-
"_": "1708761356458",
|
36
35
|
}
|
37
36
|
r = requests.get(url, params=params, headers=headers)
|
38
37
|
data_json = r.json()
|