akshare 1.16.63__py3-none-any.whl → 1.16.64__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 CHANGED
@@ -3072,9 +3072,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
3072
3072
  1.16.61 fix: fix stock_board_concept_index_ths interface
3073
3073
  1.16.62 fix: fix stock_gdfx_free_holding_change_em interface
3074
3074
  1.16.63 fix: fix stock_board_concept_name_ths interface
3075
+ 1.16.64 add: add reits_hist_em interface
3075
3076
  """
3076
3077
 
3077
- __version__ = "1.16.63"
3078
+ __version__ = "1.16.64"
3078
3079
  __author__ = "AKFamily"
3079
3080
 
3080
3081
  import sys
@@ -4033,7 +4034,7 @@ from akshare.stock.stock_us_pink import stock_us_pink_spot_em
4033
4034
  """
4034
4035
  REITs
4035
4036
  """
4036
- from akshare.reits.reits_basic import reits_realtime_em
4037
+ from akshare.reits.reits_basic import reits_realtime_em, reits_hist_em
4037
4038
 
4038
4039
  """
4039
4040
  全部 A 股-等权重市盈率、中位数市盈率
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2025/2/24 18:00
4
+ Date: 2025/3/27 15:00
5
5
  Desc: REITs 行情及信息
6
6
  https://quote.eastmoney.com/center/gridlist.html#fund_reits_all
7
7
  https://www.jisilu.cn/data/cnreits/#CnReits
@@ -9,6 +9,37 @@ https://www.jisilu.cn/data/cnreits/#CnReits
9
9
 
10
10
  import pandas as pd
11
11
  import requests
12
+ from functools import lru_cache
13
+ from typing import Dict
14
+
15
+
16
+ @lru_cache()
17
+ def __reits_code_market_map() -> Dict:
18
+ """
19
+ 东方财富网-行情中心-REITs-沪深 REITs
20
+ https://quote.eastmoney.com/center/gridlist.html#fund_reits_all
21
+ :return: 沪深 REITs-实时行情
22
+ :rtype: pandas.DataFrame
23
+ """
24
+ url = "https://95.push2.eastmoney.com/api/qt/clist/get"
25
+ params = {
26
+ "pn": "1",
27
+ "pz": "100",
28
+ "po": "1",
29
+ "np": "1",
30
+ "ut": "bd1d9ddb04089700cf9c27f6f7426281",
31
+ "fltt": "2",
32
+ "invt": "2",
33
+ "fid": "f3",
34
+ "fs": "m:1 t:9 e:97,m:0 t:10 e:97",
35
+ "fields": "f12,f13",
36
+ "_": "1630048369992",
37
+ }
38
+ r = requests.get(url, params=params)
39
+ data_json = r.json()
40
+ temp_df = pd.DataFrame(data_json["data"]["diff"])
41
+ temp_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
42
+ return temp_dict
12
43
 
13
44
 
14
45
  def reits_realtime_em() -> pd.DataFrame:
@@ -21,9 +52,9 @@ def reits_realtime_em() -> pd.DataFrame:
21
52
  url = "https://95.push2.eastmoney.com/api/qt/clist/get"
22
53
  params = {
23
54
  "pn": "1",
24
- "pz": "50000",
55
+ "pz": "100",
25
56
  "po": "1",
26
- "np": "2",
57
+ "np": "1",
27
58
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
28
59
  "fltt": "2",
29
60
  "invt": "2",
@@ -34,7 +65,7 @@ def reits_realtime_em() -> pd.DataFrame:
34
65
  }
35
66
  r = requests.get(url, params=params)
36
67
  data_json = r.json()
37
- temp_df = pd.DataFrame(data_json["data"]["diff"]).T
68
+ temp_df = pd.DataFrame(data_json["data"]["diff"])
38
69
  temp_df.reset_index(inplace=True)
39
70
  temp_df["index"] = range(1, len(temp_df) + 1)
40
71
  temp_df.rename(
@@ -51,6 +82,7 @@ def reits_realtime_em() -> pd.DataFrame:
51
82
  "f16": "最低价",
52
83
  "f17": "开盘价",
53
84
  "f18": "昨收",
85
+ "f13": "市场标识",
54
86
  },
55
87
  inplace=True,
56
88
  )
@@ -82,6 +114,66 @@ def reits_realtime_em() -> pd.DataFrame:
82
114
  return temp_df
83
115
 
84
116
 
117
+ def reits_hist_em(symbol: str = "508097") -> pd.DataFrame:
118
+ """
119
+ 东方财富网-行情中心-REITs-沪深 REITs-历史行情
120
+ https://quote.eastmoney.com/sh508097.html
121
+ :param symbol: REITs 代码
122
+ :type symbol: str
123
+ :return: 沪深 REITs-历史行情
124
+ :rtype: pandas.DataFrame
125
+ """
126
+ url = "https://push2his.eastmoney.com/api/qt/stock/kline/get"
127
+ code_market_dict = __reits_code_market_map()
128
+ params = {
129
+ "secid": f"{code_market_dict[symbol]}.{symbol}",
130
+ "klt": "101",
131
+ "fqt": "1",
132
+ "lmt": "10000",
133
+ "end": "20500000",
134
+ "iscca": "1",
135
+ "fields1": "f1,f2,f3,f4,f5,f6,f7,f8",
136
+ "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",
137
+ "ut": "f057cbcbce2a86e2866ab8877db1d059",
138
+ "forcect": "1",
139
+ }
140
+ r = requests.get(url, params=params)
141
+ data_json = r.json()
142
+ temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
143
+ temp_df.columns = [
144
+ "日期",
145
+ "今开",
146
+ "最新价",
147
+ "最高",
148
+ "最低",
149
+ "成交量",
150
+ "成交额",
151
+ "振幅",
152
+ "-",
153
+ "-",
154
+ "换手",
155
+ "-",
156
+ "-",
157
+ "-",
158
+ ]
159
+ temp_df = temp_df[
160
+ ["日期", "今开", "最高", "最低", "最新价", "成交量", "成交额", "振幅", "换手"]
161
+ ]
162
+ temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
163
+ temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
164
+ temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
165
+ temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
166
+ temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
167
+ temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
168
+ temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
169
+ temp_df["换手"] = pd.to_numeric(temp_df["换手"], errors="coerce")
170
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
171
+ return temp_df
172
+
173
+
85
174
  if __name__ == "__main__":
86
175
  reits_realtime_em_df = reits_realtime_em()
87
176
  print(reits_realtime_em_df)
177
+
178
+ reits_hist_em_df = reits_hist_em(symbol="508097")
179
+ print(reits_hist_em_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare
3
- Version: 1.16.63
3
+ Version: 1.16.64
4
4
  Summary: AKShare is an elegant and simple financial data interface library for Python, built for human beings!
5
5
  Home-page: https://github.com/akfamily/akshare
6
6
  Author: AKFamily
@@ -1,4 +1,4 @@
1
- akshare/__init__.py,sha256=ou7Fk2F4vfpfFYRCsSJ_s-Ylk9-ivvkr5YwKXDqvOL0,192265
1
+ akshare/__init__.py,sha256=drq32NLwk6bHnbDO3B6SkfkA7ShbYhVEJCSSBPLUld0,192321
2
2
  akshare/datasets.py,sha256=rKuRNZrqi6IMsZ9nyvO3Rx02js0tH3zMLjz8HQNAoPQ,963
3
3
  akshare/exceptions.py,sha256=WEJjIhSmJ_xXNW6grwV4nufE_cfmmyuhmueVGiN1VAg,878
4
4
  akshare/request.py,sha256=HtFFf9MhfEibR-ETWe-1Tts6ELU4VKSqA-ghaXjegQM,4252
@@ -225,7 +225,7 @@ akshare/qhkc_web/qhkc_tool.py,sha256=pkazsrQQ-pAQgERzHxXWHnEI1iZvo-dGO089c4LGHT8
225
225
  akshare/rate/__init__.py,sha256=gXRhfZhrFm7iIQMmkNkl-ZQUyim2wHyZLVllHQlwO1Q,83
226
226
  akshare/rate/repo_rate.py,sha256=BvTBSQrIwNurGErFwmNW9WjfCbOayJl8dNhs6eqUgE4,4243
227
227
  akshare/reits/__init__.py,sha256=0MO0aWWC8jQBth2IPl3W63vZKvuDb1OJqIpHE-sCQVU,82
228
- akshare/reits/reits_basic.py,sha256=jTOvS1uS_Yxx8RihXcxOr8BiZZtOFi9SG4Ixanfla2A,2737
228
+ akshare/reits/reits_basic.py,sha256=pR6SZmd-nuOw42YBxCeVrLmx850-JXxPeRiX-Oryv9s,5822
229
229
  akshare/sport/__init__.py,sha256=aMsxmuOMZFkcI8tGmQanhPyPwyBpdeApAWyCtDRKMeg,81
230
230
  akshare/sport/sport_olympic.py,sha256=CB1cvLpz2BWuadfonhHuQ17Qxt9X_3ks0Zc5Bff2w9k,818
231
231
  akshare/spot/__init__.py,sha256=VGuha94pXYoezmMs3F3Q_ofaN8RZIrkJ2NtVv8hWCjY,83
@@ -392,10 +392,10 @@ akshare/utils/func.py,sha256=4cwmXFztU86yJNONJ40KJLvsIEQHBbct4iMm3zT2v30,2315
392
392
  akshare/utils/multi_decrypt.py,sha256=aWoL2iEPeuXHJg8-n7OtMKixLnIhfzepACgxfrfmQB4,1657
393
393
  akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOeQ,666
394
394
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
395
- akshare-1.16.63.dist-info/licenses/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
395
+ akshare-1.16.64.dist-info/licenses/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
396
396
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
397
397
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
398
- akshare-1.16.63.dist-info/METADATA,sha256=orbPq4oAuVnI83DaiTTyzMfCRFRBIc2SFFV5FZ2mfSs,13767
399
- akshare-1.16.63.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
400
- akshare-1.16.63.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
401
- akshare-1.16.63.dist-info/RECORD,,
398
+ akshare-1.16.64.dist-info/METADATA,sha256=usbDoPIIKAsJsEn-7RiDnnT0agiNnNr2GandY3htpbM,13767
399
+ akshare-1.16.64.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
400
+ akshare-1.16.64.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
401
+ akshare-1.16.64.dist-info/RECORD,,