akshare 1.14.55__py3-none-any.whl → 1.14.57__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.

Potentially problematic release.


This version of akshare might be problematic. Click here for more details.

akshare/__init__.py CHANGED
@@ -2866,9 +2866,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2866
2866
  1.14.53 add: add spot_hog_three_way_soozhu interface
2867
2867
  1.14.54 fix: fix stock_individual_info_em interface
2868
2868
  1.14.55 add: add spot_hog_crossbred_soozhu interface
2869
+ 1.14.56 add: add spot_corn_price_soozhu interface
2870
+ 1.14.57 add: add spot_soybean_price_soozhu interface
2869
2871
  """
2870
2872
 
2871
- __version__ = "1.14.55"
2873
+ __version__ = "1.14.57"
2872
2874
  __author__ = "AKFamily"
2873
2875
 
2874
2876
  import sys
@@ -2904,6 +2906,8 @@ from akshare.spot.spot_hog_soozhu import (
2904
2906
  spot_hog_lean_price_soozhu,
2905
2907
  spot_hog_three_way_soozhu,
2906
2908
  spot_hog_crossbred_soozhu,
2909
+ spot_corn_price_soozhu,
2910
+ spot_soybean_price_soozhu,
2907
2911
  )
2908
2912
 
2909
2913
  """
@@ -4299,11 +4303,6 @@ COMEX黄金-白银库存
4299
4303
  """
4300
4304
  from akshare.futures.futures_comex_em import futures_comex_inventory
4301
4305
 
4302
- """
4303
- 国债期货可交割券相关指标
4304
- """
4305
- from akshare.bond.bond_futures import bond_futures_deliverable_coupons
4306
-
4307
4306
  """
4308
4307
  A 股-特别标的
4309
4308
  """
@@ -1,7 +1,7 @@
1
1
  # -*- coding:utf-8 -*-
2
2
  # !/usr/bin/env python
3
3
  """
4
- Date: 2024/7/31 16:30
4
+ Date: 2024/8/10 15:30
5
5
  Desc: 搜猪-生猪大数据-各省均价实时排行榜
6
6
  https://www.soozhu.com/price/data/center/
7
7
  """
@@ -16,7 +16,7 @@ def spot_hog_soozhu() -> pd.DataFrame:
16
16
  搜猪-生猪大数据-各省均价实时排行榜
17
17
  https://www.soozhu.com/price/data/center/
18
18
  :return: 各省均价实时排行榜
19
- :rtype: pd.DataFrame
19
+ :rtype: pandas.DataFrame
20
20
  """
21
21
  session = requests.session()
22
22
  url = "https://www.soozhu.com/price/data/center/"
@@ -43,7 +43,7 @@ def spot_hog_year_trend_soozhu() -> pd.DataFrame:
43
43
  搜猪-生猪大数据-今年以来全国出栏均价走势
44
44
  https://www.soozhu.com/price/data/center/
45
45
  :return: 今年以来全国出栏均价走势
46
- :rtype: pd.DataFrame
46
+ :rtype: pandas.DataFrame
47
47
  """
48
48
  session = requests.session()
49
49
  url = "https://www.soozhu.com/price/data/center/"
@@ -67,7 +67,7 @@ def spot_hog_lean_price_soozhu() -> pd.DataFrame:
67
67
  搜猪-生猪大数据-全国瘦肉型肉猪
68
68
  https://www.soozhu.com/price/data/center/
69
69
  :return: 全国瘦肉型肉猪
70
- :rtype: pd.DataFrame
70
+ :rtype: pandas.DataFrame
71
71
  """
72
72
  session = requests.session()
73
73
  url = "https://www.soozhu.com/price/data/center/"
@@ -91,7 +91,7 @@ def spot_hog_three_way_soozhu() -> pd.DataFrame:
91
91
  搜猪-生猪大数据-全国三元仔猪
92
92
  https://www.soozhu.com/price/data/center/
93
93
  :return: 全国三元仔猪
94
- :rtype: pd.DataFrame
94
+ :rtype: pandas.DataFrame
95
95
  """
96
96
  session = requests.session()
97
97
  url = "https://www.soozhu.com/price/data/center/"
@@ -115,7 +115,7 @@ def spot_hog_crossbred_soozhu() -> pd.DataFrame:
115
115
  搜猪-生猪大数据-全国后备二元母猪
116
116
  https://www.soozhu.com/price/data/center/
117
117
  :return: 全国后备二元母猪
118
- :rtype: pd.DataFrame
118
+ :rtype: pandas.DataFrame
119
119
  """
120
120
  session = requests.session()
121
121
  url = "https://www.soozhu.com/price/data/center/"
@@ -134,6 +134,54 @@ def spot_hog_crossbred_soozhu() -> pd.DataFrame:
134
134
  return temp_df
135
135
 
136
136
 
137
+ def spot_corn_price_soozhu() -> pd.DataFrame:
138
+ """
139
+ 搜猪-生猪大数据-全国玉米价格走势
140
+ https://www.soozhu.com/price/data/center/
141
+ :return: 全国玉米价格走势
142
+ :rtype: pandas.DataFrame
143
+ """
144
+ session = requests.session()
145
+ url = "https://www.soozhu.com/price/data/center/"
146
+ r = session.get(url)
147
+ soup = BeautifulSoup(r.text, features="lxml")
148
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
149
+ url = "https://www.soozhu.com/price/data/center/"
150
+ payload = {"act": "pricetrend", "indid": "8", "csrfmiddlewaretoken": token}
151
+ r = session.post(url, data=payload)
152
+ data_json = r.json()
153
+ temp_df = pd.DataFrame(data_json["datalist"])
154
+ temp_df.columns = ["日期", "价格"]
155
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
156
+ temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce")
157
+ temp_df.sort_values(by=["日期"], ignore_index=True, inplace=True)
158
+ return temp_df
159
+
160
+
161
+ def spot_soybean_price_soozhu() -> pd.DataFrame:
162
+ """
163
+ 搜猪-生猪大数据-全国豆粕价格走势
164
+ https://www.soozhu.com/price/data/center/
165
+ :return: 全国豆粕价格走势
166
+ :rtype: pandas.DataFrame
167
+ """
168
+ session = requests.session()
169
+ url = "https://www.soozhu.com/price/data/center/"
170
+ r = session.get(url)
171
+ soup = BeautifulSoup(r.text, features="lxml")
172
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
173
+ url = "https://www.soozhu.com/price/data/center/"
174
+ payload = {"act": "pricetrend", "indid": "9", "csrfmiddlewaretoken": token}
175
+ r = session.post(url, data=payload)
176
+ data_json = r.json()
177
+ temp_df = pd.DataFrame(data_json["datalist"])
178
+ temp_df.columns = ["日期", "价格"]
179
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
180
+ temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce")
181
+ temp_df.sort_values(by=["日期"], ignore_index=True, inplace=True)
182
+ return temp_df
183
+
184
+
137
185
  if __name__ == "__main__":
138
186
  spot_hog_soozhu_df = spot_hog_soozhu()
139
187
  print(spot_hog_soozhu_df)
@@ -149,3 +197,9 @@ if __name__ == "__main__":
149
197
 
150
198
  spot_hog_crossbred_soozhu_df = spot_hog_crossbred_soozhu()
151
199
  print(spot_hog_crossbred_soozhu_df)
200
+
201
+ spot_corn_price_soozhu_df = spot_corn_price_soozhu()
202
+ print(spot_corn_price_soozhu_df)
203
+
204
+ spot_soybean_price_soozhu_df = spot_soybean_price_soozhu()
205
+ print(spot_soybean_price_soozhu_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.55
3
+ Version: 1.14.57
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=nGT6ve7sutuipF97vc4I_h_LkzxkK1kAbnNjNce8ies,180619
1
+ akshare/__init__.py,sha256=39CldADB3TqegFkXxkoLLDZV99ozajwRPXwrhcx1N40,180664
2
2
  akshare/datasets.py,sha256=oIu1zC7o_LMHY22lQmdM7vCnryHibKrJLBqJwQiitlI,1167
3
3
  akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
4
4
  akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
@@ -24,7 +24,6 @@ akshare/bond/bond_china.py,sha256=soAask4fpfcnlYzufUHL2phBU0LtzAyWX_nZI_HisKU,69
24
24
  akshare/bond/bond_china_money.py,sha256=IInePsQJDby5w0AYd84ipiJL_nbyVAaRC7SaHLWDP_E,13729
25
25
  akshare/bond/bond_convert.py,sha256=9w94nIdSN4BUL27sPbVEUouBaAm30WMBiokYr4yM0sI,12649
26
26
  akshare/bond/bond_em.py,sha256=Ck5hCloZ25I8updarLPzqHYYZPeOsjIFy4g2oaZvFMs,5318
27
- akshare/bond/bond_futures.py,sha256=sZ4h9FEXrCO13tYuAF0O0cVWKj0mMJBd7cpwVPWag9A,2326
28
27
  akshare/bond/bond_info_cm.py,sha256=VBu9UM9tUcGDRV07pndU9yttLDF_Nk3b0vU0n65qpHs,7890
29
28
  akshare/bond/bond_investing.py,sha256=nWONMggn-KV8XwUSs5CqIXKHX9F7W1tb4w8umH5rWho,4992
30
29
  akshare/bond/bond_issue_cninfo.py,sha256=tPoZhF-_sIX9ztCKB0K0-Z4Kd9b-389bP3_CdFK7Wb0,21672
@@ -227,7 +226,7 @@ akshare/reits/reits_basic.py,sha256=gxQeP8_K7SYjBT9zkKuVRRi8B4SPOHNqVdXe_UvTWTY,
227
226
  akshare/sport/__init__.py,sha256=aMsxmuOMZFkcI8tGmQanhPyPwyBpdeApAWyCtDRKMeg,81
228
227
  akshare/sport/sport_olympic.py,sha256=CB1cvLpz2BWuadfonhHuQ17Qxt9X_3ks0Zc5Bff2w9k,818
229
228
  akshare/spot/__init__.py,sha256=VGuha94pXYoezmMs3F3Q_ofaN8RZIrkJ2NtVv8hWCjY,83
230
- akshare/spot/spot_hog_soozhu.py,sha256=pJSIQ0ywDcEmMS0kmgREh6cxEXEqr3RHj4bCB0Yu230,5980
229
+ akshare/spot/spot_hog_soozhu.py,sha256=Bg-czkxEns3aLk8R3C5BnXVvOT9h3JDsMWrDsY7M7X4,8232
231
230
  akshare/spot/spot_price_qh.py,sha256=rRv09vR8K0U_x6x8AiLgGluxytIXkLatFNVkFbIh8eQ,3756
232
231
  akshare/spot/spot_sge.py,sha256=Ta5EHUlGCSpNDlufIJcwgCErsJEUgH6HJHzYxoYtaMk,6313
233
232
  akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
@@ -381,8 +380,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
381
380
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
382
381
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
383
382
  tests/test_func.py,sha256=tfvy_YnYmDra2dkKZ5JvprU1gNW5X9T634PszdSdH1A,944
384
- akshare-1.14.55.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
385
- akshare-1.14.55.dist-info/METADATA,sha256=DxskfkftIVErvBcSJnb0iLkZjQJEQCogUhjbXZP7yO0,13961
386
- akshare-1.14.55.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
387
- akshare-1.14.55.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
388
- akshare-1.14.55.dist-info/RECORD,,
383
+ akshare-1.14.57.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.14.57.dist-info/METADATA,sha256=CTwwmkc7saT-f4l6HgYAiRhaoE7lb6alfQHYMBoo26M,13961
385
+ akshare-1.14.57.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
386
+ akshare-1.14.57.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.14.57.dist-info/RECORD,,
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding:utf-8 -*-
3
- """
4
- Date: 2020/10/10 13:42
5
- Desc: 国债期货可交割券相关指标
6
- http://www.csindex.com.cn/zh-CN/bond-valuation/bond-futures-deliverable-coupons-related-indicators?date=2020-09-22
7
- """
8
- import pandas as pd
9
- import requests
10
-
11
-
12
- def bond_futures_deliverable_coupons(trade_date: str = "20200923") -> pd.DataFrame:
13
- """
14
- 国债期货可交割券相关指标
15
- http://www.csindex.com.cn/zh-CN/bond-valuation/bond-futures-deliverable-coupons-related-indicators
16
- :param trade_date: 交易日
17
- :type trade_date: str
18
- :return: 国债期货可交割券相关指标
19
- :rtype: pandas.DataFrame
20
- """
21
- trade_date = '-'.join([trade_date[:4], trade_date[4:6], trade_date[6:]])
22
- url = "http://www.csindex.com.cn/zh-CN/bond-valuation/bond-futures-deliverable-coupons-related-indicators"
23
- params = {
24
- "date": trade_date
25
- }
26
- headers = {
27
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
28
- 'Accept-Encoding': 'gzip, deflate',
29
- 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
30
- 'Cache-Control': 'no-cache',
31
- 'Host': 'www.csindex.com.cn',
32
- 'Pragma': 'no-cache',
33
- 'Proxy-Connection': 'keep-alive',
34
- 'Referer': f'http://www.csindex.com.cn/zh-CN/bond-valuation/bond-futures-deliverable-coupons-related-indicators?date={trade_date}',
35
- 'Upgrade-Insecure-Requests': '1',
36
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36',
37
- }
38
- r = requests.get(url, params=params, headers=headers)
39
- temp_df = pd.read_html(r.text)[0]
40
- temp_df['日期'] = temp_df['日期'].astype(str)
41
- temp_df['银行间代码'] = temp_df['银行间代码'].astype(str)
42
- temp_df['上交所代码'] = temp_df['上交所代码'].astype(str)
43
- temp_df['深交所代码'] = temp_df['深交所代码'].astype(str)
44
- temp_df.rename({"中证估值(净价)": "中证估值", "隐含回购利率(%)": "隐含回购利率"}, inplace=True, axis=1)
45
- return temp_df
46
-
47
-
48
- if __name__ == '__main__':
49
- bond_futures_deliverable_coupons_df = bond_futures_deliverable_coupons(trade_date="20210823")
50
- print(bond_futures_deliverable_coupons_df)