akshare 1.16.97__py3-none-any.whl → 1.16.99__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
@@ -3105,9 +3105,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
3105
3105
  1.16.95 fix: fix option_shfe_daily interface
3106
3106
  1.16.96 fix: fix stock_individual_spot_xq interface
3107
3107
  1.16.97 fix: fix fund_open_fund_info_em interface
3108
+ 1.16.98 fix: fix fund_open_fund_info_em interface
3109
+ 1.16.99 fix: fix stock_info_sz_delist interface
3108
3110
  """
3109
3111
 
3110
- __version__ = "1.16.97"
3112
+ __version__ = "1.16.99"
3111
3113
  __author__ = "AKFamily"
3112
3114
 
3113
3115
  import sys
@@ -3129,6 +3131,11 @@ if sys.version_info < (3, 9):
3129
3131
 
3130
3132
  del sys
3131
3133
 
3134
+ """
3135
+ 期权保证金
3136
+ """
3137
+ from akshare.option.option_margin import option_margin, option_margin_symbol
3138
+
3132
3139
  """
3133
3140
  东方财富-港股-证券资料
3134
3141
  """
akshare/fund/fund_em.py CHANGED
@@ -503,7 +503,11 @@ def fund_open_fund_info_em(
503
503
  if indicator == "分红送配详情":
504
504
  url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html"
505
505
  r = requests.get(url, headers=headers)
506
- temp_df = pd.read_html(StringIO(r.text))[1]
506
+ table_num = len(pd.read_html(StringIO(r.text)))
507
+ if table_num == 3:
508
+ temp_df = pd.read_html(StringIO(r.text))[1]
509
+ else:
510
+ temp_df = pd.read_html(StringIO(r.text))[0]
507
511
  if temp_df.iloc[0, 1] == "暂无分红信息!":
508
512
  return pd.DataFrame()
509
513
  else:
@@ -513,7 +517,11 @@ def fund_open_fund_info_em(
513
517
  if indicator == "拆分详情":
514
518
  url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html"
515
519
  r = requests.get(url, headers=headers)
516
- temp_df = pd.read_html(StringIO(r.text))[2]
520
+ table_num = len(pd.read_html(StringIO(r.text)))
521
+ if table_num == 3:
522
+ temp_df = pd.read_html(StringIO(r.text))[2]
523
+ else:
524
+ temp_df = pd.read_html(StringIO(r.text))[1]
517
525
  if temp_df.iloc[0, 1] == "暂无拆分信息!":
518
526
  return pd.DataFrame()
519
527
  else:
@@ -1209,7 +1217,7 @@ if __name__ == "__main__":
1209
1217
  time.sleep(3)
1210
1218
 
1211
1219
  fund_open_fund_info_em_df = fund_open_fund_info_em(
1212
- symbol="005561", indicator="分红送配详情"
1220
+ symbol="014164", indicator="分红送配详情"
1213
1221
  )
1214
1222
  print(fund_open_fund_info_em_df)
1215
1223
  time.sleep(3)
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+ """
4
+ Date: 2025/6/16 18:00
5
+ Desc: 唯爱期货-期权保证金
6
+ https://www.iweiai.com/qihuo/yuanyou
7
+ """
8
+ import requests
9
+ import pandas as pd
10
+ from io import StringIO
11
+
12
+ from bs4 import BeautifulSoup
13
+ from functools import lru_cache
14
+
15
+
16
+ @lru_cache()
17
+ def option_margin_symbol() -> pd.DataFrame:
18
+ """
19
+ 获取商品期权品种代码和名称
20
+ :return: 商品期权品种代码和名称
21
+ :rtype: pandas.DataFrame
22
+ """
23
+ url = "https://www.iweiai.com/qiquan/yuanyou"
24
+ r = requests.get(url)
25
+ soup = BeautifulSoup(r.content, features="lxml")
26
+ symbol_text = [item.get_text() for item in soup.find_all("a") if "qiquan" in item['href']]
27
+ symbol_url = [item['href'] for item in soup.find_all("a") if "qiquan" in item['href']]
28
+ symbol_df = pd.DataFrame([symbol_text, symbol_url]).T
29
+ symbol_df.columns = ["symbol", "url"]
30
+ return symbol_df
31
+
32
+
33
+ def option_margin(symbol: str = "原油期权") -> pd.DataFrame:
34
+ """
35
+ 获取商品期权保证金
36
+ :param symbol: 商品期权品种名称, 如 "原油期权",可以通过 ak.option_margin_symbol() 获取所有商品期权品种代码和名称
37
+ :type symbol: str
38
+ :return: 商品期权保证金
39
+ :rtype: pandas.DataFrame
40
+ """
41
+ option_margin_symbol_df = option_margin_symbol()
42
+ url = option_margin_symbol_df[option_margin_symbol_df['symbol'] == symbol]['url'].values[0]
43
+ r = requests.get(url)
44
+ soup = BeautifulSoup(r.content, features="lxml")
45
+ updated_time = soup.find_all("small")[0].get_text().strip("最近更新:")
46
+ temp_df = pd.read_html(StringIO(r.text))[0]
47
+ temp_df['更新时间'] = updated_time
48
+
49
+ temp_df['结算价'] = pd.to_numeric(temp_df['结算价'], errors='coerce')
50
+ temp_df['交易乘数'] = pd.to_numeric(temp_df['交易乘数'], errors='coerce')
51
+ temp_df['买方权利金'] = pd.to_numeric(temp_df['买方权利金'], errors='coerce')
52
+ temp_df['卖方保证金'] = pd.to_numeric(temp_df['卖方保证金'], errors='coerce')
53
+ temp_df['开仓手续费'] = pd.to_numeric(temp_df['开仓手续费'], errors='coerce')
54
+ temp_df['平今手续费'] = pd.to_numeric(temp_df['平今手续费'], errors='coerce')
55
+ temp_df['平昨手续费'] = pd.to_numeric(temp_df['平昨手续费'], errors='coerce')
56
+ temp_df['手续费(开+平今)'] = pd.to_numeric(temp_df['手续费(开+平今)'], errors='coerce')
57
+ return temp_df
58
+
59
+
60
+ if __name__ == '__main__':
61
+ option_margin_df = option_margin(symbol="原油期权")
62
+ print(option_margin_df)
@@ -17,39 +17,50 @@ def stock_hot_search_baidu(
17
17
  """
18
18
  百度股市通-热搜股票
19
19
  https://gushitong.baidu.com/expressnews
20
+ https://gushitong.baidu.com/
20
21
  :param symbol: choice of {"全部", "A股", "港股", "美股"}
21
22
  :type symbol: str
22
23
  :param date: 日期
23
24
  :type date: str
24
25
  :param time: time="今日";choice of {"今日", "1小时"}
25
26
  :type time: str
26
- :return: 股东人数及持股集中度
27
+ :return: 热搜股票
27
28
  :rtype: pandas.DataFrame
28
29
  """
29
30
  hour_str = datetime.now().hour
30
31
  symbol_map = {
31
- "全部": "all",
32
+ "全市场": "all",
32
33
  "A股": "ab",
33
34
  "港股": "hk",
34
35
  "美股": "us",
35
36
  }
36
- url = "https://finance.pae.baidu.com/vapi/v1/hotrank"
37
+ url = "https://finance.pae.baidu.com/selfselect/listsugrecomm"
38
+ headers = {
39
+ "Accept": "*/*",
40
+ "Accept-Encoding": "gzip, deflate, br",
41
+ "User-Agent": "PostmanRuntime-ApipostRuntime/1.1.0",
42
+ "Connection": "keep-alive",
43
+ "Cookie": "BAIDUID=27174CD808467DD509B95DF001F5D236%3AFG%3D1;BAIDUID=39D7691FB31E844E631F9FA97F6DC18E%3AFG%3D1",
44
+ "Cache-Control": "no-cache",
45
+ "Host": "finance.pae.baidu.com"
46
+ }
37
47
  params = {
38
48
  "tn": "wisexmlnew",
39
49
  "dsp": "iphone",
40
- "product": "stock",
50
+ "product": "search",
51
+ "style": "tablelist",
52
+ "market": symbol_map[symbol],
53
+ "type": "hour",
41
54
  "day": date,
42
55
  "hour": hour_str,
43
56
  "pn": "0",
44
- "rn": "1000",
45
- "market": symbol_map[symbol],
46
- "type": "day" if time == "今日" else "hour",
57
+ "rn": "12",
47
58
  "finClientType": "pc",
48
59
  }
49
- r = requests.get(url, params=params)
60
+ r = requests.get(url, params=params, headers=headers)
50
61
  data_json = r.json()
51
62
  temp_df = pd.DataFrame(
52
- data_json["Result"]["body"], columns=data_json["Result"]["header"]
63
+ data_json["Result"]['list']["body"], columns=data_json["Result"]['list']["header"]
53
64
  )
54
65
  temp_df["现价"] = pd.to_numeric(temp_df["现价"], errors="coerce")
55
66
  temp_df["排名变化"] = pd.to_numeric(temp_df["排名变化"], errors="coerce")
@@ -58,6 +69,6 @@ def stock_hot_search_baidu(
58
69
 
59
70
  if __name__ == "__main__":
60
71
  stock_hot_search_baidu_df = stock_hot_search_baidu(
61
- symbol="A股", date="20240929", time="今日"
72
+ symbol="A股", date="20250610", time="今日"
62
73
  )
63
74
  print(stock_hot_search_baidu_df)
@@ -348,7 +348,7 @@ def stock_info_sh_delist(symbol: str = "全部") -> pd.DataFrame:
348
348
  return temp_df
349
349
 
350
350
 
351
- def stock_info_sz_delist(symbol: str = "暂停上市公司") -> pd.DataFrame:
351
+ def stock_info_sz_delist(symbol: str = "终止上市公司") -> pd.DataFrame:
352
352
  """
353
353
  深证证券交易所-暂停上市公司-终止上市公司
354
354
  https://www.szse.cn/market/stock/suspend/index.html
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare
3
- Version: 1.16.97
3
+ Version: 1.16.99
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=sSkfjzInUqMc3b_nwdKBok_HBUFS2P44c9rKoSsMIQs,194176
1
+ akshare/__init__.py,sha256=tDBuan2R53jc9WLywYIy6lQIso1c4bVMdHCJ3LzuFxg,194376
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
@@ -89,7 +89,7 @@ akshare/fund/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
89
89
  akshare/fund/fund_amac.py,sha256=Dml3EgpJhmVgkttb0OdaWN41ynOCIbJ0-1qAPDWF0oo,33800
90
90
  akshare/fund/fund_announcement.py,sha256=_i1iN_1gYfyDU_7Lrzi5_nNFLhQ8hWzFsLu6WPDCxCM,1849
91
91
  akshare/fund/fund_aum_em.py,sha256=4-wMdoRyIABzhzuO4JphDnLTP0DY4kCVWMoEvsa-OOw,3611
92
- akshare/fund/fund_em.py,sha256=R0m37SggxS_nurHG09Af4VP_geKbKRvOPO6WWM1_z5U,41581
92
+ akshare/fund/fund_em.py,sha256=bFlkVLZOM2wSCgJpeNZ_sXVJqfDHdR-B5GmbZjR4wMw,41895
93
93
  akshare/fund/fund_etf_em.py,sha256=3Jeexgz17HaEg_EWvo4rrSdb_4UXSTQVJN74Km5wn2w,17114
94
94
  akshare/fund/fund_etf_sina.py,sha256=YV2KrqKMF_h8kgrywvWvRJx2oy62lhgizvHFk40E4Rk,7042
95
95
  akshare/fund/fund_etf_ths.py,sha256=vb_jy0h2-Kz2dNWUrwBYxPB0MAotv0KZgnFhE98ohSM,3432
@@ -204,6 +204,7 @@ akshare/option/option_em.py,sha256=9Vm5tDk-i8a0ybzWwa13sUBbWPp5HskYzBlfcs-rF7g,5
204
204
  akshare/option/option_finance.py,sha256=7rnEeHo-7Sddrs36Q4c99CXL_9m8IJzw9S1Aqh3Bw90,12568
205
205
  akshare/option/option_finance_sina.py,sha256=Pzsrl_NKN99nWPSAirq7ushGwSfd738ISVYeCHxMZXE,37843
206
206
  akshare/option/option_lhb_em.py,sha256=6uH1CaRMp4xoIYz-ruEvSi4s1z4gLflSJ4Iw_wPMDdY,9060
207
+ akshare/option/option_margin.py,sha256=VSieQJcXF--kmylJAaZBpFknAqUL4C4Gvi185SQi7bs,2520
207
208
  akshare/option/option_premium_analysis_em.py,sha256=E0_RVSnEcUBlicHv1GdWG5gJYzCgqx6uTXY81y4LY5c,2543
208
209
  akshare/option/option_risk_analysis_em.py,sha256=OcmZ42Ewg9XCJkNDt8uLjtF9akmKsEdoF9Zu97Hz4eE,2587
209
210
  akshare/option/option_risk_indicator_sse.py,sha256=8fny4tQtdCNhNF68xm48ZaK8ceep1aamgNx3ZQeBUrk,2454
@@ -253,14 +254,14 @@ akshare/stock/stock_hold_control_cninfo.py,sha256=J1CGX1tZ22UJdOWAkED19o7vdE10Hk
253
254
  akshare/stock/stock_hold_control_em.py,sha256=pPd_nXUqSN8FHxFbG1JAl5iiRpYyOqVoeqYgBgjpHtQ,7289
254
255
  akshare/stock/stock_hold_num_cninfo.py,sha256=JY9LcZMhhTiCHfQJv4pwMrLrpUxTKGLE4oRD6pvflsU,3706
255
256
  akshare/stock/stock_hot_rank_em.py,sha256=WMbadW1CFU3ppZHMSPjG2HtXgs7PgYGugNqmyrRQQe4,7349
256
- akshare/stock/stock_hot_search_baidu.py,sha256=Zex1iZB2qaqsxYPj6EmuzAXLbAa53W8LcePivGwrwAs,1769
257
+ akshare/stock/stock_hot_search_baidu.py,sha256=w-MF4-5IqGE-EJR1FB0VymH6jiJINikTbBELi0L1xW4,2217
257
258
  akshare/stock/stock_hot_up_em.py,sha256=aSV1QIpTeLLkuHbB6GP10A8VFXCfcqLV3HumRTdjiIA,2524
258
259
  akshare/stock/stock_hsgt_em.py,sha256=-O_0bGcutMF7ezlsIEnhboaNYcw974Wrpk-qQbMgsMM,5123
259
260
  akshare/stock/stock_industry.py,sha256=gG8FwylKstLgL_lvM0CWSQgcsd7pe-a4oCSdzCr4bEo,5768
260
261
  akshare/stock/stock_industry_cninfo.py,sha256=-qgKWECckdsEN3o5B57avBY7QrIWaJVBRsOE1-gEThY,6576
261
262
  akshare/stock/stock_industry_pe_cninfo.py,sha256=0OjjsFGG90zJRZEBqaCsjKSpSAgrp3PpXzMtom_ll_s,4287
262
263
  akshare/stock/stock_industry_sw.py,sha256=C0FjDg976EA0EksRS3sChbmJOZmOPEOzKCrHVs2YqTg,1441
263
- akshare/stock/stock_info.py,sha256=t7Y2NLnCPljHIf97MmmFZlrI2699a9y7AzInWxhWoA4,16254
264
+ akshare/stock/stock_info.py,sha256=NK4S8lvhLbyWa-kMfoR6Kv2ReDbIlEQcevofWS5nKPU,16254
264
265
  akshare/stock/stock_info_em.py,sha256=MmRDYZOQFlXMz5FFYDJ863_H2_kZeFmE2mRRyl6l0z8,2508
265
266
  akshare/stock/stock_intraday_em.py,sha256=lKa33VVH9OPisYvUnfib-lmaGzl_iM12uyKUwRERDZE,2391
266
267
  akshare/stock/stock_intraday_sina.py,sha256=7LzXRwjdPo-BHwvs8244-MFiGriPUCFBJqRW-r9iVB4,2359
@@ -391,10 +392,10 @@ akshare/utils/func.py,sha256=4cwmXFztU86yJNONJ40KJLvsIEQHBbct4iMm3zT2v30,2315
391
392
  akshare/utils/multi_decrypt.py,sha256=aWoL2iEPeuXHJg8-n7OtMKixLnIhfzepACgxfrfmQB4,1657
392
393
  akshare/utils/token_process.py,sha256=nGtgnZGRprXJkhLXH8mcUH4TgIFwzsTOb0EaEPa0Euo,667
393
394
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
394
- akshare-1.16.97.dist-info/licenses/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
395
+ akshare-1.16.99.dist-info/licenses/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
395
396
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
396
397
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
397
- akshare-1.16.97.dist-info/METADATA,sha256=Xml7g5yIRUHGhJuu8o_Z5j6R6owZJ9sJF3SFeRfnxUk,11902
398
- akshare-1.16.97.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
399
- akshare-1.16.97.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
400
- akshare-1.16.97.dist-info/RECORD,,
398
+ akshare-1.16.99.dist-info/METADATA,sha256=Iu4rajzKWDXjw1LiTq3tpAKldGYfoL9wAtvikOk5398,11902
399
+ akshare-1.16.99.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
400
+ akshare-1.16.99.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
401
+ akshare-1.16.99.dist-info/RECORD,,